This commit is contained in:
yangduo 2024-09-13 15:23:19 +08:00
parent 36e47dd488
commit 0613e397c0
3 changed files with 14 additions and 4 deletions

View File

@ -73,7 +73,7 @@ func (this *VIPApi) Bind(c *gin.Context) {
info := map[string]interface{}{}
info["account_address"] = ""
info["email"] = ""
service.JwtAuth.JwtAuthHandle(reqObj.Passport_jwt, &info)
service.JwtAuth.JwtAuthHandle(reqObj.Passport_jwt, &info, constant.JWT_PASSPORT)
passport_addr := info["account_address"].(string)
if passport_addr == "" || accountAddress == passport_addr {
f5.RspErr(c, 1, "bad request passport")

View File

@ -31,3 +31,8 @@ const (
const (
GAME_SWITCH_HERO_MINT = "heroMint"
)
const (
JWT_METAMAST = 1
JWT_PASSPORT = 2
)

View File

@ -5,6 +5,7 @@ import (
"fmt"
"jccommon"
"main/mt"
"marketserver/constant"
"q5"
"strings"
)
@ -18,7 +19,7 @@ func (this *jwtauth) init() {
func (this *jwtauth) unInit() {
}
func (this *jwtauth) JwtAuthHandle(srcToken string, rspinfo *map[string]interface{}) {
func (this *jwtauth) JwtAuthHandle(srcToken string, rspinfo *map[string]interface{}, jwtType int32) {
jwtToken := ""
if len(srcToken) > 8 {
jwtToken = srcToken[7:]
@ -26,9 +27,13 @@ func (this *jwtauth) JwtAuthHandle(srcToken string, rspinfo *map[string]interfac
tmpStrings := q5.StrSplit(jwtToken, ".")
if len(tmpStrings) > 3 {
this.internalMetaMaskJwtAuth(jwtToken, rspinfo)
if jwtType == constant.JWT_METAMAST {
this.internalMetaMaskJwtAuth(jwtToken, rspinfo)
}
} else {
this.internalImmutJwtAuth(jwtToken, rspinfo)
if jwtType == constant.JWT_PASSPORT {
this.internalImmutJwtAuth(jwtToken, rspinfo)
}
}
}