From 9386b891103098043678871e77d690f50d843f91 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 11 Sep 2025 17:46:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=87=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/UserService.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 212734782..1467aafd4 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -491,7 +491,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.OA, t => !t.UserRoleList.Any(t => t.UserTypeEnum == UserTypeEnum.Admin || t.UserTypeEnum == UserTypeEnum.SuperAdmin)) //GA 只能看有该课题组的用户,并且不是admin oa - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.GA, + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.GA, t => /*!t.UserRoleList.Any(t => t.UserTypeEnum == UserTypeEnum.Admin || t.UserTypeEnum == UserTypeEnum.SuperAdmin || t.UserTypeEnum == UserTypeEnum.OA) &&*/ t.IdentityUserHospitalGroupList.Any(t => isGAGroupAdmin ? hospitalGroupAdminIdList.Contains(t.HospitalGroupId) : false)) @@ -1044,9 +1044,14 @@ namespace IRaCIS.Core.Application.Service { await _fusionCache.RemoveAsync(CacheKeys.UserToken(identityUserId)); - var userName = await _userRoleRepository.Where(t => t.Id == userRoleId).Select(t => t.UserName).FirstOrDefaultAsync(); + var userName = await _identityUserRepository.Where(t => t.Id == identityUserId).Select(t => t.UserName).FirstOrDefaultAsync(); + + if (userName.IsNotNullOrEmpty()) + { + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = userName, OptType = UserOptType.LoginOut }, true); + + } - await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = userName, OptType = UserOptType.LoginOut }, true); return ResponseOutput.Ok(); }