1
This commit is contained in:
parent
c72ef6e063
commit
5d018eaf37
@ -1,11 +1,49 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"time"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type goldBullionReturn struct {
|
||||
|
||||
}
|
||||
|
||||
func (this* goldBullionReturn) init() {
|
||||
go this.loadExpiredGoldBullion()
|
||||
}
|
||||
|
||||
func (this* goldBullionReturn) unInit() {
|
||||
}
|
||||
|
||||
func (this* goldBullionReturn) loadExpiredGoldBullion() {
|
||||
var lastIdx int64
|
||||
for true {
|
||||
hasNextData := false
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.GAME_DB,
|
||||
"SELECT * FROM t_gold_bullion WHERE idx > ? LIMIT 1000",
|
||||
[]string{
|
||||
q5.ToString(lastIdx),
|
||||
},
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user