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,6 +1,8 @@
package jccommon package jccommon
import ( import (
"f5"
"q5"
"strconv" "strconv"
) )
@ -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) {