application/manage/controller/Config.php
public function editConfig(Request $request)
    {
        $config_id = $request->param('config_id');
        if (empty($config_id)) {
            return $this->error('配置ID为空');
        }
        
        $config_logic = ConfigLogic::instance();
        if ($request->isPost()) {
            $data = [
                'config_name' => $request->param('config_name'),
                'config_type' => $request->param('config_type'),
                'config_title' => $request->param('config_title'),
                'config_group' => $request->param('config_group'),
                'config_sort' => $request->param('config_sort', 0),
                'config_extra' => $request->param('config_extra'),
                'config_remark' => $request->param('config_remark')
            ];
            
            // 验证数据
            $res = $config_logic->validate->scene('edit')->check($data);
            if (! $res) {
                return $this->error($config_logic->validate->getError());
            }
            $config_logic->saveConfig($data, $config_id);
            
            return $this->success('修改配置成功', Url::build('config/index'));
        } else {
            $this->site_title = '编辑配置';
            $this->assign('config_id', $config_id);
            
            $config_type = $config_logic->getConfigType();
            $this->assign('config_type', $config_type);
            
            $config = $config_logic->model->get($config_id);
            $this->assign('config', $config);
            
            return $this->fetch();
        }
    }
public function editConfig(Request $request)
    {
        $config_id = $request->param('config_id');
        if (empty($config_id)) {
            return $this->error('配置ID为空');
        }
        
        $config_logic = ConfigLogic::instance();
        if ($request->isPost()) {
            $data = [
                'config_name' => $request->param('config_name'),
                'config_type' => $request->param('config_type'),
                'config_title' => $request->param('config_title'),
                'config_group' => $request->param('config_group'),
                'config_sort' => $request->param('config_sort', 0),
                'config_extra' => $request->param('config_extra'),
                'config_remark' => $request->param('config_remark')
            ];
            
            // 验证数据
            $res = $config_logic->validate->scene('edit')->check($data);
            if (! $res) {
                return $this->error($config_logic->validate->getError());
            }
            $config_logic->saveConfig($data, $config_id);
            
            return $this->success('修改配置成功', Url::build('config/index'));
        } else {
            $this->site_title = '编辑配置';
            $this->assign('config_id', $config_id);
            
            $config_type = $config_logic->getConfigType();
            $this->assign('config_type', $config_type);
            
            $config = $config_logic->model->get($config_id);
            $this->assign('config', $config);
            
            return $this->fetch();
        }
    }
编辑配置

@param Request $request
@return string