public ActionResult ModuleTreeJson(string roleId) { var existModule = permissionBLL.GetModuleList(roleId); var data = authorizeBLL.GetModuleList(SystemInfo.CurrentUserId); var treeList = new List <TreeEntity>(); foreach (AppModuleEntity item in data) { TreeEntity tree = new TreeEntity(); bool hasChildren = data.Count(t => t.ParentId == item.ModuleId) == 0 ? false : true; tree.id = item.ModuleId; tree.text = item.FullName; tree.value = item.ModuleId; tree.title = ""; tree.checkstate = existModule.Count(t => t.ItemId == item.ModuleId); tree.showcheck = true; tree.isexpand = true; tree.complete = true; tree.hasChildren = hasChildren; tree.parentId = item.ParentId; tree.img = item.Icon; treeList.Add(tree); } return(Content(treeList.TreeToJson())); }
/// <summary> /// 获取用户列表 /// </summary> /// <param name="_"></param> /// <returns></returns> private Negotiator GetUserModuleList(dynamic _) { try { var recdata = this.GetModule <ReceiveModule <AppUserEntity> >(); bool resValidation = this.DataValidation(recdata.userid, recdata.token); if (!resValidation) { return(this.SendData(ResponseType.Fail, "后台无登录信息")); } else { var listModule = new List <dynamic>(); string account = recdata.data.Account; IEnumerable <AppModuleEntity> modules = appAuthorizeBLL.GetModuleList(recdata.userid, recdata.data.DomainName); //int cnt = 0; //using (IEnumerator<AppModuleEntity> enumerator = modules.GetEnumerator()) //{ while (enumerator.MoveNext()) // cnt++; //} //var data= new //{ // modules = modules, // records = cnt, //}; return(this.SendData <IEnumerable <AppModuleEntity> >(modules, recdata.userid, recdata.token, ResponseType.Success)); //var data = userCache.GetListToApp(); //return this.SendData<Dictionary<string, appUserInfoModel>>(data, recdata.userid, recdata.token, ResponseType.Success); } } catch { return(this.SendData(ResponseType.Fail, "异常")); } }
/// <summary> /// 获取用户列表 /// </summary> /// <param name="_"></param> /// <returns></returns> private Negotiator GetMesModuleList(dynamic _) { try { var recdata = this.GetModule <ReceiveModule <AppUserEntity> >(); bool resValidation = this.DataValidation(recdata.userid, recdata.token); if (!resValidation) { return(this.SendData(ResponseType.Fail, "后台无登录信息")); } else { var listModule = new List <dynamic>(); string account = recdata.data.Account; IEnumerable <AppModuleEntity> modules = appAuthorizeBLL.GetModuleList(recdata.userid, recdata.data.DomainName); return(this.SendData <IEnumerable <AppModuleEntity> >(modules, recdata.userid, recdata.token, ResponseType.Success)); } } catch { return(this.SendData(ResponseType.Fail, "异常")); } }