From af3800ea28d919f728aa8570db354afde0999b07 Mon Sep 17 00:00:00 2001 From: longzhang83 <38556219+longzhang83@users.noreply.github.com> Date: Tue, 26 Apr 2022 17:59:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=87=8D=E7=BD=AE=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=A4=B1=E6=95=88=EF=BC=8C=E4=BB=A5=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E9=87=8A=E6=9B=B4=E6=AD=A3=E5=92=8C=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=91=BD=E5=90=8D=20(#1049)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复重置密码失效,以及相关注释更正和变量命名 --- server/router/system/sys_user.go | 2 +- server/service/system/sys_user.go | 4 ++-- web/src/api/user.js | 13 +++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/server/router/system/sys_user.go b/server/router/system/sys_user.go index 848c28fe..00d2f43d 100644 --- a/server/router/system/sys_user.go +++ b/server/router/system/sys_user.go @@ -19,7 +19,7 @@ func (s *UserRouter) InitUserRouter(Router *gin.RouterGroup) { userRouter.DELETE("deleteUser", baseApi.DeleteUser) // 删除用户 userRouter.PUT("setUserInfo", baseApi.SetUserInfo) // 设置用户信息 userRouter.POST("setUserAuthorities", baseApi.SetUserAuthorities) // 设置用户权限组 - userRouter.POST("resetPassword", baseApi.ResetPassword) // 设置用户权限组 + userRouter.POST("resetPassword", baseApi.ResetPassword) // 重置密码 } { userRouterWithoutRecord.POST("getUserList", baseApi.GetUserList) // 分页获取用户列表 diff --git a/server/service/system/sys_user.go b/server/service/system/sys_user.go index 55f27e73..78fd0b81 100644 --- a/server/service/system/sys_user.go +++ b/server/service/system/sys_user.go @@ -198,7 +198,7 @@ func (userService *UserService) FindUserByUuid(uuid string) (err error, user *sy //@param: ID uint //@return: err error -func (userService *UserService) ResetPassword(ID uint) (err error) { - err = global.GVA_DB.Model(&system.SysUser{}).Where("id = ?", ID).Update("password", utils.MD5V([]byte("123456"))).Error +func (userService *UserService) ResetPassword(id uint) (err error) { + err = global.GVA_DB.Model(&system.SysUser{}).Where("id = ?", id).Update("password", utils.MD5V([]byte("123456"))).Error return err } diff --git a/web/src/api/user.js b/web/src/api/user.js index ba5d0b11..51694428 100644 --- a/web/src/api/user.js +++ b/web/src/api/user.js @@ -142,9 +142,18 @@ export const getUserInfo = () => { }) } -export const resetPassword = () => { + +// @Tags User +// @Summary 重置密码 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Router /user/resetPassword [put] +export const resetPassword = (data) => { return service({ url: '/user/resetPassword', - method: 'post' + method: 'put', + data: data }) } -- GitLab