service = new SettingService(['mall_id' => $this->mall_id]); } /** * 首页 * * @return string */ public function actionIndex() { if ($this->request->isAjax) { return $this->success('ok', ['setting' => $this->service->getSetting()]); } return $this->render($this->action->id); } /** * 保存设置 * * @return string */ public function actionSave() { if ($this->request->isPost) { $data = $this->request->post(); unset($data['_csrf']); return $this->service->setSetting($data) ? $this->success('ok') : $this->error('设置失败'); } } }