v3.4.6
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using JNPF.Common.Configuration;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.EventBus;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.EventHandler;
|
||||
@@ -15,12 +16,20 @@ public class UserEventSubscriber : IEventSubscriber, ISingleton
|
||||
/// </summary>
|
||||
private static SqlSugarScope? _sqlSugarClient;
|
||||
|
||||
/// <summary>
|
||||
/// 用户服务.
|
||||
/// </summary>
|
||||
private readonly IUsersService _usersService;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数.
|
||||
/// </summary>
|
||||
public UserEventSubscriber(ISqlSugarClient context)
|
||||
public UserEventSubscriber(
|
||||
ISqlSugarClient context,
|
||||
IUsersService usersService)
|
||||
{
|
||||
_sqlSugarClient = (SqlSugarScope)context;
|
||||
_usersService = usersService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,7 +48,7 @@ public class UserEventSubscriber : IEventSubscriber, ISingleton
|
||||
_sqlSugarClient.ChangeDatabase(log.ConnectionConfig.ConfigId);
|
||||
}
|
||||
|
||||
await _sqlSugarClient.Updateable(log.Entity).UpdateColumns(m => new { m.FirstLogIP, m.FirstLogTime, m.PrevLogTime, m.PrevLogIP, m.LastLogTime, m.LastLogIP, m.LogSuccessCount }).ExecuteCommandAsync();
|
||||
await _sqlSugarClient.CopyNew().Updateable(log.Entity).UpdateColumns(m => new { m.FirstLogIP, m.FirstLogTime, m.PrevLogTime, m.PrevLogIP, m.LastLogTime, m.LastLogIP, m.LogSuccessCount }).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,9 +56,10 @@ public class UserEventSubscriber : IEventSubscriber, ISingleton
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
[EventSubscribe("User:maxkey_identity")]
|
||||
[EventSubscribe("User:Maxkey_Identity")]
|
||||
public async Task ReceiveUserInfo(EventHandlerExecutingContext context)
|
||||
{
|
||||
var log = (UserEventSource)context.Source;
|
||||
var log = context.Source.Payload;
|
||||
await _usersService.Receive(log.ToString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user