This commit is contained in:
huzhiyun 2026-01-26 16:33:28 +08:00
parent e4429ff428
commit a8bc53f3b1
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@ namespace LearningOfficer.OA.Core.ServicesInterfaces
{
public interface IUserService : IBaseService<User>
{
public Task<bool> ResetStudentPwd(long userId);
public Task<bool> ResetStudentPwd(long userId, string pwd);
public Task<List<StudentResult>> GetStudentResults(long ClassesId, int IsBackOutStudent);
}
}

View File

@ -97,12 +97,13 @@ namespace LearningOfficer.OA.Mobile.Api.Controllers.V1
/// 重置学生密码为123456
/// </summary>
/// <param name="userId">学生id</param>
/// <param name="pwd"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<bool> ResetStudentPwd(long userId)
public async Task<bool> ResetStudentPwd(long userId, string pwd)
{
return await _userService.ResetStudentPwd(userId);
return await _userService.ResetStudentPwd(userId, pwd);
}
}
}

View File

@ -78,14 +78,14 @@ namespace LearningOfficer.OA.Services
}).ToListAsync();
return result;
}
public async Task<bool> ResetStudentPwd(long userId)
public async Task<bool> ResetStudentPwd(long userId, string pwd)
{
var user = await _userRepository.GetByIdAsync(userId);
if (user == null)
{
throw new BusinessException("用户不存在");
}
user.Password = MD5EncryptionHelper.MD5Encryption("123456");
user.Password = MD5EncryptionHelper.MD5Encryption(pwd);
//大写MD5
user.Password = user.Password.ToUpper();
return await _userRepository.UpdateAsync(user);