From 909bdf60e7fa88fac548a030382621850035539f Mon Sep 17 00:00:00 2001 From: chenchun <454313500@qq.com> Date: Sun, 11 Sep 2022 13:16:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=AF=86=E7=A0=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UserController.cs | 6 ++++++ .../yi-sqlsugar-dev.db | Bin 126976 -> 126976 bytes .../Yi.Framework.Interface/IUserService.cs | 8 ++++++++ .../Yi.Framework.Service/UserService.cs | 12 ++++++++++++ Yi.Vue3.X.RuoYi/src/api/system/user.js | 8 +++++--- 5 files changed, 31 insertions(+), 3 deletions(-) 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 a260cd1e663c607b3e80b9d8151ed52585bf87a5..b1bfb457e9e9abc07054574413038b5fe2b473a3 100644 GIT binary patch delta 482 zcmZp8z~1nHeS$P&{6raN#`uj1OZkO4Eg85ZIW75$x&QKZbF^}_a>i^{R7mBRTr07s zzA=_boQ;8z!I8n4gF&>>(w0G*fk9H90mu=4A^G!=0E3W`fsv7}fu*jYp@N~Ym7%GX zsfnJYv5A4HF?JbK17k~*lGNf7OD7+vGS8C2U=QO`*V5pk?9{;WY|Du9;PUvaFe6us zAotS5N)Pk=AS3g8b6?A}@L-F8ob+r1uS6%; z(2Vr_tZ?6mEVqD+?7&h_3*(}o5MvLobX(hJD`!4kJHh11j_sHZe6bx3JtS zDYcJ@h2M%{%jDZK8@L-&S;g5T!Ty~*PgboS?kN*_i!7#@LMsOZkPlBpJ9Q`K|bhx&QJ`=4j<;<&4>^sF2DrxmIG2 zy^*1zkqHnP8FITbTw`NkU@&HI=3tO-w6tXq2J$3o>zjC2hwbqx&_ z42`Ue4Xg|dCM(*B)EgQZ8CaT{85tUb%`(oY3NrJ~FRm<1cCXAa@Q5nP*9{CREAcnZ z2u!Q;3~>%93Utkmi1$fLO!6-(2{MQ%Oe`^XO>>IR@Xrr+%gYIIP4&ynNb)yLj@PZq zGtCRns`SrI_exGPb;}BMiAeKE&rJyl4lJnh&JDD+HRLk}`2c7)m@wHaDYcJ@1?coW zlW)sx5DsljVHIbSWNeHDQ$X)IPM#*Krfp!RU}$b-Vh;2Ks=o}3txS#dfB|A;ZeEgF zTw-E6*+Mp0BDC01JJLC$*gq*GCoM26w=&N%*gVV0eR7oC1C~Z-Ch=xF`R#V{jE61& E0M`*~Y5)KL 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 })