1
This commit is contained in:
parent
5c9b53af10
commit
446aaa6784
@ -1,11 +1,53 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"time"
|
||||
"fmt"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type specTransfer721 struct {
|
||||
|
||||
}
|
||||
|
||||
func (this* specTransfer721) init() {
|
||||
go this.process()
|
||||
}
|
||||
|
||||
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(
|
||||
constant.BCEVENT_DB,
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ type taskMgr struct {
|
||||
//DailyTaskMgr
|
||||
webHook
|
||||
goldBullionReturn
|
||||
specTransfer721
|
||||
}
|
||||
|
||||
func (this *taskMgr) Init() {
|
||||
@ -16,9 +17,11 @@ func (this *taskMgr) Init() {
|
||||
//t.DailyTaskMgr.Init()
|
||||
this.webHook.init()
|
||||
this.goldBullionReturn.init()
|
||||
this.specTransfer721.init()
|
||||
}
|
||||
|
||||
func (this *taskMgr) UnInit() {
|
||||
this.specTransfer721.unInit()
|
||||
this.goldBullionReturn.unInit()
|
||||
this.webHook.unInit()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user