init commit
This commit is contained in:
54
20220330_Vote/Ewide.Core/EventHandlers/LogEventHandler.cs
Normal file
54
20220330_Vote/Ewide.Core/EventHandlers/LogEventHandler.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Furion;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.EventBus;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.EventHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志订阅处理
|
||||
/// </summary>
|
||||
public class LogEventHandler : IEventSubscriber
|
||||
{
|
||||
private readonly ILogger<LogEventHandler> _logger;
|
||||
//private readonly IRepository<SysLogOp> _sysLogOpRep;
|
||||
////private readonly IRepository<SysLogEx> _sysLogExRep;
|
||||
//private readonly IRepository<SysLogVis> _sysLogVisRep;
|
||||
//public LogEventHandler(IRepository<SysLogVis> sysLogVisRep, IRepository<SysLogOp> sysLogOpRep)
|
||||
public LogEventHandler(ILogger<LogEventHandler> logger)
|
||||
{
|
||||
//_sysLogVisRep = sysLogVisRep;
|
||||
//_sysLogOpRep = sysLogOpRep;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
[EventSubscribe("Log:CreateOpLog")]
|
||||
public async Task CreateOpLog(EventHandlerExecutingContext eventMessage)
|
||||
{
|
||||
SysLogOp log = (SysLogOp)eventMessage.Source.Payload;
|
||||
await App.GetService<IRepository<SysLogOp>>().InsertNowAsync(log);
|
||||
}
|
||||
|
||||
//[EventMessage]
|
||||
//public void CreateExLog(EventMessage eventMessage)
|
||||
//{
|
||||
// SysLogEx log = (SysLogEx)eventMessage.Payload;
|
||||
// _sysLogExRep.InsertNow(log);
|
||||
//}
|
||||
|
||||
[EventSubscribe("Log:CreateVisLog")]
|
||||
public async Task CreateVisLog(EventHandlerExecutingContext eventMessage)
|
||||
{
|
||||
SysLogVis log = (SysLogVis)eventMessage.Source.Payload;
|
||||
await App.GetService<IRepository<SysLogVis>>().InsertNowAsync(log);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user