public async Task <List <TreeItem <ViewMenu> > > GetUserTreeMenuAsync(int iUserId) { List <ViewMenu> lstViewMenu = new List <ViewMenu>(); List <Menu> lstUserMenu = new List <Menu>(); //查询角色所拥有的菜单集合 lstUserMenu = await RedisMethod.GetUserMenuAsync(iUserId, -1, () => _MenuService.GetRoleMenuListAsync(iUserId)); if (lstUserMenu?.Count > 0) { //排序 lstUserMenu = lstUserMenu.OrderBy(x => x.Isort).ToList(); lstUserMenu.ForEach(entityMenu => { ViewMenu entityViewMenu = new ViewMenu(); entityViewMenu.Id = entityMenu.Id; entityViewMenu.ParentId = entityMenu.IparentId == -1 ? 0 : entityMenu.IparentId; entityViewMenu.DisplayName = entityMenu.Sname; entityViewMenu.IconUrl = entityMenu.SiconUrl; entityViewMenu.LinkUrl = entityMenu.SlinkUrl; entityViewMenu.Target = ""; lstViewMenu.Add(entityViewMenu); }); } return(lstViewMenu.GenerateTree(x => x.Id, x => x.ParentId).ToList()); }
public async Task <string> GetMenuAsync() { int iUserId = Convert.ToInt32(User.Claims.FirstOrDefault(x => x.Type == "Id")?.Value); List <TreeItem <ViewMenu> > lstTreeItem = await RedisMethod.GetUserTreeMenuAsync(iUserId, -1, () => GetUserTreeMenuAsync(iUserId)); return(JsonHelper.ObjectToJSON(lstTreeItem)); }
public override void ChangeDataDeleteKey(Menu entity, string sOperator) { //删除用户树菜单 RedisMethod.DeleteUserTreeMenu(); RedisMethod.DeleteUserMenu(); base.ChangeDataDeleteKey(entity, sOperator); }
public async Task SendMessage(string message) { int iUserId = Convert.ToInt32(Context.User.Claims.FirstOrDefault(x => x.Type == "Id")?.Value); string sGroupName = "WebSocket_" + Context.User.Identity.Name + "_" + iUserId; Memo entityUserMemo = await RedisMethod.GetUserMemoAsync(sGroupName, -1, () => GetUserMemo(iUserId)); entityUserMemo.Scontent = message; RedisMethod.SetUserMemo(sGroupName, entityUserMemo, -1); await Clients.Group(sGroupName).SendAsync("ReceiveMessage", message); //await Clients.All.SendAsync("ReceiveMessage", message); }
public string GetRoleList() { List <ViewSelect> lstViewSelect = new List <ViewSelect>(); List <Roles> lstRoles = RedisMethod.GetSystemRoles(-1, () => _rolesService.GetRolesList()); if (lstRoles?.Count > 0) { foreach (Roles entityRoles in lstRoles) { ViewSelect entity = new ViewSelect(); entity.id = entityRoles.Id; entity.name = entityRoles.SroleName; lstViewSelect.Add(entity); } } return(JsonHelper.ObjectToJSON(lstViewSelect)); }
public override void ChangeDataDeleteKey(RoleMenu entity, string sOperator) { List <UserRole> lstUserRole = _userRoleRepository.SelectALL(new UserRole() { IroleId = entity.IroleId }); if (lstUserRole?.Count > 0) { foreach (UserRole entityUserRole in lstUserRole) { UserInfo entityUserInfo = _userInfoRepository.Select(entityUserRole.IuserId); RedisMethod.DeleteUserTreeMenu(entityUserInfo.Id); RedisMethod.DeleteUserMenu(entityUserInfo.Id); } } base.ChangeDataDeleteKey(entity, sOperator); }
public async Task <IActionResult> IndexAsync(int iPageId) { int iUserId = Convert.ToInt32(User.Claims.FirstOrDefault(x => x.Type == "Id")?.Value); //Memo entityMemo = await _memoService.SelectAsync(new Memo() { iUserId = iUserId }); string sGroupName = "WebSocket_" + User.Identity.Name + "_" + iUserId; Memo entityUserMemo = await RedisMethod.GetUserMemoAsync(sGroupName, -1, () => GetUserMemo(iUserId)); if (entityUserMemo == null) { entityUserMemo = new Memo() { iUserId = iUserId }; await _memoService.AppendAsync(entityUserMemo, User.Identity.Name); } ViewBag.Scontent = entityUserMemo.Scontent; return(Empty(iPageId)); }
public async Task <bool> CheckUserMenuPowerAsync(int iUserId, int iMenuId) { UserInfo entityUserInfo = await _userInfoService.SelectAsync(iUserId); Menu entityMenu = await _menuRepository.SelectAsync(iMenuId); if (entityUserInfo != null && entityMenu != null) { List <Menu> lstUserMenu = await RedisMethod.GetUserMenuAsync(entityUserInfo.Id, -1, () => GetRoleMenuListAsync(iUserId)); if (lstUserMenu?.Count > 0) { if (lstUserMenu.Any(x => x.Id == entityMenu.Id)) { return(true); } } } return(false); }
public override void ChangeDataDeleteKey(Roles entity, string sOperator) { RedisMethod.DeleteSystemRoles(); base.ChangeDataDeleteKey(entity, sOperator); }
public override void ChangeDataDeleteKey(UserRole entity, string sOperator) { RedisMethod.DeleteUserTreeMenu(entity.IuserId); RedisMethod.DeleteUserMenu(entity.IuserId); base.ChangeDataDeleteKey(entity, sOperator); }