ziwen 1 year ago
parent
commit
631308197a
1 changed files with 3 additions and 2 deletions
  1. 3 2
      controller/auth.go

+ 3 - 2
controller/auth.go

@@ -118,7 +118,8 @@ func (a *AuthController) Register(c *gin.Context) {
 		return
 	}
 
-	code := global.Redis.Get(context.TODO(), req.Email).String()
+	code := global.Redis.Get(context.TODO(), req.Email).Val()
+	fmt.Println("code:", code)
 	if code == "" || code != req.SmsCode {
 		resp.Fail("验证码错误,请重新输入", c)
 		return
@@ -452,7 +453,7 @@ func (a *AuthController) ForgetPwd(c *gin.Context) {
 
 		}
 	} else {
-		code := global.Redis.Get(context.TODO(), req.Account).String()
+		code := global.Redis.Get(context.TODO(), req.Account).Val()
 		if code == "" || code != req.SmsCode {
 			resp.Fail("验证码错误,请重新输入", c)
 			return