| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace addons\YunfastPay\backend\controllers;
- use addons\YunfastPay\common\services\SettingService;
- /**
- * 设置控制器
- * @package addons\YunfastPay\backend\controllers
- */
- class SettingController extends BaseController
- {
- public $enableCsrfValidation = false;
- /**
- * @var SettingService
- */
- private $service;
- public function init()
- {
- parent::init();
- $this->service = new SettingService(
- ['mall_id' => $this->mall_id]
- );
- }
- /**
- * 设置页面
- *
- * @return void
- */
- public function actionIndex()
- {
- if ($this->request->isAjax) {
- return $this->success(
- 'ok',
- ['setting' => $this->service->getSetting()]
- );
- }
-
- return $this->render('index');
- }
- /**
- * 获取配置
- *
- * @return void
- */
- public function actionSave()
- {
- if ($this->request->isPost) {
- $data = $this->request->post();
- unset($data['_csrf']);
-
- return $this->service->setSetting($data)
- ? $this->success('ok')
- : $this->error($this->service->getErrorMsg());
- }
- }
- }
|