1
This commit is contained in:
parent
e433499ca5
commit
360c4615c3
@ -19,6 +19,14 @@ type accountStacking struct {
|
|||||||
nfts []*jccommon.NftStacking
|
nfts []*jccommon.NftStacking
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this* accountStacking) calcScore() int64 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this* accountStacking) getNftJsonData() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (this* contribution) init() {
|
func (this* contribution) init() {
|
||||||
this.lockMetas = []*mt.Contract{}
|
this.lockMetas = []*mt.Contract{}
|
||||||
mt.Table.Contract.Traverse(func (ele *mt.Contract) bool {
|
mt.Table.Contract.Traverse(func (ele *mt.Contract) bool {
|
||||||
@ -84,7 +92,7 @@ func (this* contribution) internalStat(statTime int64, nowTime int64) bool {
|
|||||||
}
|
}
|
||||||
q5.AppendSlice(¶ms, lockMeta.GetAddress())
|
q5.AppendSlice(¶ms, lockMeta.GetAddress())
|
||||||
}
|
}
|
||||||
sqlTpl += ") LIMIT 1000"
|
sqlTpl += ") ORDER BY idx LIMIT 1000"
|
||||||
}
|
}
|
||||||
err := f5.GetGoStyleDb().BatchLoadFullTable(
|
err := f5.GetGoStyleDb().BatchLoadFullTable(
|
||||||
constant.BCNFT_DB,
|
constant.BCNFT_DB,
|
||||||
@ -102,7 +110,7 @@ func (this* contribution) internalStat(statTime int64, nowTime int64) bool {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return this.saveToDb(addressHash)
|
return this.saveToDb(statDaySeconds, addressHash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +127,7 @@ func (this* contribution) calc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this* contribution) isStatEd(statDaySeconds int64) (error, bool) {
|
func (this* contribution) isStatEd(statDaySeconds int64) (error, bool) {
|
||||||
return nil, true
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* contribution) loadFromDb(addressHash *q5.ConcurrentMap[string, *accountStacking],
|
func (this* contribution) loadFromDb(addressHash *q5.ConcurrentMap[string, *accountStacking],
|
||||||
@ -128,6 +136,7 @@ func (this* contribution) loadFromDb(addressHash *q5.ConcurrentMap[string, *acco
|
|||||||
if accountAddress == "" {
|
if accountAddress == "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
ownerAddress := ds.GetByName("owner_address")
|
||||||
p := new(jccommon.NftStacking)
|
p := new(jccommon.NftStacking)
|
||||||
p.NetId = q5.ToInt32(ds.GetByName("net_id"))
|
p.NetId = q5.ToInt32(ds.GetByName("net_id"))
|
||||||
p.ContractAddress = ds.GetByName("contract_address")
|
p.ContractAddress = ds.GetByName("contract_address")
|
||||||
@ -139,7 +148,7 @@ func (this* contribution) loadFromDb(addressHash *q5.ConcurrentMap[string, *acco
|
|||||||
if lockMeta == nil {
|
if lockMeta == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if lockMeta.GetAddress() != p.ContractAddress {
|
if lockMeta.GetAddress() != ownerAddress {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if a, ok := addressHash.Load(accountAddress); ok {
|
if a, ok := addressHash.Load(accountAddress); ok {
|
||||||
@ -149,10 +158,43 @@ func (this* contribution) loadFromDb(addressHash *q5.ConcurrentMap[string, *acco
|
|||||||
a.accountAddress = accountAddress
|
a.accountAddress = accountAddress
|
||||||
a.nfts = []*jccommon.NftStacking{}
|
a.nfts = []*jccommon.NftStacking{}
|
||||||
q5.AppendSlice(&a.nfts, p)
|
q5.AppendSlice(&a.nfts, p)
|
||||||
|
addressHash.Store(accountAddress, a)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* contribution) saveToDb(addressHash *q5.ConcurrentMap[string, *accountStacking]) bool {
|
func (this* contribution) saveToDb(
|
||||||
return true
|
statDaySeconds int64,
|
||||||
|
addressHash *q5.ConcurrentMap[string, *accountStacking]) bool {
|
||||||
|
var resultErr error
|
||||||
|
nowTime := f5.GetApp().GetRealSeconds()
|
||||||
|
addressHash.Range(func (k string, v *accountStacking) bool {
|
||||||
|
score := v.calcScore()
|
||||||
|
nftData := v.getNftJsonData()
|
||||||
|
f5.GetGoStyleDb().Upsert(
|
||||||
|
constant.BCNFT_DB,
|
||||||
|
"t_staking_daily_settlement",
|
||||||
|
[][]string{
|
||||||
|
{"account_address", v.accountAddress},
|
||||||
|
{"settle_date", q5.ToString(statDaySeconds)},
|
||||||
|
},
|
||||||
|
[][]string{
|
||||||
|
{"last_contribution", q5.ToString(score)},
|
||||||
|
{"last_nft_data", nftData},
|
||||||
|
{"modifytime", q5.ToString(nowTime)},
|
||||||
|
},
|
||||||
|
[][]string{
|
||||||
|
{"account_address", v.accountAddress},
|
||||||
|
{"settle_date", q5.ToString(statDaySeconds)},
|
||||||
|
{"contribution", q5.ToString(score)},
|
||||||
|
{"nft_data", nftData},
|
||||||
|
{"createtime", q5.ToString(nowTime)},
|
||||||
|
{"modifytime", q5.ToString(nowTime)},
|
||||||
|
},
|
||||||
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
|
resultErr = err
|
||||||
|
})
|
||||||
|
return resultErr == nil
|
||||||
|
})
|
||||||
|
return resultErr == nil
|
||||||
}
|
}
|
||||||
|
2
third_party/f5
vendored
2
third_party/f5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit bc4749825937d2673d23ae61f2c33c6a3fe1abfd
|
Subproject commit 65c7e675815c028e28434950daded77acda44ce5
|
Loading…
x
Reference in New Issue
Block a user