| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace addons\AvoidTax\backend\controllers;
- use addons\AvoidTax\common\service\TaxConfigService;
- use Yii;
- /**
- * 配置
- *
- * Class DefaultController
- * @package addons\AvoidTax\backend\controllers
- */
- class DefaultController extends BaseController
- {
- public $service;
- public $enableCsrfValidation = false;
- public function __construct($id, $module, $config = [])
- {
- parent::__construct($id, $module, $config);
- $this->service = new TaxConfigService(['mall_id' => intval($this->mall_id)]);
- }
- /**
- * 首页
- * @return string
- */
- public function actionIndex()
- {
- if (!$this->request->isAjax) {
- return $this->render('index');
- }
- $data = $this->request->post();
- $res = $this->service->add($data);
- return $res ? $this->success("操作成功") : $this->error($this->service->error);
- }
- /**
- * 读取配置
- * @return string
- */
- public function actionRead()
- {
- $config = $this->service->getConfig();
- return $this->success_str('ok', $config);
- }
- }
|