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