This commit is contained in:
parent
e4429ff428
commit
a8bc53f3b1
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue