前端:
1、更新界面图标 2、修改消息缓存逻辑 3、新增清空未读消息数 后端: 1、修复不同时区导致的时间显示问题 2、新增清空未读消息数接口
This commit is contained in:
@@ -118,5 +118,21 @@ namespace IM_API.Services
|
||||
return dto;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public async Task<bool> ClearUnreadCountAsync(int userId, int conversationId)
|
||||
{
|
||||
var conversation = await _context.Conversations.FirstOrDefaultAsync(x => x.UserId == userId && x.Id == conversationId);
|
||||
if (conversation is null) throw new BaseException(CodeDefine.CONVERSATION_NOT_FOUND);
|
||||
var message = await _context.Messages
|
||||
.Where(x => x.StreamKey == conversation.StreamKey)
|
||||
.OrderByDescending(x => x.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
conversation.LastReadMessage = message;
|
||||
conversation.UnreadCount = 0;
|
||||
_context.Conversations.Update(conversation);
|
||||
await _context.SaveChangesAsync();
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user