application/manage/controller/MemberGroup.php
public function editGroup(Request $request)
    {
        $group_id = $request->param('group_id');
        if (empty($group_id)) {
            return $this->error('群组ID为空');
        }
        
        $group_logic = MemberGroupLogic::instance();
        if ($request->isPost()) {
            $data = [
                'group_name' => $request->param('group_name'),
                'group_info' => $request->param('group_info', ''),
                'home_page' => $request->param('home_page', ''),
                'group_status' => $request->param('group_status', 0)
            ];
            
            // 验证群组
            $res = $group_logic->validate->scene('edit')->check($data);
            if (! $res) {
                return $this->error($group_logic->validate->getError());
            }
            
            // 保存群组
            $group_logic->model->saveById($data, $group_id);
            
            return $this->success('修改群组成功', Url::build('memberGroup/index'));
        } else {
            
            $this->site_title = '编辑群组';
            $this->assign('group_id', $group_id);
            
            // 群组
            $group = $group_logic->model->get($group_id);
            $this->assign('group', $group);
            
            // 群组状态
            $group_status = $group_logic->groupStatus();
            $this->assign('group_status', $group_status);
            
            return $this->fetch();
        }
    }
public function editGroup(Request $request)
    {
        $group_id = $request->param('group_id');
        if (empty($group_id)) {
            return $this->error('群组ID为空');
        }
        
        $group_logic = MemberGroupLogic::instance();
        if ($request->isPost()) {
            $data = [
                'group_name' => $request->param('group_name'),
                'group_info' => $request->param('group_info', ''),
                'home_page' => $request->param('home_page', ''),
                'group_status' => $request->param('group_status', 0)
            ];
            
            // 验证群组
            $res = $group_logic->validate->scene('edit')->check($data);
            if (! $res) {
                return $this->error($group_logic->validate->getError());
            }
            
            // 保存群组
            $group_logic->model->saveById($data, $group_id);
            
            return $this->success('修改群组成功', Url::build('memberGroup/index'));
        } else {
            
            $this->site_title = '编辑群组';
            $this->assign('group_id', $group_id);
            
            // 群组
            $group = $group_logic->model->get($group_id);
            $this->assign('group', $group);
            
            // 群组状态
            $group_status = $group_logic->groupStatus();
            $this->assign('group_status', $group_status);
            
            return $this->fetch();
        }
    }
编辑群组

@param Request $request
@return mixed