This commit is contained in:
aozhiwei 2024-09-03 10:23:47 +08:00
parent 84cbb9f6e5
commit 3e5fccd132

View File

@ -26,17 +26,17 @@ func (this *stackingCec) unInit() {
} }
func (this *stackingCec) process(netId int32, contractAddress string) { func (this *stackingCec) process(netId int32, contractAddress string) {
key := fmt.Sprintf("recharge.lastIdx.%d.%s", netId, contractAddress) key := fmt.Sprintf("stackingCec.lastIdx.%d.%s", netId, contractAddress)
if dbLastIdxStr, err := jccommon.GetDbParam(constant.BCEVENT_DB, key); err == nil { if dbLastIdxStr, err := jccommon.GetDbParam(constant.BCEVENT_DB, key); err == nil {
f5.GetGoStyleDb().IncrementLoad( f5.GetGoStyleDb().IncrementLoad(
constant.BCEVENT_DB, constant.BCEVENT_DB,
"recharge." + q5.ToString(netId) + "." + contractAddress, "stackingCec." + q5.ToString(netId) + "." + contractAddress,
"t_blockchain_event", "t_blockchain_event",
q5.ToInt64(dbLastIdxStr), q5.ToInt64(dbLastIdxStr),
func (lastIdx int64, maxIdx int64) (string, []string) { func (lastIdx int64, maxIdx int64) (string, []string) {
sql := fmt.Sprintf(` sql := fmt.Sprintf(`
SELECT * FROM t_blockchain_event SELECT * FROM t_blockchain_event
WHERE idx > %d AND idx <= %d AND net_id = %d AND contract_address = ? AND event_name = ? WHERE idx > %d AND idx <= %d AND net_id = %d AND contract_address = ? AND event_name IN (?, ?)
ORDER BY idx LIMIT 1000 ORDER BY idx LIMIT 1000
`, `,
lastIdx, lastIdx,
@ -44,7 +44,8 @@ ORDER BY idx LIMIT 1000
netId) netId)
params := []string{ params := []string{
contractAddress, contractAddress,
"ItemSoldOut", "StakeCec",
"UnstakeCec",
} }
return sql, params return sql, params
}, },
@ -53,7 +54,7 @@ ORDER BY idx LIMIT 1000
}, },
this.saveToDb) this.saveToDb)
} else { } else {
panic(fmt.Sprintf("recharge.process getDBParam error %s", err)) panic(fmt.Sprintf("stackingCec.process getDBParam error %s", err))
} }
} }