|  |  |  | 
|---|
|  |  |  | return obj; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public object GetCurrentMenuPhoneActionList() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | object obj = GetMenuActionPhoneList(App.User.RoleId); | 
|---|
|  |  |  | if (obj is IEnumerable<object> list) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (list.Any()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return obj; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return WebResponseContent.Instance.Error("未获取到菜单信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return obj; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 根据角色ID获取菜单与权限 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | public object GetMenuActionList(int roleId) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (App.User.IsRoleIdSuperAdmin(roleId)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return BaseDal.GetSuperAdminMenu(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseDal.GetMenuByRoleId(roleId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 根据角色ID获取菜单与权限 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="roleId"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | public object GetMenuActionPhoneList(int roleId) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var allMenu = BaseDal.QueryData(x => (x.Enable == 1 || x.Enable == 2) && x.MenuType == 1 && x.ParentId > 0).OrderByDescending(a => a.OrderNo).ThenByDescending(q => q.ParentId).ToList(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var menu = allMenu.Select(x => new | 
|---|
|  |  |  | { | 
|---|
|  |  |  | text = x.MenuName, | 
|---|
|  |  |  | url = x.Url, | 
|---|
|  |  |  | icon = x.Icon, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return menu.ToList(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public List<MenuDTO> GetUserMenuList(int roleId) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (menu.MenuId == menu.ParentId) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return webResponse.Error($"父级id不能为自己"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (BaseDal.QueryFirst(x => x.ParentId == menu.MenuId && menu.ParentId == x.MenuId) != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return webResponse.Error($"不能选择此父级id,选择的父级id与当前菜单形成依赖关系"); | 
|---|
|  |  |  | 
|---|
|  |  |  | webResponse.Error(ex.Message); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return webResponse; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|