request->isAjax) { $service = new SettingService(['mall_id' => $this->mall_id]); return $this->success('ok', $service->getSetting()); } return $this->render($this->action->id); } /** * 保存设置 * * @return mixed */ public function actionSave() { $service = new SettingService(['mall_id' => $this->mall_id]); $params = $this->request->post(); $res = Yii::$app->services->validate->validate($params, [ [['pickup_code_name'], 'required'], ]); if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage()); return $service->setSetting($params) ? $this->success('ok') : $this->error($service->getError()); } }