This commit is contained in:
yangduo 2024-12-25 16:33:32 +08:00
parent fea2c21ab7
commit f2cc140a95
2 changed files with 4 additions and 3 deletions

View File

@ -237,7 +237,7 @@ func (this *InGameApi) OrderInfo(c *gin.Context) {
if orderModel.Status == 0 { if orderModel.Status == 0 {
gameid := q5.SafeToInt64(strs[1]) gameid := q5.SafeToInt64(strs[1])
openid := strs[2] openid := q5.SafeToString(data["openid"])
sessionkey := q5.SafeToString(data["session_key"]) sessionkey := q5.SafeToString(data["session_key"])
userip := this.getIP(c) userip := this.getIP(c)
balance, errcode, err := service.Wxpay.QueryBalance(openid, gameid, userip, sessionkey) balance, errcode, err := service.Wxpay.QueryBalance(openid, gameid, userip, sessionkey)

View File

@ -101,7 +101,7 @@ func (wp *wxpay) freshAccessToken(gameid int64) (token string) {
"secret": cfg.GetAppsecret(), "secret": cfg.GetAppsecret(),
} }
urls := mt.Table.Config.GetWxUrl() urls := mt.Table.Config.GetWxUrl()
queryuri := "cgi-bin/token" queryuri := "/cgi-bin/token"
for _, wxhost := range urls { for _, wxhost := range urls {
url := "https://" + wxhost + queryuri url := "https://" + wxhost + queryuri
sendok := false sendok := false
@ -115,7 +115,7 @@ func (wp *wxpay) freshAccessToken(gameid int64) (token string) {
rspObj := struct { rspObj := struct {
Token string `json:"access_token"` Token string `json:"access_token"`
Expire int64 `json:"expire_in"` Expire int64 `json:"expires_in"`
ErrCode int64 `json:"errcode"` ErrCode int64 `json:"errcode"`
ErrMsg string `json:"errmsg"` ErrMsg string `json:"errmsg"`
}{} }{}
@ -130,6 +130,7 @@ func (wp *wxpay) freshAccessToken(gameid int64) (token string) {
tokenitem, _ := wp.accessTokens.Load(gameid) tokenitem, _ := wp.accessTokens.Load(gameid)
tokenitem.token = rspObj.Token tokenitem.token = rspObj.Token
tokenitem.expire = rspObj.Expire + f5.GetApp().GetRealSeconds() tokenitem.expire = rspObj.Expire + f5.GetApp().GetRealSeconds()
wp.accessTokens.Store(gameid, *tokenitem)
} }
}) })