From e15df595d6064e8f85e07c2c45ec298ee08908bd Mon Sep 17 00:00:00 2001 From: yangduo Date: Thu, 26 Sep 2024 15:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/marketserver/api/v1/vip/vip.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/marketserver/api/v1/vip/vip.go b/server/marketserver/api/v1/vip/vip.go index 00aac391..871eb7b8 100644 --- a/server/marketserver/api/v1/vip/vip.go +++ b/server/marketserver/api/v1/vip/vip.go @@ -192,7 +192,8 @@ func (this *VIPApi) Details(c *gin.Context) { } escec_balance, ok := new(big.Int).SetString(balancestr, 10) 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") @@ -201,7 +202,8 @@ func (this *VIPApi) Details(c *gin.Context) { } escec_stacking, ok := new(big.Int).SetString(stackingstr, 10) 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) @@ -212,12 +214,18 @@ func (this *VIPApi) Details(c *gin.Context) { } escec_convert, ok := new(big.Int).SetString(convertstr, 10) 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")) 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 = depositExec.Div(depositExec, new(big.Int).SetInt64(365*24*3600)) if depositExec.Cmp(escec_convert) < 0 {