|
@@ -549,31 +549,67 @@ namespace GxPress.Service.Implement
|
|
|
/// <param name="id"></param>
|
|
|
/// <param name="keyword"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<IEnumerable<UserInfoResult>> GetGroupOrGroupChatUserInfosResult(int typeValue, int id, string keyword)
|
|
|
+ public async Task<IEnumerable<UserInfoResult>> GetGroupOrGroupChatUserInfosResult(UserInfoByGroupoRoGroupChatResult request)
|
|
|
{
|
|
|
+ if (request.Id == 0)
|
|
|
+ return await GetAllGroupOrGroupChatUserInfosResult(request);
|
|
|
//群聊
|
|
|
- if (typeValue == 1)
|
|
|
+ if (request.TypeValue == 1)
|
|
|
{
|
|
|
- var groupChatUsers = await groupChatUserRepository.GetAllAsync(Q.Where(nameof(Entity.GroupChatUser.GroupChatId), id));
|
|
|
- var result = await _userRepository.GetSearchUserInfoResults(keyword, groupChatUsers.Select(n => n.UserId));
|
|
|
+ var groupChatUsers = await groupChatUserRepository.GetAllAsync(Q.Where(nameof(Entity.GroupChatUser.GroupChatId), request.Id));
|
|
|
+ var result = await _userRepository.GetSearchUserInfoResults(request.Keyword, groupChatUsers.Select(n => n.UserId));
|
|
|
return result;
|
|
|
}
|
|
|
//小组
|
|
|
- if (typeValue == 2)
|
|
|
+ if (request.TypeValue == 2)
|
|
|
{
|
|
|
- var groupUsers = await groupUserRepository.GetAllAsync(Q.Where(nameof(Entity.GroupUser.GroupId), id));
|
|
|
- var result = await _userRepository.GetSearchUserInfoResults(keyword, groupUsers.Select(n => n.UserId));
|
|
|
+ var groupUsers = await groupUserRepository.GetAllAsync(Q.Where(nameof(Entity.GroupUser.GroupId), request.Id));
|
|
|
+ var result = await _userRepository.GetSearchUserInfoResults(request.Keyword, groupUsers.Select(n => n.UserId));
|
|
|
return result;
|
|
|
}
|
|
|
//自建小组
|
|
|
- if (typeValue == 3)
|
|
|
+ if (request.TypeValue == 3)
|
|
|
{
|
|
|
- var addressGroupUsers = await addressBookGroupUserRepository.GetAllAsync(Q.Where(nameof(Entity.AddressBookGroupUser.AddressBookGroupId), id));
|
|
|
- var result = await _userRepository.GetSearchUserInfoResults(keyword, addressGroupUsers.Select(n => n.UserId));
|
|
|
+ var addressGroupUsers = await addressBookGroupUserRepository.GetAllAsync(Q.Where(nameof(Entity.AddressBookGroupUser.AddressBookGroupId), request.Id));
|
|
|
+ var result = await _userRepository.GetSearchUserInfoResults(request.Keyword, addressGroupUsers.Select(n => n.UserId));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取群聊和小组的用户
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="typeValue"></param>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <param name="keyword"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<IEnumerable<UserInfoResult>> GetAllGroupOrGroupChatUserInfosResult(UserInfoByGroupoRoGroupChatResult request)
|
|
|
+ {
|
|
|
+ //群聊
|
|
|
+ if (request.TypeValue == 1)
|
|
|
+ {
|
|
|
+ var groupIds = await groupChatUserRepository.GetAllAsync(Q.Where(nameof(Entity.GroupChatUser.UserId), request.UserId));
|
|
|
+ var groupChatUsers = await groupChatUserRepository.GetAllAsync(Q.WhereIn(nameof(Entity.GroupChatUser.GroupChatId), groupIds.Select(n => n.GroupChatId)));
|
|
|
+ var result = await _userRepository.GetSearchUserInfoResults(request.Keyword, groupChatUsers.Select(n => n.UserId));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ //小组
|
|
|
+ if (request.TypeValue == 2)
|
|
|
+ {
|
|
|
+ var groupIds = await groupUserRepository.GetAllAsync(Q.Where(nameof(Entity.GroupUser.UserId), request.UserId));
|
|
|
+ var groupUsers = await groupUserRepository.GetAllAsync(Q.WhereIn(nameof(Entity.GroupUser.GroupId), groupIds.Select(n => n.GroupId)));
|
|
|
+ var result = await _userRepository.GetSearchUserInfoResults(request.Keyword, groupUsers.Select(n => n.UserId));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ //自建小组
|
|
|
+ if (request.TypeValue == 3)
|
|
|
+ {
|
|
|
+ var addressBookGroupIds = await addressBookGroupUserRepository.GetAllAsync(Q.Where(nameof(Entity.AddressBookGroupUser.UserId), request.UserId));
|
|
|
+ var addressGroupUsers = await addressBookGroupUserRepository.GetAllAsync(Q.WhereIn(nameof(Entity.AddressBookGroupUser.AddressBookGroupId), addressBookGroupIds.Select(n => n.AddressBookGroupId)));
|
|
|
+ var result = await _userRepository.GetSearchUserInfoResults(request.Keyword, addressGroupUsers.Select(n => n.UserId));
|
|
|
return result;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|