mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-04-23 14:42:51 +08:00
fix: 🐛 请求日志批量插入,漏写了登录日志 (#210)
Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
parent
4e9f605ea2
commit
6c71c74a27
@ -122,7 +122,6 @@ public sealed class VerifyCodeService(BasicRepository<Sys_VerifyCode, long> rpo,
|
|||||||
QueryVerifyCodeRsp ret;
|
QueryVerifyCodeRsp ret;
|
||||||
|
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
|
|
||||||
// 有发送记录,且小于1分钟,不允许
|
// 有发送记录,且小于1分钟,不允许
|
||||||
if (lastSent != null && (DateTime.Now - lastSent.CreatedTime).TotalMinutes < 1) {
|
if (lastSent != null && (DateTime.Now - lastSent.CreatedTime).TotalMinutes < 1) {
|
||||||
throw new NetAdminInvalidOperationException(Ln._1分钟内只能发送1次);
|
throw new NetAdminInvalidOperationException(Ln._1分钟内只能发送1次);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#if !DEBUG && DBTYPE_SQLSERVER
|
#if !DEBUG && DBTYPE_SQLSERVER
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using NetAdmin.Domain.DbMaps.Sys;
|
using NetAdmin.Domain.DbMaps.Sys;
|
||||||
|
using NetAdmin.Domain.Dto.Sys.LoginLog;
|
||||||
using NetAdmin.Domain.Dto.Sys.RequestLog;
|
using NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||||
using NetAdmin.Domain.Events.Sys;
|
using NetAdmin.Domain.Events.Sys;
|
||||||
|
|
||||||
@ -42,6 +43,11 @@ public sealed class OperationLogger : IEventSubscriber
|
|||||||
}
|
}
|
||||||
|
|
||||||
inserts.Add(log);
|
inserts.Add(log);
|
||||||
|
|
||||||
|
// 插入登录日志
|
||||||
|
if (log.ApiPathCrc32 == Chars.FLG_PATH_API_SYS_USER_LOGIN_BY_PWD.Crc32()) {
|
||||||
|
_ = await App.GetService<ILoginLogCache>().CreateAsync(log.Adapt<CreateLoginLogReq>()).ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果首尾日期不一致,要分别插入不同的日期分表
|
// 如果首尾日期不一致,要分别插入不同的日期分表
|
||||||
@ -81,7 +87,7 @@ public sealed class OperationLogger : IEventSubscriber
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = await App.GetService<IRequestLogService>().CreateAsync(operationEvent.Data).ConfigureAwait(false);
|
_ = await App.GetService<IRequestLogCache>().CreateAsync(operationEvent.Data).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user