This commit is contained in:
yangduo 2024-09-09 15:43:28 +08:00
parent 38db97825a
commit 81c897938b
3 changed files with 43 additions and 16 deletions

View File

@ -1,9 +1,9 @@
package service package service
import ( import (
"apigate/constant"
"f5" "f5"
"fmt" "fmt"
"main/constant"
"main/mt" "main/mt"
"math/rand" "math/rand"
"q5" "q5"

View File

@ -40,7 +40,7 @@ func CaForward(c *gin.Context) {
costTime := q5.GetTickCount() - beginTick costTime := q5.GetTickCount() - beginTick
service.SApiForward.UpdateCostTime(costTime) service.SApiForward.UpdateCostTime(costTime)
}() }()
downStreamUrl, downStreamHost := service.SApiForward.GetDownStreamHost(); downStreamUrl, downStreamHost := service.SApiForward.GetDownStreamHost()
newUrl := downStreamUrl + c.Request.URL.Path[5:] newUrl := downStreamUrl + c.Request.URL.Path[5:]
if !q5.StrContains(newUrl, "?") { if !q5.StrContains(newUrl, "?") {
newUrl = newUrl + "?" newUrl = newUrl + "?"

View File

@ -1,20 +1,22 @@
package jccommon package jccommon
import ( import (
"f5"
"q5"
"strconv" "strconv"
) )
func GetGoldBullionGoldNum(itemId int32) int32 { func GetGoldBullionGoldNum(itemId int32) int32 {
switch itemId { switch itemId {
case V_ITEM_GOLD_BULLION_1K: { case V_ITEM_GOLD_BULLION_1K: {
return 1000 return 1000
} }
case V_ITEM_GOLD_BULLION_1W: { case V_ITEM_GOLD_BULLION_1W: {
return 10000 * 1 return 10000 * 1
} }
default: { default: {
return 0 return 0
} }
} }
} }
@ -67,15 +69,15 @@ func CalcContributionScore(nfts []*NftStacking) float64 {
for _, v := range nfts { for _, v := range nfts {
switch v.TokenType { switch v.TokenType {
case NFT_TYPE_CFHERO, NFT_TYPE_CFHERO_NORMAL: { case NFT_TYPE_CFHERO, NFT_TYPE_CFHERO_NORMAL: {
baseScore += GetHeroStackingScore(v.Quality) baseScore += GetHeroStackingScore(v.Quality)
if v.TokenType == NFT_TYPE_CFHERO { if v.TokenType == NFT_TYPE_CFHERO {
rate += 0.05 rate += 0.05
}
} }
}
case NFT_TYPE_FOUNDER_TAG: { case NFT_TYPE_FOUNDER_TAG: {
baseScore += GetFounderTagStackingScore(v.Quality) baseScore += GetFounderTagStackingScore(v.Quality)
rate += 0.1 rate += 0.1
} }
} }
} }
if rate > 1 { if rate > 1 {
@ -85,8 +87,33 @@ func CalcContributionScore(nfts []*NftStacking) float64 {
return score return score
} }
func ExtractChannel(accountId string) string {
strs := q5.StrSplit(accountId, "_")
return strs[0]
}
func IsValidSessionId(accountId string, sessionId string) bool { 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) { func GenTransId(funcId int8, time int32, seqId int32, params []int64) (string, error) {