diff --git a/server/marketserver/api/v1/vip/vip.go b/server/marketserver/api/v1/vip/vip.go index 7eca4bc9..b016ca45 100644 --- a/server/marketserver/api/v1/vip/vip.go +++ b/server/marketserver/api/v1/vip/vip.go @@ -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") diff --git a/server/marketserver/constant/constant.go b/server/marketserver/constant/constant.go index 1c2704ed..5c33c463 100644 --- a/server/marketserver/constant/constant.go +++ b/server/marketserver/constant/constant.go @@ -31,3 +31,8 @@ const ( const ( GAME_SWITCH_HERO_MINT = "heroMint" ) + +const ( + JWT_METAMAST = 1 + JWT_PASSPORT = 2 +) diff --git a/server/marketserver/service/jwtauth.go b/server/marketserver/service/jwtauth.go index 99872820..f6875cfe 100644 --- a/server/marketserver/service/jwtauth.go +++ b/server/marketserver/service/jwtauth.go @@ -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) + } } }