model = new SystemConfig(); } /** * @NodeAnotation(title="列表") */ public function index() { $this->assign('total_renwu', 11); $this->assign('total_shouxu', 22); return $this->fetch(); } /** * @NodeAnotation(title="保存") */ public function save() { $this->checkPostRequest(); $post = $this->request->post(); sr_log(json_encode($post)); try { foreach ($post as $key => $val) { $this->model ->where('name', $key) ->update([ 'value' => $val, ]); } TriggerService::updateMenu(); TriggerService::updateSysconfig(); } catch (\Exception $e) { $this->error('保存失败'); } $this->success('保存成功'); } }