You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
966 B
30 lines
966 B
namespace Admin.NET.Core;
|
|
|
|
/// <summary>
|
|
/// 事件订阅
|
|
/// </summary>
|
|
public class AppEventSubscriber : IEventSubscriber, ISingleton
|
|
{
|
|
private readonly IServiceProvider _serviceProvider;
|
|
|
|
public AppEventSubscriber(IServiceProvider serviceProvider)
|
|
{
|
|
_serviceProvider = serviceProvider;
|
|
}
|
|
|
|
///// <summary>
|
|
///// 增加异常日志
|
|
///// </summary>
|
|
///// <param name="context"></param>
|
|
///// <returns></returns>
|
|
//[EventSubscribe("Add:ExLog")]
|
|
//public async Task CreateExLog(EventHandlerExecutingContext context)
|
|
//{
|
|
// using var scope = _serviceProvider.CreateScope();
|
|
// var _rep = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<SysLogEx>>();
|
|
// await _rep.InsertAsync((SysLogEx)context.Source.Payload);
|
|
|
|
// // 发送邮件
|
|
// await scope.ServiceProvider.GetRequiredService<SysMessageService>().SendEmail(JSON.Serialize(context.Source.Payload));
|
|
//}
|
|
}
|