getAllMenuList($app_type, 'all', 1)); } /** * 菜单信息 * @param $menu_key * @return Response */ public function info($app_type, $menu_key) { return success((new MenuService())->get($app_type, $menu_key)); } /** * 新增菜单接口 * @return Response */ public function add() { $data = $this->request->params([ ['app_type', ''], ['menu_name', ''], ['menu_type', 0], ['menu_key', ''], ['parent_key', ''], ['icon', ''], ['api_url', ''], ['view_path', ''], ['router_path', ''], ['methods', ''], ['sort', 0], ['status', MenuDict::ON], ['is_show', 0], ['addon', ''], ['menu_short_name',''] ]); $this->validate($data, 'app\validate\sys\Menu.add'); (new MenuService())->add($data); return success('ADD_SUCCESS'); } /** * 菜单或接口更新 */ public function edit($app_type, $menu_key) { $data = $this->request->params([ ['menu_name', ''], ['parent_key', ''], ['menu_type', 0], ['icon', ''], ['api_url', ''], ['router_path', ''], ['view_path', ''], ['methods', ''], ['sort', 0], ['status', MenuDict::ON], ['is_show', 0], ['addon', ''], ['menu_short_name',''] ]); $this->validate($data, 'app\validate\sys\Menu.edit'); (new MenuService())->edit($app_type, $menu_key, $data); return success('EDIT_SUCCESS'); } /** * 获取菜单类型静态资源 * @return Response */ public function getMenuType() { return success(MenuTypeDict::getMenuType()); } /** * 获取请求方式 * @return Response */ public function getMethodType() { return success(MethodDict::getMethodType()); } /** * 删除菜单 * @param $menu_key * @return Response */ public function del($app_type, $menu_key) { (new MenuService())->del($app_type, $menu_key); return success('DELETE_SUCCESS'); } public function refreshMenu() { (new InstallSystemService())->install(); return success('REFRESH_SUCCESS'); } /** * 查询菜单信息 */ public function getSystem() { return success( (new MenuService())->getSystemMenu('all', 1)); } /** * 查询应用权限信息 */ public function getAddonMenu($app_key) { return success( (new MenuService())->getAddonMenu($app_key,'all', 1)); } /** * 查询菜单类型为目录的菜单 * @param $addon * @return Response */ public function getMenuByTypeDir($addon = 'system') { return success( (new MenuService())->getMenuByTypeDir($addon)); } }