增加重置用户密码功能

This commit is contained in:
蒋吉兆
2021-11-17 22:45:16 +08:00
parent 7c72ab9dcb
commit ff4121510c
12 changed files with 149 additions and 5 deletions

View File

@@ -301,3 +301,21 @@ func (b *BaseApi) GetUserInfo(c *gin.Context) {
response.OkWithDetailed(gin.H{"userInfo": ReqUser}, "获取成功", c)
}
}
// @Tags SysUser
// @Summary 用户修改密码
// @Security ApiKeyAuth
// @Produce application/json
// @Param data body system.SysUser true "ID"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
// @Router /user/resetPassword [post]
func (b *BaseApi) ResetPassword(c *gin.Context) {
var user system.SysUser
_ = c.ShouldBindJSON(&user)
if err := userService.ResetPassword(user.ID); err != nil {
global.GVA_LOG.Error("重置失败!", zap.Error(err))
response.FailWithMessage("重置失败"+err.Error(), c)
} else {
response.OkWithMessage("重置成功", c)
}
}