From 0e7c01d68d959c093d0b494e30bcbed11fef0ca7 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 14 Sep 2022 16:17:53 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=8C=BA=E5=9D=97=E6=98=9F=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rule/block_star_chain_settlement.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rule/block_star_chain_settlement.go b/rule/block_star_chain_settlement.go index 64f94ba..606d081 100644 --- a/rule/block_star_chain_settlement.go +++ b/rule/block_star_chain_settlement.go @@ -72,16 +72,17 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string, isTask bool) //3、判断今日是否有系统销毁 var destroyCoinForSystem string if todayPublishCoin != 0 && todayPublishCoin != nowEverydayPublishCoin { - destroyCoinForSystem, _ := decimal.NewFromFloat(nowEverydayPublishCoin).Sub(decimal.NewFromFloat(todayPublishCoin)).Float64() - if destroyCoinForSystem < 0 { + destroyCoinForSystemValue, _ := decimal.NewFromFloat(nowEverydayPublishCoin).Sub(decimal.NewFromFloat(todayPublishCoin)).Float64() + if destroyCoinForSystemValue < 0 { _ = session.Rollback() return errors.New("当前\"今日区块币发行数量\"大于\"当前每日区块币发行数量\"") } - err := DealDestroyCoin(session, int(enum.SystemDestroy), destroyCoinForSystem, enum.SystemDestroy.String(), blockStarChain) + err := DealDestroyCoin(session, int(enum.SystemDestroy), destroyCoinForSystemValue, enum.SystemDestroy.String(), blockStarChain) if err != nil { _ = session.Rollback() return err } + destroyCoinForSystem = zhios_order_relate_utils.Float64ToStrPrec10(destroyCoinForSystemValue) nowEverydayPublishCoin = todayPublishCoin } @@ -635,7 +636,7 @@ func DealDestroyCoin(session *xorm.Session, kind int, amount float64, title stri blockStarChainFlow.BeforeTotalNowCoin = chain.TotalNowCoin blockStarChainFlow.AfterTotalNowCoin = chain.TotalNowCoin blockStarChainFlow.BeforeTotalRemainderCoin = chain.TotalRemainderCoin - blockStarChainFlow.AfterTotalRemainderCoin = zhios_order_relate_utils.Float64ToStrPrec10(zhios_order_relate_utils.StrToFloat64(chain.TotalRemainderCoin) - amount) + blockStarChainFlow.AfterTotalRemainderCoin = chain.TotalRemainderCoin blockStarChainFlow.BeforeTotalPublishCoin = chain.TotalPublishCoin blockStarChainFlow.AfterTotalPublishCoin = chain.TotalPublishCoin blockStarChainFlow.BeforeTotalDestroyCoin = chain.TotalDestroyCoin @@ -734,8 +735,8 @@ func DealDestroyCoin(session *xorm.Session, kind int, amount float64, title stri } chain.TotalNowCoin = blockStarChainFlow.AfterTotalNowCoin - chain.TotalRemainderCoin = blockStarChainFlow.AfterTotalRemainderCoin - chain.TotalPublishCoin = blockStarChainFlow.AfterTotalPublishCoin + //chain.TotalRemainderCoin = blockStarChainFlow.AfterTotalRemainderCoin + //chain.TotalPublishCoin = blockStarChainFlow.AfterTotalPublishCoin chain.TotalDestroyCoin = blockStarChainFlow.AfterTotalDestroyCoin //更新 `block_star_chain` 表 _, err := db.BlockStarChainUpdate(session, chain.Id, chain)