public async Task <MSSResult <MenuTree> > GetMenu() { User u = await _repo.GetByID(userID); MSSResult <MenuTree> mRet = new MSSResult <MenuTree>(); try { List <ActionAll> laa = new List <ActionAll>(); //允许勾选和不对外开放的且为菜单的url if (u.IsSuper) { laa = await _ActionRepo.GetActionAll(); mRet.data = ActionHelper.GetMenuTree(laa.Where( a => (a.Level == (int)ACTION_LEVEL.AllowSelection || a.Level == (int)ACTION_LEVEL.NotAllowAll) && a.GroupID > 0).ToList()); } //根据用户ID获取对应菜单权限 else { laa = await _ActionRepo.GetActionByUser(userID); mRet.data = ActionHelper.GetMenuTree(laa.Where(a => a.GroupID > 0).ToList()); } mRet.code = (int)ErrType.OK; return(mRet); } catch (Exception ex) { mRet.code = (int)ErrType.SystemErr; mRet.msg = ex.Message; return(mRet); } }