fix:修复已知问题
This commit is contained in:
+10
-8
@@ -18,15 +18,18 @@ namespace IM_API.Application.EventHandlers.MessageCreatedHandler
|
||||
private readonly IConversationService _conversationService;
|
||||
private readonly ILogger<ConversationEventHandler> _logger;
|
||||
private readonly IUserService _userSerivce;
|
||||
private readonly IGroupService _groupService;
|
||||
public ConversationEventHandler(
|
||||
IConversationService conversationService,
|
||||
ILogger<ConversationEventHandler> logger,
|
||||
IUserService userService
|
||||
IUserService userService,
|
||||
IGroupService groupService
|
||||
)
|
||||
{
|
||||
_conversationService = conversationService;
|
||||
_logger = logger;
|
||||
_userSerivce = userService;
|
||||
_groupService = groupService;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<MessageCreatedEvent> context)
|
||||
@@ -35,14 +38,13 @@ namespace IM_API.Application.EventHandlers.MessageCreatedHandler
|
||||
if (@event.ChatType == ChatType.GROUP)
|
||||
{
|
||||
var userinfo = await _userSerivce.GetUserInfoAsync(@event.MsgSenderId);
|
||||
await _conversationService.UpdateConversationAfterSentAsync(new Dtos.Conversation.UpdateConversationDto
|
||||
await _groupService.UpdateGroupConversationAsync(new Dtos.Group.GroupUpdateConversationDto
|
||||
{
|
||||
LastMessage = $"{userinfo.NickName}:{@event.MessageContent}",
|
||||
LastSequenceId = @event.SequenceId,
|
||||
ReceiptId = @event.MsgRecipientId,
|
||||
SenderId = @event.MsgSenderId,
|
||||
StreamKey = @event.StreamKey,
|
||||
DateTime = @event.MessageCreated
|
||||
GroupId = @event.MsgRecipientId,
|
||||
LastMessage = @event.MessageContent,
|
||||
LastSenderName = userinfo.NickName,
|
||||
LastUpdateTime = @event.MessageCreated,
|
||||
MaxSequenceId = @event.SequenceId
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user