This commit is contained in:
yangduo 2024-09-26 15:19:58 +08:00
parent 5d39a4a29e
commit e15df595d6

View File

@ -192,7 +192,8 @@ func (this *VIPApi) Details(c *gin.Context) {
} }
escec_balance, ok := new(big.Int).SetString(balancestr, 10) escec_balance, ok := new(big.Int).SetString(balancestr, 10)
if !ok { if !ok {
f5.GetSysLog().Warning("escec_balance err:%s", ds.GetByName("escec_balance")) f5.GetSysLog().Warning("%s escec_balance err:%s", accountAddress, ds.GetByName("escec_balance"))
escec_balance = new(big.Int).SetInt64(0)
} }
stackingstr := ds.GetByName("escec_stacking") stackingstr := ds.GetByName("escec_stacking")
@ -201,7 +202,8 @@ func (this *VIPApi) Details(c *gin.Context) {
} }
escec_stacking, ok := new(big.Int).SetString(stackingstr, 10) escec_stacking, ok := new(big.Int).SetString(stackingstr, 10)
if !ok { if !ok {
f5.GetSysLog().Warning("escec_stacking err:%s", ds.GetByName("escec_stacking")) f5.GetSysLog().Warning("%s escec_stacking err:%s", accountAddress, ds.GetByName("escec_stacking"))
escec_stacking = new(big.Int).SetInt64(0)
} }
curExec := new(big.Int).Add(escec_balance, escec_stacking) curExec := new(big.Int).Add(escec_balance, escec_stacking)
@ -212,12 +214,18 @@ func (this *VIPApi) Details(c *gin.Context) {
} }
escec_convert, ok := new(big.Int).SetString(convertstr, 10) escec_convert, ok := new(big.Int).SetString(convertstr, 10)
if !ok { if !ok {
f5.GetSysLog().Warning("escec_convert err:%s", ds.GetByName("escec_convert")) f5.GetSysLog().Warning("%s escec_convert err:%s", accountAddress, ds.GetByName("escec_convert"))
escec_convert = new(big.Int).SetInt64(0)
} }
last_convert_time := q5.SafeToInt64(ds.GetByName("last_convert_time")) last_convert_time := q5.SafeToInt64(ds.GetByName("last_convert_time"))
nowsecs := f5.GetApp().GetRealSeconds() nowsecs := f5.GetApp().GetRealSeconds()
elapse := new(big.Int).SetInt64(nowsecs - last_convert_time) diff := nowsecs - last_convert_time
if diff < 0 {
diff = 0
f5.GetSysLog().Warning("%s last_convert_time err:%s, now:%d", accountAddress, ds.GetByName("last_convert_time"), nowsecs)
}
elapse := new(big.Int).SetInt64(diff)
depositExec := new(big.Int).Mul(escec_convert, elapse) depositExec := new(big.Int).Mul(escec_convert, elapse)
depositExec = depositExec.Div(depositExec, new(big.Int).SetInt64(365*24*3600)) depositExec = depositExec.Div(depositExec, new(big.Int).SetInt64(365*24*3600))
if depositExec.Cmp(escec_convert) < 0 { if depositExec.Cmp(escec_convert) < 0 {