This commit is contained in:
aozhiwei 2024-09-02 17:53:52 +08:00
parent ede4b23c52
commit 84cbb9f6e5

View File

@ -1,8 +1,12 @@
package task
import (
"q5"
"f5"
"main/mt"
"main/constant"
"jccommon"
"fmt"
)
type stackingCec struct {
@ -22,8 +26,37 @@ func (this *stackingCec) unInit() {
}
func (this *stackingCec) process(netId int32, contractAddress string) {
key := fmt.Sprintf("recharge.lastIdx.%d.%s", netId, contractAddress)
if dbLastIdxStr, err := jccommon.GetDbParam(constant.BCEVENT_DB, key); err == nil {
f5.GetGoStyleDb().IncrementLoad(
constant.BCEVENT_DB,
"recharge." + q5.ToString(netId) + "." + contractAddress,
"t_blockchain_event",
q5.ToInt64(dbLastIdxStr),
func (lastIdx int64, maxIdx int64) (string, []string) {
sql := fmt.Sprintf(`
SELECT * FROM t_blockchain_event
WHERE idx > %d AND idx <= %d AND net_id = %d AND contract_address = ? AND event_name = ?
ORDER BY idx LIMIT 1000
`,
lastIdx,
maxIdx,
netId)
params := []string{
contractAddress,
"ItemSoldOut",
}
return sql, params
},
func (newLastIdx int64) {
jccommon.SaveDbParam(constant.BCEVENT_DB, key, q5.ToString(newLastIdx))
},
this.saveToDb)
} else {
panic(fmt.Sprintf("recharge.process getDBParam error %s", err))
}
}
func (this *stackingCec) saveToDb() {
func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
return true
}