| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- /**
- * Created by PhpStorm.
- * User: wniu
- * Date: 2022/5/31
- * Time: 10:08 下午
- */
- namespace addons\Pk\backend\controllers;
- use addons\OperatingNote\common\enums\NoteEnum;
- use addons\Pk\common\enums\PkEnum;
- use addons\Pk\common\models\PkSms;
- use common\models\common\PlatformSetting;
- class SettingController extends BaseController
- {
- public $enableCsrfValidation = false;
- /**
- * 首页
- *
- * @return string
- */
- public function actionIndex()
- {
- $retuest = \Yii::$app->request;
- if ($retuest->isAjax) {
- if ($retuest->isPost) {
- $params = \Yii::$app->request->post();
- $res = \Yii::$app->services->validate->validate($params,[
- [['not_allow_apply_hour','is_no_restrictions','person',], 'safe'],
- [['bg_img','page','is_enable','type'],'safe'],
- ]);
- if($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage());
- $config = \Yii::$app->services->setting->addons->set($this->mall_id, PkEnum::ADDONS_NAME, ['basic' => $params]);
- $this->success('保存成功', $config);
- } else {
- // 获取配置
- $config = \Yii::$app->services->setting->addons->get($this->mall_id, PkEnum::ADDONS_NAME, 'basic');
- $Platform_config = PlatformSetting::getConfByGroup( 'system', true);
- $config['web_url'] = $Platform_config['h5_url']['value'].'/#/plugins2/Pk/index?sign='.$this->mall['mall_sign'];
- $this->success('获取成功',$config);
- }
- }
- return $this->render($this->action->id);
- }
- public function actionSmsDetail()
- {
- $params = \Yii::$app->request->get();
- $mall_id = $this->mall_id;
- $one = PkSms::find()->where(['sms_key' => $params['sms_key'], 'mall_id' => $mall_id])->one();
- if (!$one) {
- $one = PkSms::def();
- }
- return $this->success('success', $one);
- }
- public function actionSmsEdit()
- {
- $params = \Yii::$app->request->post();
- $params['mall_id'] = $this->mall_id;
- $model = PkSms::setData($params);
- return $this->success('success', $model);
- }
- }
|