|
@@ -22,32 +22,39 @@ namespace GxPress.Service.Implement.OftenContact
|
|
|
//获取文件夹数据
|
|
|
var result = new List<OftenContactInfo>();
|
|
|
var data = await _repository.GetContactInfosAsync(request);
|
|
|
- foreach (var oftenContact in data)
|
|
|
+
|
|
|
+ for (int i = 0; i < data.Count; i++)
|
|
|
{
|
|
|
- if (oftenContact.ChatType == 1)
|
|
|
+ if (data[i].ChatType == 1)
|
|
|
{
|
|
|
- var user = await _userRepository.GetAsync(int.Parse(oftenContact.ContactUserId));
|
|
|
+ var user = await _userRepository.GetAsync(int.Parse(data[i].ContactUserId));
|
|
|
if (user == null)
|
|
|
+ {
|
|
|
+ data.Remove(data[i]);
|
|
|
continue;
|
|
|
- oftenContact.Name = user.Name;
|
|
|
- oftenContact.AvatarUrl = StringUtils.AddDomainMin(user.AvatarUrl);
|
|
|
- oftenContact.ImId = user.ImId;
|
|
|
- oftenContact.ToUserId = user.Id;
|
|
|
+ }
|
|
|
+ data[i].Name = user.Name;
|
|
|
+ data[i].AvatarUrl = StringUtils.AddDomainMin(user.AvatarUrl);
|
|
|
+ data[i].ImId = user.ImId;
|
|
|
+ data[i].ToUserId = user.Id;
|
|
|
}
|
|
|
|
|
|
- if (oftenContact.ChatType == 2)
|
|
|
+ if (data[i].ChatType == 2)
|
|
|
{
|
|
|
var groupChat = await _groupChatRepository.GetAsync(Q.Where(nameof(Entity.GroupChat.GroupChatImId),
|
|
|
- oftenContact.ContactUserId));
|
|
|
+ data[i].ContactUserId));
|
|
|
if (groupChat == null)
|
|
|
+ {
|
|
|
+ data.Remove(data[i]);
|
|
|
continue;
|
|
|
- oftenContact.Name = groupChat.Name;
|
|
|
- oftenContact.AvatarUrl = StringUtils.AddDomainMin(groupChat.AvatarUrl);
|
|
|
- oftenContact.ImId = groupChat.GroupChatImId;
|
|
|
+ }
|
|
|
+ data[i].Name = groupChat.Name;
|
|
|
+ data[i].AvatarUrl = StringUtils.AddDomainMin(groupChat.AvatarUrl);
|
|
|
+ data[i].ImId = groupChat.GroupChatImId;
|
|
|
var groupChatUserIsDisturbRequest = new GroupChatUserIsDisturbRequest();
|
|
|
groupChatUserIsDisturbRequest.GroupChatId = groupChat.Id;
|
|
|
- groupChatUserIsDisturbRequest.UserId = oftenContact.UserId;
|
|
|
- oftenContact.IsDisturb = await groupChatUserRepository.IsDisturbAsync(groupChatUserIsDisturbRequest);
|
|
|
+ groupChatUserIsDisturbRequest.UserId = data[i].UserId;
|
|
|
+ data[i].IsDisturb = await groupChatUserRepository.IsDisturbAsync(groupChatUserIsDisturbRequest);
|
|
|
}
|
|
|
}
|
|
|
result = data.ToList();
|