request->input('key'); $editValue = $this->request->input('value'); switch ($editKey) { case 'test': default: break; } $res = (new Config)->where('key', $editKey)->update(['value' => $editValue]); if (!$res) throw new ErrException('配置更新失败'); return $this->return->success(); } /** * 获取配置模块 * @return array */ public function getConfigModule(): array { $res = $this->configModel->getTopConfigModule(); return $this->return->success('success', ['list' => $res]); } /** * 获取数据 * @return array */ public function getConfigForm(): array { $list = $this->configModel->getConfigByPid($this->request->input('pid')); foreach ($list as &$item) { switch ($item['type']) { case 2: $data = explode('|', $item['value']); $item['min'] = (int)$data[0]; $item['max'] = (int)$data[1]; break; default: break; } } return $this->return->success('success', ['list' => $list]); } }