diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs index 2814149c..86bf7b0b 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/UserController.cs @@ -115,5 +115,11 @@ namespace Yi.Framework.ApiMicroservice.Controllers { return Result.Success().SetStatus(await _iUserService.AddInfo(userDto)); } + + [HttpPut] + public async Task RestPassword(UserEntity user) + { + return Result.Success().SetStatus(await _iUserService.RestPassword(user.Id, user.Password)); + } } } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index a260cd1e..b1bfb457 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/IUserService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/IUserService.cs index abf0b509..fa861e85 100644 --- a/Yi.Framework.Net6/Yi.Framework.Interface/IUserService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Interface/IUserService.cs @@ -98,5 +98,13 @@ namespace Yi.Framework.Interface /// /// Task AddInfo(UserInfoDto userDto); + + /// + /// 重置密码 + /// + /// + /// + /// + Task RestPassword(long userId,string password ); } } diff --git a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs index c33e6ff7..387575eb 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs @@ -235,5 +235,17 @@ namespace Yi.Framework.Service var res2 = await GiveUserSetRole(new List { res1 }, userDto.RoleIds); return !0.Equals(res1) && res2; } + + public async Task RestPassword(long userId, string password) + { + var user = new UserEntity(); + user.Id = userId; + user.Password = password; + user.BuildPassword(); + + return await _repository.UpdateIgnoreNullAsync(user); + + + } } } diff --git a/Yi.Vue3.X.RuoYi/src/api/system/user.js b/Yi.Vue3.X.RuoYi/src/api/system/user.js index 3f7077d0..39a58f45 100644 --- a/Yi.Vue3.X.RuoYi/src/api/system/user.js +++ b/Yi.Vue3.X.RuoYi/src/api/system/user.js @@ -50,13 +50,15 @@ export function delUser(userId) { } // 用户密码重置 -export function resetUserPwd(userId, password) { +export function resetUserPwd(id, password) { const data = { - userId, + id, password } + + return request({ - url: '/system/user/resetPwd', + url: '/user/restPassword', method: 'put', data: data })