public ApiResult <GroupUserInfoResponse> GroupUserInfo(GroupUserInfoRequest request) { var response = new GroupUserInfoResponse(); if (request == null) { return(Error <GroupUserInfoResponse>("1", "参数无能为空")); } var usergroup = _userGroupService.FindUserGroup(request.ImUserId.ToGuid(), request.GroupId.ToGuid()); if (usergroup == null) { return(Error <GroupUserInfoResponse>("2", "用户组不存在")); } var userinfo = _imUserInfoService.Find(request.ImUserId.ToGuid()); if (userinfo == null) { return(Error <GroupUserInfoResponse>("3", "用户信息不存在")); } response.ImUserId = userinfo.ImUserId; response.GroupId = usergroup.GroupId; response.NickName = usergroup.NickName; response.UserGroupId = usergroup.UserGroupId; response.RoleType = usergroup.RoleType; response.UserHeadimg = userinfo.UserHeadimg; return(Success(response)); }
/// <summary> /// 检查用户信息 /// </summary> /// <param name="imuserid"></param> /// <returns></returns> private bool CheckUserInfo(string imuserid) { //非空校验 if (imuserid.IsNullOrEmpty()) { System.Web.HttpContext.Current.AcceptWebSocketRequest((e) => { CancellationToken cancellationToken = new CancellationToken(); var data = new { status = 0, msg = "用户无效", buginfo = "用户无效" }.ToJson(); return(e.WebSocket.SendMessage(cancellationToken, data)); }); System.Web.HttpContext.Current.Response.End(); return(false); } //查询用户信息校验 var userinfo = _imUserInfoService.Find(imuserid.ToGuid()); if (userinfo == null) { System.Web.HttpContext.Current.AcceptWebSocketRequest((e) => { CancellationToken cancellationToken = new CancellationToken(); var data = new { status = 0, msg = "用户不存在", buginfo = "用户不存在" }.ToJson(); return(e.WebSocket.SendMessage(cancellationToken, data)); }); System.Web.HttpContext.Current.Response.End(); return(false); } //用户删除状态 if (userinfo.IsValid == 0) { System.Web.HttpContext.Current.AcceptWebSocketRequest((e) => { CancellationToken cancellationToken = new CancellationToken(); var data = new { status = 0, msg = "用户已被移除,请联系闲僧", buginfo = "非法用户" }.ToJson(); return(e.WebSocket.SendMessage(cancellationToken, data)); }); System.Web.HttpContext.Current.Response.End(); return(false); } return(true); }
public ApiResult <InfoResponse> Info(InfoRequest request) { var response = new InfoResponse(); var entity = _imUserInfoService.Find(request.ImUserId.ToGuid()); if (entity == null) { return(Error <InfoResponse>("1", "用户不存在")); } response.ImUserId = entity.ImUserId; response.ImUserName = entity.ImUserName; response.UserHeadimg = entity.UserHeadimg; response.Gender = entity.Gender; response.UserId = entity.UserId; response.UserType = entity.UserType; response.Remark = entity.Remark; return(Success(response)); }