This commit is contained in:
laodaming 2023-06-02 12:15:32 +08:00
parent efd0f28d51
commit f7a20f3670

View File

@ -3,7 +3,7 @@ package auth
import (
"encoding/json"
"github.com/golang-jwt/jwt"
"log"
"github.com/zeromicro/go-zero/core/logx"
"net/http"
"time"
)
@ -58,13 +58,13 @@ func CheckAuth(r *http.Request) UserInfo {
token = r.Header.Get("Auth-Key")
}
if token == "" {
log.Println("token is empty")
logx.Debug("token is empty")
return UserInfo{}
}
//解析token
userInfo, err := ParseJwtToken(token)
if err != nil {
log.Println(err)
logx.Debug(err)
return UserInfo{}
}
return userInfo