This commit is contained in:
aozhiwei 2024-07-10 14:20:51 +08:00
parent 83e792e663
commit d92d39e216
3 changed files with 20 additions and 13 deletions

View File

@ -7,7 +7,7 @@ import (
"jccommon"
"fmt"
"main/constant"
"main/service"
//"main/service"
)
type goldBullionReturn struct {
@ -31,11 +31,12 @@ func (this* goldBullionReturn) loadExpiredGoldBullion() {
},
func (lastIdx int64) string {
nowTime := f5.GetApp().GetRealSeconds()
expiredTime := nowTime - 3600 * 24 - 60 * 10
expiredTime := nowTime - 3600 * 24 - 3600
sql := fmt.Sprintf(`
SELECT * FROM t_gold_bullion
WHERE idx > %d AND activated = 0 AND returned = 0 AND createtime < %d LIMIT 100`,
WHERE idx > %d AND activated = 0 AND returned = 0 AND status=%d AND createtime < %d LIMIT 100`,
lastIdx,
jccommon.GOLD_BULLION_NO_OPEN,
expiredTime)
return sql
},
@ -54,20 +55,24 @@ func (this* goldBullionReturn) returnGold(ds *f5.DataSet) bool {
netId := q5.ToInt32(ds.GetByName("net_id"))
contractMeta := mt.Table.Contract.GetByNetIdName(netId, jccommon.CONTRACT_NAME_GoldBrick)
if contractMeta == nil {
return false
return true
}
accountId := ds.GetByName("src_account_id")
if accountId == "" {
return true
}
accountId := ds.GetByName("account_id")
contractAddress := contractMeta.GetAddress()
tokenId := ds.GetByName("token_id")
tokenId = "1076969088010093"
f5.GetSysLog().Info("returnGold net:%d accountId:%s contract_address:%s tokenId: %s",
netId, accountId, contractAddress, tokenId)
{
rspObj := struct {
Result *struct {
Result struct {
TokenId string `json:"token_id"`
} `json:"result"`
}{}
url := fmt.Sprintf("https://%s/v1/chains/%s/collections/%s:/nfts/%s",
url := fmt.Sprintf("%s/v1/chains/%s/collections/%s/nfts/%s",
mt.Table.Config.GetById(0).GetImmutableBaseUrl(),
mt.Table.Config.GetById(0).GetChainName(),
contractAddress,
@ -84,14 +89,15 @@ func (this* goldBullionReturn) returnGold(ds *f5.DataSet) bool {
rsp.GetErr())
return
}
if err := q5.DecodeJson("", &rspObj); err != nil {
if err := q5.DecodeJson(rsp.GetRawData(), &rspObj); err != nil {
f5.GetSysLog().Info("returnGold immutable api:%s decodeJson error:%s",
url,
err)
return
}
})
if httpErr != nil {
return false
return true
}
if rspObj.Result.TokenId == tokenId {
f5.GetSysLog().Info("returnGold tokenId:%s exists",
@ -99,5 +105,6 @@ func (this* goldBullionReturn) returnGold(ds *f5.DataSet) bool {
return true
}
}
return service.ReturnGoldBullion(accountId, netId, tokenId)
return true
//return service.ReturnGoldBullion(accountId, netId, tokenId)
}

View File

@ -24,7 +24,7 @@ func (this *taskMgr) Init() {
//t.HourlyTaskMgr.Init()
//t.DailyTaskMgr.Init()
this.webHook.init()
//this.goldBullionReturn.init()
this.goldBullionReturn.init()
//this.SpecTransfer721.Init()
this.repairNft.init()
this.sysMail.init()
@ -40,7 +40,7 @@ func (this *taskMgr) UnInit() {
this.sysMail.unInit()
this.repairNft.unInit()
//this.SpecTransfer721.UnInit()
//this.goldBullionReturn.unInit()
this.goldBullionReturn.unInit()
this.webHook.unInit()
}

2
third_party/q5 vendored

@ -1 +1 @@
Subproject commit f715cffbcefcec26906f0995a5706e61fb464ad6
Subproject commit dd6cf609347a05742c56c1e5b7f1f671b4f20ebd