diff --git a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/VerifyCodeService.cs b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/VerifyCodeService.cs index ff46ec08..30a2463a 100644 --- a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/VerifyCodeService.cs +++ b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/VerifyCodeService.cs @@ -122,7 +122,6 @@ public sealed class VerifyCodeService(BasicRepository rpo, QueryVerifyCodeRsp ret; #if !DEBUG - // 有发送记录,且小于1分钟,不允许 if (lastSent != null && (DateTime.Now - lastSent.CreatedTime).TotalMinutes < 1) { throw new NetAdminInvalidOperationException(Ln._1分钟内只能发送1次); diff --git a/src/backend/NetAdmin/NetAdmin.SysComponent.Cache/Sys/RequestLogCache.cs b/src/backend/NetAdmin/NetAdmin.SysComponent.Cache/Sys/RequestLogCache.cs index 272da9a4..3ed1dc15 100644 --- a/src/backend/NetAdmin/NetAdmin.SysComponent.Cache/Sys/RequestLogCache.cs +++ b/src/backend/NetAdmin/NetAdmin.SysComponent.Cache/Sys/RequestLogCache.cs @@ -16,9 +16,9 @@ public sealed class RequestLogCache(IDistributedCache cache, IRequestLogService /// #if !DEBUG public async Task CountAsync(QueryReq req) - #else + #else public Task CountAsync(QueryReq req) - #endif + #endif { #if !DEBUG var ret = await GetOrCreateAsync( // diff --git a/src/backend/NetAdmin/NetAdmin.SysComponent.Host/Subscribers/OperationLogger.cs b/src/backend/NetAdmin/NetAdmin.SysComponent.Host/Subscribers/OperationLogger.cs index f874b006..dfa77072 100644 --- a/src/backend/NetAdmin/NetAdmin.SysComponent.Host/Subscribers/OperationLogger.cs +++ b/src/backend/NetAdmin/NetAdmin.SysComponent.Host/Subscribers/OperationLogger.cs @@ -1,6 +1,7 @@ #if !DEBUG && DBTYPE_SQLSERVER using System.Collections.Concurrent; using NetAdmin.Domain.DbMaps.Sys; +using NetAdmin.Domain.Dto.Sys.LoginLog; using NetAdmin.Domain.Dto.Sys.RequestLog; using NetAdmin.Domain.Events.Sys; @@ -42,6 +43,11 @@ public sealed class OperationLogger : IEventSubscriber } inserts.Add(log); + + // 插入登录日志 + if (log.ApiPathCrc32 == Chars.FLG_PATH_API_SYS_USER_LOGIN_BY_PWD.Crc32()) { + _ = await App.GetService().CreateAsync(log.Adapt()).ConfigureAwait(false); + } } // 如果首尾日期不一致,要分别插入不同的日期分表 @@ -81,7 +87,7 @@ public sealed class OperationLogger : IEventSubscriber return; } - _ = await App.GetService().CreateAsync(operationEvent.Data).ConfigureAwait(false); + _ = await App.GetService().CreateAsync(operationEvent.Data).ConfigureAwait(false); } } #endif \ No newline at end of file