This commit is contained in:
aozhiwei 2024-07-23 14:30:50 +08:00
parent 03e0047b60
commit ecf9029b97

View File

@ -2,8 +2,9 @@ package task
import (
"f5"
"main/constant"
"mt"
"jccommon"
"main/constant"
"fmt"
)
@ -25,28 +26,41 @@ type unLockReturnValues struct {
}
func (this* chainActivity) init() {
go this.process()
mt.Table.Contract.Traverse(func (ele *mt.Contract) bool {
if ele.GetName() == jccommon.CONTRACT_NAME_NFTLock {
go this.processLockAndUnLockEvent(ele.GetNetId(), ele.GetAddress())
}
return true
})
}
func (this* chainActivity) unInit() {
}
func (this* chainActivity) process() {
func (this* chainActivity) processLockAndUnLockEvent(netId int32, lockContractAddress string) {
f5.GetGoStyleDb().IncrementLoad(
constant.BCNFT_DB,
"chainActivity",
"t_blockchain_event",
0,
func (lastIdx int64, maxIdx int64) (string, []string) {
sql := fmt.Sprintf(`
SELECT * FROM t_blockchain_event
WHERE idx > %d AND idx <= %d AND item_id = 0 AND token_type <> %d ORDER BY idx LIMIT 1000
WHERE idx > %d AND idx <= %d AND netId = %d AND contract_address = ? AND event_name IN (?, ?)
ORDER BY idx LIMIT 1000
`,
lastIdx,
maxIdx,
jccommon.NFT_TYPE_FOUNDER_TAG,
)
params := []string{}
netId)
params := []string{
lockContractAddress,
"Lock",
"UnLock",
}
return sql, params
},
func (newLastIdx int64) {
},
this.repairNft)
}