This commit is contained in:
yangduo 2024-08-20 16:18:19 +08:00
parent aa8d1e27cf
commit 27219fdf34

View File

@ -86,6 +86,10 @@ func (this *contribution) GetEmailAccountId(accountAddress string) (string, stri
func (this *contribution) GetAddressContribution(accountAddress string, onlyrecharge bool) (float64, error) {
accinfo, exist := this.accountContributionlist.Load(accountAddress)
var beforcontribution float64 = 0
if exist {
beforcontribution = (*accinfo).contribution
}
if nowseconds := f5.GetApp().GetRealSeconds(); !exist || (*accinfo).gcTime+60 < nowseconds {
if !exist {
info := new(accountContribution)
@ -163,6 +167,7 @@ func (this *contribution) GetAddressContribution(accountAddress string, onlyrech
(*accinfo).loadhistory = true
}
(*accinfo).contribution = 0
if (*accinfo).accountid != "" {
sql := `SELECT contribution FROM t_contribution WHERE idx > 0 AND account_id = ?`
f5.GetGoStyleDb().RawQuery(
@ -200,12 +205,12 @@ func (this *contribution) GetAddressContribution(accountAddress string, onlyrech
if ds.Next() {
tmp, _ := q5.ToFloat64Ex(ds.GetByIndex(0))
(*accinfo).contribution += tmp
(*accinfo).rechargeContri = tmp
}
})
}
(*accinfo).contribution += (*accinfo).rechargeContri
(*accinfo).contribution += (*accinfo).history
(*accinfo).gcTime = nowseconds
if (*accinfo).loweremail != "" {
@ -213,7 +218,7 @@ func (this *contribution) GetAddressContribution(accountAddress string, onlyrech
}
}
if beforcontribution != (*accinfo).contribution {
if beforcontribution > 0.000001 && (*accinfo).contribution > beforcontribution+0.000001 {
this.GetGlobalContribution(true)
}