yuliang1112 2 rokov pred
rodič
commit
05bbe27094
1 zmenil súbory, kde vykonal 6 pridanie a 5 odobranie
  1. 6 5
      service/login_auth.go

+ 6 - 5
service/login_auth.go

@@ -73,7 +73,8 @@ func (l *loginAuth) AuthCode(ctx context.Context, phone string, code string) (st
 	if err != nil {
 		return "", err
 	}
-	if *vcode != code {
+	fmt.Printf("缓存的验证码 vcode: %v,实际填入的 code:%v", vcode, code)
+	if vcode != code {
 		// 验证码错误
 		logrus.Debugf("[AuthCode] auth fail,phone:%+v", phone)
 		return "验证码有误", errors.New("auth fail")
@@ -140,15 +141,15 @@ func (l *loginAuth) setSession(ctx context.Context, phone string, auth *redis_mo
 	return nil
 }
 
-func (l *loginAuth) getSessionCode(ctx context.Context, phone string) (*string, error) {
+func (l *loginAuth) getSessionCode(ctx context.Context, phone string) (string, error) {
 	value, err := redis.Get(ctx, l.getRedisKey(phone))
 	if err != nil {
 		if err == consts.RedisNil {
-			return nil, fmt.Errorf("not found in redis,phone:%+v", phone)
+			return "", fmt.Errorf("not found in redis,phone:%+v", phone)
 		}
-		return nil, err
+		return "", err
 	}
-	return &value, nil
+	return value, nil
 }
 
 func (l *loginAuth) getSessionAuth(ctx context.Context, phone string) (*redis_model.Auth, error) {