This commit is contained in:
aozhiwei 2024-06-22 21:15:33 +08:00
parent 595ce037a7
commit ce3aea1602

View File

@ -1,7 +1,7 @@
package task package task
import ( import (
"q5" //"q5"
"f5" "f5"
"time" "time"
"fmt" "fmt"
@ -20,37 +20,29 @@ func (this* specTransfer721) unInit() {
} }
func (this* specTransfer721) process() { func (this* specTransfer721) process() {
var lastIdx int64 f5.GetGoStyleDb().LoopLoad(
for true { constant.BCEVENT_DB,
hasNextData := false func (lastIdx int64) string {
sql := fmt.Sprintf(` nowTime := f5.GetApp().GetRealSeconds()
SELECT * FROM t_721nft_spec_transfer WHERE idx > %d LIMIT 1000`, expiredTime := nowTime - 3600 * 24 * 7
lastIdx, sql := fmt.Sprintf(`
) SELECT * FROM t_721nft_spec_transfer WHERE idx > %d AND status = 0 AND createtime < %d LIMIT 1000
f5.GetGoStyleDb().RawQuery( `,
constant.BCEVENT_DB, lastIdx,
sql, expiredTime)
[]string{ return sql
}, },
func (err error, ds *f5.DataSet) { []string{
if err == nil { },
for ds.Next() { func () time.Duration {
idx := q5.ToInt64(ds.GetByName("idx")) return time.Second * 10
if idx > lastIdx { },
lastIdx = idx func () time.Duration {
} return time.Second * 60 * 1
hasNextData = true },
} this.process1)
}
})
if hasNextData {
time.Sleep(time.Second * 5)
} else {
lastIdx = 0
time.Sleep(time.Second * 60 * 1)
}
}
} }
func (this* specTransfer721) process1(ds *f5.DataSet) { func (this* specTransfer721) process1(ds *f5.DataSet) bool {
return true
} }