From 81c897938b81d2c1f8ebd399049be5fa25d15600 Mon Sep 17 00:00:00 2001 From: yangduo Date: Mon, 9 Sep 2024 15:43:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/apigate/service/sapi_forward.go | 2 +- server/gamesapi/middleware/caforward.go | 2 +- server/jccommon/utils.go | 55 ++++++++++++++++++------- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/server/apigate/service/sapi_forward.go b/server/apigate/service/sapi_forward.go index 7b1f5f1c..ff313331 100644 --- a/server/apigate/service/sapi_forward.go +++ b/server/apigate/service/sapi_forward.go @@ -1,9 +1,9 @@ package service import ( - "apigate/constant" "f5" "fmt" + "main/constant" "main/mt" "math/rand" "q5" diff --git a/server/gamesapi/middleware/caforward.go b/server/gamesapi/middleware/caforward.go index 72817d5c..872d97e4 100644 --- a/server/gamesapi/middleware/caforward.go +++ b/server/gamesapi/middleware/caforward.go @@ -40,7 +40,7 @@ func CaForward(c *gin.Context) { costTime := q5.GetTickCount() - beginTick service.SApiForward.UpdateCostTime(costTime) }() - downStreamUrl, downStreamHost := service.SApiForward.GetDownStreamHost(); + downStreamUrl, downStreamHost := service.SApiForward.GetDownStreamHost() newUrl := downStreamUrl + c.Request.URL.Path[5:] if !q5.StrContains(newUrl, "?") { newUrl = newUrl + "?" diff --git a/server/jccommon/utils.go b/server/jccommon/utils.go index e81af695..5eb9d72e 100644 --- a/server/jccommon/utils.go +++ b/server/jccommon/utils.go @@ -1,20 +1,22 @@ package jccommon import ( + "f5" + "q5" "strconv" ) func GetGoldBullionGoldNum(itemId int32) int32 { switch itemId { case V_ITEM_GOLD_BULLION_1K: { - return 1000 - } + return 1000 + } case V_ITEM_GOLD_BULLION_1W: { - return 10000 * 1 - } + return 10000 * 1 + } default: { - return 0 - } + return 0 + } } } @@ -67,15 +69,15 @@ func CalcContributionScore(nfts []*NftStacking) float64 { for _, v := range nfts { switch v.TokenType { case NFT_TYPE_CFHERO, NFT_TYPE_CFHERO_NORMAL: { - baseScore += GetHeroStackingScore(v.Quality) - if v.TokenType == NFT_TYPE_CFHERO { - rate += 0.05 + baseScore += GetHeroStackingScore(v.Quality) + if v.TokenType == NFT_TYPE_CFHERO { + rate += 0.05 + } } - } case NFT_TYPE_FOUNDER_TAG: { - baseScore += GetFounderTagStackingScore(v.Quality) - rate += 0.1 - } + baseScore += GetFounderTagStackingScore(v.Quality) + rate += 0.1 + } } } if rate > 1 { @@ -85,8 +87,33 @@ func CalcContributionScore(nfts []*NftStacking) float64 { return score } +func ExtractChannel(accountId string) string { + strs := q5.StrSplit(accountId, "_") + return strs[0] +} + func IsValidSessionId(accountId string, sessionId string) bool { - return true + if accountId == "" || sessionId == "" { + return false + } + + strs := q5.StrSplit(sessionId, "_") + if len(strs) < 4 { + return false + } + + if f5.IsOnlineEnv() { + channel := ExtractChannel(accountId) + if channel == "6000" { + return false + } + } + + session_createtime := strs[0] + account_regtime := strs[1] + md51 := strs[2] + // md52:=strs[3] + return q5.Md5Str(accountId + "f3a6a9a5-217a-4079-ab99-b5d69b8212be" + account_regtime + session_createtime) == md51 } func GenTransId(funcId int8, time int32, seqId int32, params []int64) (string, error) {