This commit is contained in:
aozhiwei 2024-06-22 12:35:52 +08:00
parent 5c9b53af10
commit 446aaa6784
2 changed files with 45 additions and 0 deletions

View File

@ -1,11 +1,53 @@
package task package task
import (
"q5"
"f5"
"time"
"fmt"
"main/constant"
)
type specTransfer721 struct { type specTransfer721 struct {
} }
func (this* specTransfer721) init() { func (this* specTransfer721) init() {
go this.process()
} }
func (this* specTransfer721) unInit() { 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)
}
}
}

View File

@ -9,6 +9,7 @@ type taskMgr struct {
//DailyTaskMgr //DailyTaskMgr
webHook webHook
goldBullionReturn goldBullionReturn
specTransfer721
} }
func (this *taskMgr) Init() { func (this *taskMgr) Init() {
@ -16,9 +17,11 @@ func (this *taskMgr) Init() {
//t.DailyTaskMgr.Init() //t.DailyTaskMgr.Init()
this.webHook.init() this.webHook.init()
this.goldBullionReturn.init() this.goldBullionReturn.init()
this.specTransfer721.init()
} }
func (this *taskMgr) UnInit() { func (this *taskMgr) UnInit() {
this.specTransfer721.unInit()
this.goldBullionReturn.unInit() this.goldBullionReturn.unInit()
this.webHook.unInit() this.webHook.unInit()
} }