李伟乐 1 year ago
parent d81d313bda
commit da760270ca
  1. 4
      middleware/jwt/jwt.go

@ -70,7 +70,7 @@ func JWT(opts ...JwtOption) middleware.Middleware {
if err != nil { if err != nil {
return err return err
} }
if needAuth && userInfo.UserId == 0 { if needAuth && userInfo.UserId == "" {
return errors.Unauthorized("TOKEN_BAD", "") return errors.Unauthorized("TOKEN_BAD", "")
} }
if authKey != "" { if authKey != "" {
@ -78,7 +78,7 @@ func JWT(opts ...JwtOption) middleware.Middleware {
return err return err
} }
} }
if userInfo.UserId > 0 { if userInfo.UserId != "" {
ctx = SetUserContext(ctx, userInfo) ctx = SetUserContext(ctx, userInfo)
} }
return nil return nil

Loading…
Cancel
Save