修改异地登录ip逻辑

Uat_IRC_Net8
hang 2025-03-25 17:49:13 +08:00
parent 87caf24dd1
commit 2f3f639918
1 changed files with 9 additions and 7 deletions

View File

@ -970,19 +970,21 @@ namespace IRaCIS.Core.Application.Service
if (existUserLoginInfo.LastLoginIP != string.Empty) if (existUserLoginInfo.LastLoginIP != string.Empty)
{ {
//设置上次登录的IP
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == existUserLoginInfo.Id, x => new IdentityUser()
{
LastLoginIP = iPRegion,
LastLoginTime = DateTime.Now
});
// 与上一次区域不一致 // 与上一次区域不一致
if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion)) if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion))
{ {
isLoginUncommonly = true; isLoginUncommonly = true;
//设置上次登录的IP
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == existUserLoginInfo.Id, x => new IdentityUser()
{
LastLoginIP = iPRegion,
LastLoginTime = DateTime.Now
});
if (loginUser != null) if (loginUser != null)
{ {