From 8b3dd419b734a40ed8cea5e5a7dce87a95d1d388 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 31 Dec 2024 16:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AD=9B=E9=80=89=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=A7=92=E8=89=B2=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/MailService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index a39684122..7c283a183 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -605,11 +605,17 @@ namespace IRaCIS.Core.Application.Service { sysUserInfo = (await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.DoctorId == doctorId || t.IdentityUser.EMail == doctor.EMail), true).Include(t => t.UserRoleList).FirstOrDefaultAsync()).IfNullThrowException(); + + var findRole = sysUserInfo.UserRoleList.FirstOrDefault(t => t.UserTypeId == userType.Id); //不存在该角色,那么就加入该角色 - if (!sysUserInfo.UserRoleList.Any(t => t.UserTypeId == userType.Id)) + if (findRole == null) { sysUserInfo.UserRoleList.Add(new UserRole() { DoctorId = doctorId, UserTypeEnum = UserTypeEnum.IndependentReviewer, UserTypeId = userType.Id }); } + else + { + findRole.IsUserRoleDisabled = false; + } sysUserInfo.Status = UserStateEnum.Enable;