application/manage/controller/Menu.php
public function editMenu(Request $request)
    {
        $menu_id = $request->param('menu_id');
        if (empty($menu_id)) {
            return $this->error('菜单ID为空');
        }
        
        $menu_logic = MenuLogic::instance();
        if ($request->isPost()) {
            $data = [
                'menu_name' => $request->param('menu_name'),
                'menu_url' => $request->param('menu_url'),
                'menu_pid' => $request->post('menu_pid', 0),
                'menu_group' => $request->param('menu_group', ''),
                'menu_sort' => $request->param('menu_sort', 0),
                'menu_target' => $request->param('menu_target', ''),
                'menu_build' => $request->param('menu_build', 0),
                'menu_status' => $request->param('menu_status', 0)
            ];
            
            // 验证菜单
            $res = $menu_logic->validate->scene('edit')->check($data);
            if (! $res) {
                return $this->error($menu_logic->validate->getError());
            }
            
            // 保存菜单
            $menu_logic->saveMenu($data, $menu_id);
            
            return $this->success('修改菜单成功', Url::build('menu/index', [
                'menu_pid' => $request->param('menu_pid')
            ]));
        } else {
            $this->site_title = '编辑菜单';
            $this->assign('menu_id', $menu_id);
            
            // 菜单
            $menu = $menu_logic->model->get($menu_id);
            $this->assign('menu', $menu);
            
            // 上级菜单下拉选择
            $menu_select = $menu_logic->getMenuSelect();
            $this->assign('menu_select', $menu_select);
            
            // 打开方式
            $menu_target = $menu_logic->menuTarget();
            $this->assign('menu_target', $menu_target);
            
            // 是否build
            $menu_build = $menu_logic->menuBuild();
            $this->assign('menu_build', $menu_build);
            
            // 菜单状态
            $menu_status = $menu_logic->menuStatus();
            $this->assign('menu_status', $menu_status);
            
            return $this->fetch();
        }
    }
public function editMenu(Request $request)
    {
        $menu_id = $request->param('menu_id');
        if (empty($menu_id)) {
            return $this->error('菜单ID为空');
        }
        
        $menu_logic = MenuLogic::instance();
        if ($request->isPost()) {
            $data = [
                'menu_name' => $request->param('menu_name'),
                'menu_url' => $request->param('menu_url'),
                'menu_pid' => $request->post('menu_pid', 0),
                'menu_group' => $request->param('menu_group', ''),
                'menu_sort' => $request->param('menu_sort', 0),
                'menu_target' => $request->param('menu_target', ''),
                'menu_build' => $request->param('menu_build', 0),
                'menu_status' => $request->param('menu_status', 0)
            ];
            
            // 验证菜单
            $res = $menu_logic->validate->scene('edit')->check($data);
            if (! $res) {
                return $this->error($menu_logic->validate->getError());
            }
            
            // 保存菜单
            $menu_logic->saveMenu($data, $menu_id);
            
            return $this->success('修改菜单成功', Url::build('menu/index', [
                'menu_pid' => $request->param('menu_pid')
            ]));
        } else {
            $this->site_title = '编辑菜单';
            $this->assign('menu_id', $menu_id);
            
            // 菜单
            $menu = $menu_logic->model->get($menu_id);
            $this->assign('menu', $menu);
            
            // 上级菜单下拉选择
            $menu_select = $menu_logic->getMenuSelect();
            $this->assign('menu_select', $menu_select);
            
            // 打开方式
            $menu_target = $menu_logic->menuTarget();
            $this->assign('menu_target', $menu_target);
            
            // 是否build
            $menu_build = $menu_logic->menuBuild();
            $this->assign('menu_build', $menu_build);
            
            // 菜单状态
            $menu_status = $menu_logic->menuStatus();
            $this->assign('menu_status', $menu_status);
            
            return $this->fetch();
        }
    }
public function editMenu ( Request $ request ) { $ menu_id = $ request -> param ( 'menu_id' ) ; if ( empty ( $ menu_id ) ) { return $ this -> error ( '菜单ID为空'); } $ menu_logic = MenuLogic :: instance ( ) ; if ( $ request -> isPost ( ) ) { $ data = [ 'menu_name' => $ request -> param ( 'menu_name' ) , 'menu_url' => $ request -> param ( 'menu_url' ) , 'menu_pid' => $ request -> post ( 'menu_pid' , 0 ) , 'menu_group' => $ request -> param ( 'menu_group' , '' ) , 'menu_sort' => $ request -> param ( 'menu_sort' , 0 ) , 'menu_target' => $ request -> param ( 'menu_target' , '' ) , 'menu_build' => $ request -> param ( 'menu_build' , 0 ) , 'menu_status' => $ request -> param ( 'menu_status' , 0 ) ] ; // 验证菜单 $ res = $ menu_logic -> validate -> scene ( 'edit' ) -> check ( $ data ) ; if ( ! $ res ) { return $ this -> error ( $ menu_logic -> validate -> getError ( ) ) ; } // 保存菜单 $ menu_logic -> saveMenu ( $ data , $ menu_id ) ; return $ this -> success ( '修改菜单成功', Url::build ( men u/ index ' , [ 'menu_pid' => $ request -> param ( 'menu_pid' ) ] ) ) ; } else { $ this -> site_title = '编辑菜单'; $ this -> assign ( 'menu_id' , $ menu_id ) ; // 菜单 $ menu = $ menu_logic -> model -> get ( $ menu_id ) ; $ this -> assign ( 'menu' , $ menu ) ; // 上级菜单下拉选择 $ menu_select = $ menu_logic -> getMenuSelect ( ) ; $ this -> assign ( 'menu_select' , $ menu_select ) ; // 打开方式 $ menu_target = $ menu_logic -> menuTarget ( ) ; $ this -> assign ( 'menu_target' , $ menu_target ) ; // 是否build $ menu_build = $ menu_logic -> menuBuild ( ) ; $ this -> assign ( 'menu_build' , $ menu_build ) ; // 菜单状态 $ menu_status = $ menu_logic -> menuStatus ( ) ; $ this -> assign ( 'menu_status' , $ menu_status ) ; return $ this -> fetch ( ) ; } }
编辑菜单

@param Request $request
@return mixed
编辑菜单