diff --git a/server/router/system/sys_user.go b/server/router/system/sys_user.go index 848c28fe1d2b452d59c06d1b8153625c58136ebd..00d2f43d1e8f9a3c23b8ab112c3e5ad344feb63b 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 55f27e73e43c6c26e4875dc9f8a6997cc502b610..78fd0b8157c8f632a6f1da9017a890858edb36a7 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 ba5d0b11cb5cddc828ebcb3ec435741724b1c534..51694428dd3414a7f7fe601724f60929a7423090 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 }) }