前端:
1、完善创建群聊逻辑 后端: 1、完善群聊相关接口
This commit is contained in:
+7
-3
@@ -1,13 +1,17 @@
|
||||
using IM_API.Domain.Events;
|
||||
using IM_API.Hubs;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace IM_API.Application.EventHandlers.GroupRequestHandler
|
||||
{
|
||||
public class GroupRequestSignalRHandler : IConsumer<GroupRequestEvent>
|
||||
public class GroupRequestSignalRHandler(IHubContext<ChatHub> hubContext) : IConsumer<GroupRequestEvent>
|
||||
{
|
||||
Task IConsumer<GroupRequestEvent>.Consume(ConsumeContext<GroupRequestEvent> context)
|
||||
private readonly IHubContext<ChatHub> _hub = hubContext;
|
||||
|
||||
public async Task Consume(ConsumeContext<GroupRequestEvent> context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using IM_API.Domain.Events;
|
||||
using MassTransit;
|
||||
|
||||
namespace IM_API.Application.EventHandlers.GroupRequestHandler
|
||||
{
|
||||
public class NextEventHandler : IConsumer<GroupRequestEvent>
|
||||
{
|
||||
private readonly IPublishEndpoint _endpoint;
|
||||
public NextEventHandler(IPublishEndpoint endpoint)
|
||||
{
|
||||
_endpoint = endpoint;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<GroupRequestEvent> context)
|
||||
{
|
||||
var @event = context.Message;
|
||||
if(@event.Action == Models.GroupRequestState.Passed)
|
||||
{
|
||||
await _endpoint.Publish(new GroupJoinEvent
|
||||
{
|
||||
AggregateId = @event.AggregateId,
|
||||
OccurredAt = @event.OccurredAt,
|
||||
EventId = Guid.NewGuid(),
|
||||
GroupId = @event.GroupId,
|
||||
OperatorId = @event.OperatorId,
|
||||
UserId = @event.UserId
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user