From 2f3f6399186dbd1366f9ced03c392768a0af5c7e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 25 Mar 2025 17:49:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E5=9C=B0=E7=99=BB?= =?UTF-8?q?=E5=BD=95ip=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/UserService.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 905d6ee26..7f9958d86 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -970,19 +970,21 @@ namespace IRaCIS.Core.Application.Service 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)) { isLoginUncommonly = true; - //设置上次登录的IP - await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == existUserLoginInfo.Id, x => new IdentityUser() - { - LastLoginIP = iPRegion, - LastLoginTime = DateTime.Now - - }); if (loginUser != null) {