| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace addons\Sicpay\backend\controllers;
- use addons\Sicpay\common\services\ConfigService;
- use Yii;
- use common\controllers\AddonsController;
- /**
- * 默认控制器
- *
- * Class DefaultController
- * @package addons\Sicpay\backend\controllers
- */
- class DefaultController extends BaseController
- {
- public $enableCsrfValidation = false;
- public $service;
- public function __construct ($id, $module, $config = [])
- {
- parent::__construct($id, $module, $config);
- $this->service = new ConfigService(['mall_id'=>$this->mall_id]);
- }
- /**
- * 首页
- *
- * @return string
- */
- public function actionIndex()
- {
- if(!$this->request->isAjax){
- return $this->render('index');
- }
- }
- public function actionGetConfig(){
- $config = $this->service->getConfig($this->mall_id);
- return $this->success('',empty($config) ? '' : $config);
- }
- public function actionSave(){
- $data = $this->request->post();
- $data['mall_id'] = $this->mall_id;
- $res = $this->service->save($data);
- return $res ? $this->success("操作成功") : $this->error($this->service->error);
- }
- }
|