| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace addons\QiJuhe\backend\controllers;
- use addons\QiJuhe\common\service\DebugService;
- use addons\QiJuhe\common\service\SettingService;
- use Yii;
- use common\controllers\AddonsController;
- /**
- * 默认控制器
- *
- * Class DefaultController
- * @package addons\QiJuhe\backend\controllers
- */
- class DefaultController extends BaseController
- {
- public $enableCsrfValidation = false;
- /**
- * 设置页面
- *
- * @return void
- */
- public function actionIndex()
- {
- if ($this->request->isAjax) {
- $service = new SettingService(['mall_id' => $this->mall_id]);
- $data = $service->getSetting();
- return $this->success('ok', $data);
- }
- return $this->render('index');
- }
- /**
- * 提交设置
- *
- * @return void
- */
- public function actionSubmit()
- {
- if ($this->request->isAjax) {
- $service = new SettingService(['mall_id' => $this->mall_id]);
- $data = $this->request->post();
- $service->attributes = $data;
- $service->setSetting();
- return $this->success();
- }
- }
- /**
- * 调试
- *
- * @return void
- */
- public function actionDebug()
- {
- if ($this->request->isPost) {
- $type = $this->request->post('type');
- return ($service = new DebugService(['mall_id' => $this->mall_id]))->hander($type)
- ? $this->success('ok', $service->getResult())
- : $this->error($service->getError());
- }
- return $this->render('debug');
- }
- }
|