fix
This commit is contained in:
parent
5f862d5c3f
commit
bcfba92459
@ -188,35 +188,38 @@ func (this *VIPApi) Details(c *gin.Context) {
|
||||
cfg := mt.Table.StakingVip.GetById(q5.SafeToInt64(rspObj.Info.Level))
|
||||
if cfg != nil {
|
||||
rspObj.Info.Target = cfg.GetThisPoint()
|
||||
bigintobj := new(big.Int)
|
||||
escec_balance, ok := bigintobj.SetString(ds.GetByName("escec_balance"), 10)
|
||||
escec_balance, ok := new(big.Int).SetString(ds.GetByName("escec_balance"), 10)
|
||||
if !ok {
|
||||
f5.GetSysLog().Warning("escec_balance err:%s", ds.GetByName("escec_balance"))
|
||||
}
|
||||
|
||||
escec_stacking, ok := bigintobj.SetString(ds.GetByName("escec_stacking"), 10)
|
||||
escec_stacking, ok := new(big.Int).SetString(ds.GetByName("escec_stacking"), 10)
|
||||
if !ok {
|
||||
f5.GetSysLog().Warning("escec_stacking err:%s", ds.GetByName("escec_stacking"))
|
||||
}
|
||||
|
||||
curExec := bigintobj.Add(escec_balance, escec_stacking)
|
||||
curExec := new(big.Int).Add(escec_balance, escec_stacking)
|
||||
|
||||
escec_convert, ok := bigintobj.SetString(ds.GetByName("escec_convert"), 10)
|
||||
escec_convert, ok := new(big.Int).SetString(ds.GetByName("escec_convert"), 10)
|
||||
if !ok {
|
||||
f5.GetSysLog().Warning("escec_convert err:%s", ds.GetByName("escec_convert"))
|
||||
}
|
||||
|
||||
last_convert_time := q5.SafeToInt64(ds.GetByName("last_convert_time"))
|
||||
nowsecs := f5.GetApp().GetRealSeconds()
|
||||
elaspse := bigintobj.SetInt64(nowsecs - last_convert_time)
|
||||
depositExec := bigintobj.Mul(escec_convert, elaspse)
|
||||
depositExec = bigintobj.Div(depositExec, bigintobj.SetInt64(365*24*3600))
|
||||
depositExec = bigintobj.Sub(escec_convert, depositExec)
|
||||
curExec = bigintobj.Add(curExec, depositExec)
|
||||
convercurExec := bigintobj.Div(curExec, bigintobj.SetInt64(10^18)).Int64()
|
||||
elapse := new(big.Int).SetInt64(nowsecs - last_convert_time)
|
||||
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 {
|
||||
depositExec = new(big.Int).Sub(escec_convert, depositExec)
|
||||
} else {
|
||||
depositExec.SetInt64(0)
|
||||
}
|
||||
curExec = curExec.Add(curExec, depositExec)
|
||||
convercurExec := new(big.Int).Div(curExec, new(big.Int).SetInt64(1000*1000*1000*1000*1000*1000)).Int64()
|
||||
nextlvcfg := mt.Table.StakingVip.GetById(q5.SafeToInt64(rspObj.Info.Level + 1))
|
||||
if nextlvcfg != nil && convercurExec >= cfg.GetRequire() {
|
||||
rspObj.Info.Cur = cfg.GetThisPoint() * (convercurExec - cfg.GetRequire()) /(nextlvcfg.GetRequire() - cfg.GetRequire())
|
||||
rspObj.Info.Cur = cfg.GetThisPoint() * (convercurExec - cfg.GetRequire()) / (nextlvcfg.GetRequire() - cfg.GetRequire())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user