This commit is contained in:
aozhiwei 2024-06-22 15:50:53 +08:00
parent 6fdbe91bf6
commit 262a733c3d

View File

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