修改
continuous-integration/drone/push Build is running Details

Temp_Event_IRC_Met8
he 2025-04-21 14:15:21 +08:00
parent a14df73879
commit afd34c7c9b
1 changed files with 12 additions and 2 deletions

View File

@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Mvc;
using UserRole = IRaCIS.Core.Domain.Models.UserRole;
using IRaCIS.Core.Application.MassTransit.Consumer;
using MassTransit.Mediator;
using Microsoft.Extensions.DependencyInjection;
namespace IRaCIS.Core.Application.Services
{
@ -23,6 +24,7 @@ namespace IRaCIS.Core.Application.Services
IScopedMediator _mediatorScoped,
IRepository<SystemDocumentAttachment> _systemDocumentAttachmentRepository,
IRepository<IdentityUser> _identityUserRepository,
IServiceScopeFactory serviceScopeFactory,
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemDocumentService
{
@ -175,10 +177,18 @@ namespace IRaCIS.Core.Application.Services
});
Task.Run(async () =>
{
// 创建独立作用域
using (var scope = serviceScopeFactory.CreateScope())
{
// 从新作用域解析服务
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
await mediator.Publish(new SystemDocumentPublishEvent { Ids = inDto.Ids });
}
});
_mediatorScoped.Publish(new SystemDocumentPublishEvent() { Ids = inDto.Ids });
return ResponseOutput.Result(true);
}