This commit is contained in:
yangduo 2024-09-23 14:04:58 +08:00
parent 1d6d47d305
commit 2b1ceec576

View File

@ -19,11 +19,12 @@ type accountContribution struct {
} }
func (ac *accountContribution) sum() float64 { func (ac *accountContribution) sum() float64 {
return ac.history + ac.stakingContri + ac.gamecontribution + ac.rechargeContri return ac.history + ac.stakingContri + ac.gamecontribution + ac.rechargeContri
} }
type contribution struct { type contribution struct {
historyContribution float64 historyContribution float64
stakingContribution float64
rechargeContribution float64 rechargeContribution float64
gameContribution float64 gameContribution float64
gcTime int64 gcTime int64
@ -44,7 +45,7 @@ func (this *contribution) unInit() {
} }
func (c *contribution) sum() float64 { func (c *contribution) sum() float64 {
return c.historyContribution + c.rechargeContribution + c.gameContribution return c.historyContribution + c.stakingContribution + c.rechargeContribution + c.gameContribution
} }
func (this *contribution) GetEmailContributionAccountid(email string) (float64, string, error) { func (this *contribution) GetEmailContributionAccountid(email string) (float64, string, error) {
@ -252,8 +253,10 @@ func (this *contribution) GetGlobalContribution(instant bool) (float64, error) {
this.historyContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0)) this.historyContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0))
} }
}) })
}
sql = `SELECT SUM(contribution) FROM t_staking_daily_settlement WHERE idx > 0` if nowseconds := f5.GetApp().GetRealSeconds(); nowseconds > this.gcTime+60 || instant {
sql := `SELECT SUM(contribution) FROM t_staking_daily_settlement WHERE idx > 0`
f5.GetGoStyleDb().RawQuery( f5.GetGoStyleDb().RawQuery(
constant.BCNFT_DB, constant.BCNFT_DB,
sql, sql,
@ -264,14 +267,11 @@ func (this *contribution) GetGlobalContribution(instant bool) (float64, error) {
} }
if ds.Next() { if ds.Next() {
tmp, _ := q5.ToFloat64Ex(ds.GetByIndex(0)) this.stakingContribution, _ = q5.ToFloat64Ex(ds.GetByIndex(0))
this.historyContribution += tmp
} }
}) })
}
if nowseconds := f5.GetApp().GetRealSeconds(); nowseconds > this.gcTime+60 || instant { sql = `SELECT SUM(contribution) FROM t_contribution WHERE idx > 0`
sql := `SELECT SUM(contribution) FROM t_contribution WHERE idx > 0`
f5.GetGoStyleDb().RawQuery( f5.GetGoStyleDb().RawQuery(
constant.GAME_DB, constant.GAME_DB,
sql, sql,