后端:

新增好友请求事件和好友已添加事件
This commit is contained in:
2026-02-01 13:21:21 +08:00
committed by nanxun
40 changed files with 550 additions and 194 deletions
@@ -1,13 +1,26 @@
using IM_API.Domain.Events;
using IM_API.Interface.Services;
using MassTransit;
namespace IM_API.Application.EventHandlers.FriendAddHandler
{
public class FriendAddConversationHandler : IConsumer<FriendAddEvent>
{
public Task Consume(ConsumeContext<FriendAddEvent> context)
private readonly IFriendSerivce _friendService;
public FriendAddConversationHandler(IFriendSerivce friendService)
{
throw new NotImplementedException();
_friendService = friendService;
}
public async Task Consume(ConsumeContext<FriendAddEvent> context)
{
var @event = context.Message;
//为请求发起人添加好友记录
await _friendService.MakeFriendshipAsync(
@event.RequestUserId, @event.ResponseUserId, @event.RequestInfo.RemarkName);
//为接收人添加好友记录
await _friendService.MakeFriendshipAsync(
@event.ResponseUserId, @event.RequestUserId, @event.requestUserRemarkname);
}
}
}