updateEvent('web'); } /** * 登录注册 */ public function passport() { return $this->updateEvent('passport'); } /** * 功能设置 */ public function ability() { return $this->updateEvent('ability'); } /** * 分佣设置 */ public function divide() { return $this->updateEvent('divide'); } /** * 更新设置事件 */ private function updateEvent(string $key) { if (!$this->request->isAjax()) { $model = SettingModel::getItem($key,0); return View::fetch($key, compact('model')); } $model = new SettingModel; if ($model->edit($key,$this->postData('data'))) { return $this->renderSuccess('更新成功'); } return $this->renderError('更新失败'); } }