整理trigger 到不同的文件夹
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
using AutoMapper;
|
||||
using IP2Region.Net.Abstractions;
|
||||
using IRaCIS.Core.Domain;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using MassTransit;
|
||||
|
||||
namespace IRaCIS.Core.Application.MassTransit.Consumer;
|
||||
|
||||
|
||||
//国家|区域|省份|城市|ISP 缺省的地域信息默认是0
|
||||
//0|0|0|内网IP|内网IP
|
||||
// 中国|0|湖北省|武汉市|电信
|
||||
public class AddUserLogTriggerConsumer(ISearcher _searcher) : IConsumer<AddUserLogTriggerCommand>
|
||||
{
|
||||
public async Task Consume(ConsumeContext<AddUserLogTriggerCommand> context)
|
||||
{
|
||||
var userLog = context.Message.UserLog;
|
||||
|
||||
var ipinfo = _searcher.Search(userLog.IP);
|
||||
|
||||
userLog.IPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3));
|
||||
|
||||
}
|
||||
}
|
||||
+8
@@ -6,6 +6,13 @@ using MassTransit;
|
||||
|
||||
namespace IRaCIS.Core.Application.MassTransit.Consumer;
|
||||
|
||||
/// <summary>
|
||||
/// 添加Subject 触发添加访视 不能代替 Trigger,稽查BatchId 不一致 暂时废弃
|
||||
/// </summary>
|
||||
/// <param name="_subjectVisitRepository"></param>
|
||||
/// <param name="_visitStageRepository"></param>
|
||||
/// <param name="_trialRepository"></param>
|
||||
/// <param name="_mapper"></param>
|
||||
public class AddSubjectTriggerConsumer(IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
|
||||
IRepository<VisitStage> _visitStageRepository,
|
||||
@@ -34,5 +41,6 @@ public class AddSubjectTriggerConsumer(IRepository<SubjectVisit> _subjectVisitRe
|
||||
});
|
||||
|
||||
await _subjectVisitRepository.AddRangeAsync(svList);
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user