request; $settingService = new SettingService(['mall_id' => $this->mall_id]); if ($retuest->isAjax) { if ($retuest->isPost) { $params = \Yii::$app->request->post(); $res = \Yii::$app->services->validate->validate($params,[ [['give_type', 'is_effective_coupon_give'], 'safe'], ]); if($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $config = $settingService->setSetting($params); $this->success('保存成功', $config); } else { // 获取配置 $config = $settingService->getSetting(); $this->success('获取成功',$config,ApiCode::CODE_SUCCESS,0); } } 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); } }