This commit is contained in:
aozhiwei 2024-06-22 13:50:00 +08:00
parent 77101b6ce5
commit e25fee54a7
2 changed files with 58 additions and 88 deletions

View File

@ -23,102 +23,72 @@ func (this* repairNft) unInit() {
} }
func (this* repairNft) processNft() { func (this* repairNft) processNft() {
var lastIdx int64 f5.GetGoStyleDb().LoopLoad(
for true { constant.BCNFT_DB,
hasNextData := false func (lastIdx int64) string {
sql := fmt.Sprintf(` sql := fmt.Sprintf(`
SELECT * FROM nft WHERE idx > %d AND item_id = 0 LIMIT 1000`, SELECT * FROM nft WHERE idx > %d AND item_id = 0 LIMIT 1000`,
lastIdx, lastIdx,
) )
f5.GetGoStyleDb().RawQuery( return sql
constant.BCNFT_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 func (ds *f5.DataSet) bool {
} return true
hasNextData = true })
}
}
})
if hasNextData {
time.Sleep(time.Second * 10)
} else {
lastIdx = 0
time.Sleep(time.Second * 60 * 5)
}
}
} }
func (this* repairNft) processOrder() { func (this* repairNft) processOrder() {
var lastIdx int64 f5.GetGoStyleDb().LoopLoad(
for true { constant.BCNFT_DB,
hasNextData := false func (lastIdx int64) string {
sql := fmt.Sprintf(` sql := fmt.Sprintf(`
SELECT * FROM nft WHERE idx > %d AND item_id = 0 LIMIT 1000`, SELECT * FROM nft WHERE idx > %d AND item_id = 0 LIMIT 1000`,
lastIdx, lastIdx,
) )
f5.GetGoStyleDb().RawQuery( return sql
constant.BCNFT_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 func (ds *f5.DataSet) bool {
} return true
hasNextData = true })
}
}
})
if hasNextData {
time.Sleep(time.Second * 10)
} else {
lastIdx = 0
time.Sleep(time.Second * 60 * 5)
}
}
} }
func (this* repairNft) processSale() { func (this* repairNft) processSale() {
var lastIdx int64 f5.GetGoStyleDb().LoopLoad(
for true { constant.BCNFT_DB,
hasNextData := false func (lastIdx int64) string {
sql := fmt.Sprintf(` sql := fmt.Sprintf(`
SELECT * FROM nft WHERE idx > %d AND item_id = 0 LIMIT 1000`, SELECT * FROM nft WHERE idx > %d AND item_id = 0 LIMIT 1000`,
lastIdx, lastIdx,
) )
f5.GetGoStyleDb().RawQuery( return sql
constant.BCNFT_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 func (ds *f5.DataSet) bool {
} return true
hasNextData = true })
}
}
})
if hasNextData {
time.Sleep(time.Second * 10)
} else {
lastIdx = 0
time.Sleep(time.Second * 60 * 5)
}
}
} }
func (this* repairNft) getItemIdHeroQuality(netId int32, contractAddress string, tokenId string, func (this* repairNft) getItemIdHeroQuality(netId int32, contractAddress string, tokenId string,

2
third_party/f5 vendored

@ -1 +1 @@
Subproject commit 330f53df3d6143867c0d78d97cdfb8bbd6c42ebb Subproject commit 04c7b77bd79f7ce2dd706bc0ee3deb18d7bc7fd9