用数字调试用户
This commit is contained in:
parent
7a02b3242e
commit
e8295ceed6
|
@ -3,6 +3,7 @@ package basic
|
|||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"fusenapi/shared"
|
||||
"fusenapi/utils/auth"
|
||||
|
@ -56,16 +57,21 @@ func RequestParse(w http.ResponseWriter, r *http.Request, svcCtx any, LogicReque
|
|||
var userinfo *auth.UserInfo
|
||||
var err error
|
||||
// log.Println(io.ReadAll(r.Body))
|
||||
token, info, err := auth.ParseJwtTokenHeader[auth.UserInfo](r) //解析Token头, 和payload信息
|
||||
token := r.Header.Get("Authorization")
|
||||
userId, err := strconv.ParseInt(token, 10, 63)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if token == "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjQyOTM0NjIsImd1ZXN0X2lkIjozNiwiaWF0IjozMTUzNjAwMCwidXNlcl9pZCI6MH0.T7PuRSrinlJu7ZZ1DVqUJLWXhY_6R1lXiUHaNdw35hU" {
|
||||
userinfo = info
|
||||
userinfo = &auth.UserInfo{
|
||||
UserId: userId,
|
||||
}
|
||||
} else {
|
||||
var secret uint64 = 0
|
||||
|
||||
token, info, err := auth.ParseJwtTokenHeader[auth.UserInfo](r) //解析Token头, 和payload信息
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if info != nil {
|
||||
|
||||
if info.IsUser() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user