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
import (
"apigate/constant"
"f5"
"fmt"
"main/constant"
"main/mt"
"math/rand"
"q5"

View File

@ -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 + "?"

View File

@ -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) {