修改切换角色 统一密码,checkCode 首次登录标志
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-04-21 13:37:56 +08:00
parent e6310a4533
commit 0b958f21a5
3 changed files with 57 additions and 5 deletions

View File

@ -2285,6 +2285,15 @@
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
<member name="M:IRaCIS.Core.Application.Service.UserService.TJUserLoginInfo(System.String,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserType},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.HIRHospital})">
<summary>
同济生成账号
</summary>
<param name="token"></param>
<param name="_userTypeRepository"></param>
<param name="_hirHospitalRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.UserService.Login(System.String,System.String)">
<summary>
用户登陆

View File

@ -363,7 +363,7 @@ namespace IRaCIS.Core.Application.Service
await VerifyUserPwdAsync(userId, newPwd);
var success = await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User()
await _userRepository.UpdatePartialFromQueryAsync(t => t.Id == userId, u => new User()
{
Password = newPwd,
IsFirstAdd = false
@ -371,7 +371,7 @@ namespace IRaCIS.Core.Application.Service
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, LoginPassword = newPwd, OptType = UserOptType.UnloginModifyPasswoed }, true);
return ResponseOutput.Result(success);
return ResponseOutput.Ok();
}
@ -636,7 +636,13 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok();
}
/// <summary>
/// 同济生成账号
/// </summary>
/// <param name="token"></param>
/// <param name="_userTypeRepository"></param>
/// <param name="_hirHospitalRepository"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpGet]
public async Task<IResponseOutput> TJUserLoginInfo(string token,
@ -1034,7 +1040,7 @@ namespace IRaCIS.Core.Application.Service
}
var success = await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == _userInfo.Id, u => new User()
await _userRepository.UpdatePartialFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
{
Password = editPwModel.NewPassWord,
CheckCode = editPwModel.CheckCode,
@ -1043,7 +1049,7 @@ namespace IRaCIS.Core.Application.Service
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.LoginModifyPassword }, true);
return ResponseOutput.Result(success);
return ResponseOutput.Ok();

View File

@ -41,4 +41,41 @@ namespace IRaCIS.Core.Application.Triggers
}
}
public class UserModifyTrigger(IUserInfo _userInfo, IRepository<User> _userReposiotry) : IBeforeSaveTrigger<User>
{
public async Task BeforeSave(ITriggerContext<User> context, CancellationToken cancellationToken)
{
var user = context.Entity;
var beforeUser = context.UnmodifiedEntity;
if (context.ChangeType == ChangeType.Modified)
{
if (beforeUser.IsFirstAdd == false && user.IsFirstAdd == true)
{
await _userReposiotry.BatchUpdateNoTrackingAsync(t => t.EMail == user.EMail, u => new User() { IsFirstAdd = true });
}
if (beforeUser.Password != user.Password)
{
await _userReposiotry.BatchUpdateNoTrackingAsync(t => t.EMail == user.EMail, u => new User() { Password = user.Password });
}
if (beforeUser.EMail != user.EMail)
{
await _userReposiotry.BatchUpdateNoTrackingAsync(t => t.EMail == user.EMail, u => new User() { EMail = user.EMail });
}
if (beforeUser.CheckCode != user.CheckCode)
{
await _userReposiotry.BatchUpdateNoTrackingAsync(t => t.EMail == user.EMail, u => new User() { CheckCode = user.CheckCode });
}
}
}
}
}