修复注册解析参数错误与返回参数错误

This commit is contained in:
junleea 2024-07-08 10:45:55 +08:00
parent a54d1f93f1
commit 6acfb4277e
1 changed files with 2 additions and 2 deletions

View File

@ -254,7 +254,7 @@ func registerHandler(c *gin.Context) {
var req_data RLReq
tokenString := ""
var id uint
if err := c.ShouldBindJSON(&req_data); err == nil {
if err := c.ShouldBind(&req_data); err == nil {
if len(req_data.Password) != 32 {
hasher := md5.New()
hasher.Write([]byte(req_data.Password)) // 生成密码的 MD5 散列值
@ -281,7 +281,7 @@ func registerHandler(c *gin.Context) {
return
}
} else {
c.JSON(200, gin.H{"error": err.Error(), "code": proto.DeviceRestartFailed, "message": "error"})
c.JSON(200, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "error"})
return
}
fmt.Println(req_data)