1
This commit is contained in:
parent
6fdbe91bf6
commit
262a733c3d
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user