public ActionResult GetUserListJson(string postId) { var existMember = permissionBLL.GetMemberList(postId); var userData = userBLL.GetDepartmentUserList(); List <DepartmentUserModel> userList = new List <DepartmentUserModel>(); foreach (UserEntity userItem in userData) { DepartmentUserModel model = new DepartmentUserModel(); int ischeck = existMember.Count(t => t.UserId == userItem.UserId); model.ischeck = ischeck; if (ischeck > 0) { model.isdefault = existMember.First(t => t.UserId == userItem.UserId).IsDefault; } else { model.isdefault = 0; } model.gender = userItem.Gender; model.departmentid = userItem.DepartmentId; model.departmentname = departmentCache.GetEntity(model.departmentid) != null?departmentCache.GetEntity(model.departmentid).FullName : ""; model.realname = userItem.RealName; model.account = userItem.Account; model.userid = userItem.UserId; userList.Add(model); } return(Content(userList.ToJson())); }
//登录 private Negotiator CheckLogin(dynamic _) { var recdata = this.GetModule <ReceiveModule <loginData> >(); LogEntity logEntity = new LogEntity(); logEntity.F_CategoryId = 1; logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString(); logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Login); logEntity.F_OperateAccount = recdata.data.username; logEntity.F_OperateUserId = recdata.data.username; logEntity.F_Module = "LeaRun.敏捷开发框架"; try { Operator operators = new Operator(); loginUserInfo result = new loginUserInfo(); #region 内部登录 { //写入当前用户信息 UserEntity userEntity = new UserBLL().CheckLogin(recdata.data.username, recdata.data.password); if (userEntity != null) { AuthorizeBLL authorizeBLL = new AuthorizeBLL(); operators.UserId = userEntity.F_UserId; operators.Code = userEntity.F_EnCode; operators.Account = userEntity.F_Account; operators.UserName = userEntity.F_RealName; operators.Password = userEntity.F_Password; operators.Secretkey = userEntity.F_Secretkey; operators.CompanyId = userEntity.F_OrganizeId; operators.DepartmentId = userEntity.F_DepartmentId; operators.IPAddress = Net.Ip; operators.ObjectId = new PermissionBLL().GetObjectStr(userEntity.F_UserId); operators.LogTime = DateTime.Now; operators.Token = DESEncrypt.Encrypt(Guid.NewGuid().ToString()); if (userEntity.F_Account == "System") { operators.IsSystem = true; } else { operators.IsSystem = false; } //写入当前用户数据权限 AuthorizeDataModel dataAuthorize = new AuthorizeDataModel(); dataAuthorize.ReadAutorize = authorizeBLL.GetDataAuthor(operators); dataAuthorize.ReadAutorizeUserId = authorizeBLL.GetDataAuthorUserId(operators); dataAuthorize.WriteAutorize = authorizeBLL.GetDataAuthor(operators, true); dataAuthorize.WriteAutorizeUserId = authorizeBLL.GetDataAuthorUserId(operators, true); result.userid = userEntity.F_UserId; result.account = userEntity.F_Account; result.password = userEntity.F_Password; result.realname = userEntity.F_RealName; result.headicon = ""; result.gender = (userEntity.F_Gender == 1 ? "男" : "女"); result.mobile = userEntity.F_Mobile; result.telephone = userEntity.F_Telephone; result.email = userEntity.F_Email; result.oicq = userEntity.F_OICQ; result.wechat = userEntity.F_WeChat; result.msn = userEntity.F_MSN; result.managerid = userEntity.F_ManagerId; result.manager = userEntity.F_Manager; result.organizeid = userEntity.F_OrganizeId; result.organizename = organizeCache.GetEntity(result.organizeid).F_FullName; result.departmentid = userEntity.F_DepartmentId; result.departmentname = departmentCache.GetEntity(userEntity.F_DepartmentId).F_FullName; result.roleid = userEntity.F_RoleId; result.rolename = roleCache.GetEntity(userEntity.F_RoleId).F_FullName; result.dutyid = userEntity.F_DutyId; result.dutyname = userEntity.F_DutyName; result.postid = userEntity.F_PostId; result.postname = userEntity.F_PostName; result.description = userEntity.F_Description; } } #endregion //移动端不采用cookie的方式 this.WriteCache <Operator>(operators, operators.UserId); //写入日志 logEntity.F_ExecuteResult = 1; logEntity.F_ExecuteResultJson = "登录成功"; logEntity.WriteLog(); return(this.SendData <loginUserInfo>(result, result.userid, operators.Token, ResponseType.Success)); } catch (Exception ex) { logEntity.F_ExecuteResult = -1; logEntity.F_ExecuteResultJson = ex.Message; logEntity.WriteLog(); return(this.SendData(ResponseType.Fail, ex.Message)); } }