From 262a733c3db33d7dfea1c58605d03999985da73d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 22 Jun 2024 15:50:53 +0800 Subject: [PATCH] 1 --- server/backtask/task/gold_bullion_return.go | 56 +++++++++------------ 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/server/backtask/task/gold_bullion_return.go b/server/backtask/task/gold_bullion_return.go index ba521c53..5bd59ce7 100644 --- a/server/backtask/task/gold_bullion_return.go +++ b/server/backtask/task/gold_bullion_return.go @@ -1,7 +1,7 @@ package task import ( - "q5" + //"q5" "f5" "time" "fmt" @@ -20,36 +20,28 @@ func (this* goldBullionReturn) unInit() { } func (this* goldBullionReturn) loadExpiredGoldBullion() { - var lastIdx int64 - for true { - hasNextData := false - nowTime := f5.GetApp().GetRealSeconds() - expiredTime := nowTime - 3600 * 24 - 60 * 5 - sql := fmt.Sprintf(` + f5.GetGoStyleDb().LoopLoad( + constant.BCNFT_DB, + func (lastIdx int64) string { + nowTime := f5.GetApp().GetRealSeconds() + expiredTime := nowTime - 3600 * 24 - 60 * 5 + sql := fmt.Sprintf(` SELECT * FROM t_gold_bullion WHERE idx > %d AND activated = 0 AND createtime < %d LIMIT 1000`, - lastIdx, - expiredTime) - f5.GetGoStyleDb().RawQuery( - constant.GAME_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) - } - } + lastIdx, + expiredTime) + return sql + }, + []string{ + }, + func () time.Duration { + return time.Second * 10 + }, + func () time.Duration { + return time.Second * 60 * 5 + }, + this.returnGold) +} + +func (this* goldBullionReturn) returnGold(ds *f5.DataSet) bool { + return true }