Browse Source

update 区块星链

tags/v3.3.0
DengBiao 2 years ago
parent
commit
0e7c01d68d
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      rule/block_star_chain_settlement.go

+ 7
- 6
rule/block_star_chain_settlement.go View File

@@ -72,16 +72,17 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string, isTask bool)
//3、判断今日是否有系统销毁 //3、判断今日是否有系统销毁
var destroyCoinForSystem string var destroyCoinForSystem string
if todayPublishCoin != 0 && todayPublishCoin != nowEverydayPublishCoin { 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() _ = session.Rollback()
return errors.New("当前\"今日区块币发行数量\"大于\"当前每日区块币发行数量\"") 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 { if err != nil {
_ = session.Rollback() _ = session.Rollback()
return err return err
} }
destroyCoinForSystem = zhios_order_relate_utils.Float64ToStrPrec10(destroyCoinForSystemValue)
nowEverydayPublishCoin = todayPublishCoin nowEverydayPublishCoin = todayPublishCoin
} }


@@ -635,7 +636,7 @@ func DealDestroyCoin(session *xorm.Session, kind int, amount float64, title stri
blockStarChainFlow.BeforeTotalNowCoin = chain.TotalNowCoin blockStarChainFlow.BeforeTotalNowCoin = chain.TotalNowCoin
blockStarChainFlow.AfterTotalNowCoin = chain.TotalNowCoin blockStarChainFlow.AfterTotalNowCoin = chain.TotalNowCoin
blockStarChainFlow.BeforeTotalRemainderCoin = chain.TotalRemainderCoin 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.BeforeTotalPublishCoin = chain.TotalPublishCoin
blockStarChainFlow.AfterTotalPublishCoin = chain.TotalPublishCoin blockStarChainFlow.AfterTotalPublishCoin = chain.TotalPublishCoin
blockStarChainFlow.BeforeTotalDestroyCoin = chain.TotalDestroyCoin blockStarChainFlow.BeforeTotalDestroyCoin = chain.TotalDestroyCoin
@@ -734,8 +735,8 @@ func DealDestroyCoin(session *xorm.Session, kind int, amount float64, title stri
} }


chain.TotalNowCoin = blockStarChainFlow.AfterTotalNowCoin chain.TotalNowCoin = blockStarChainFlow.AfterTotalNowCoin
chain.TotalRemainderCoin = blockStarChainFlow.AfterTotalRemainderCoin
chain.TotalPublishCoin = blockStarChainFlow.AfterTotalPublishCoin
//chain.TotalRemainderCoin = blockStarChainFlow.AfterTotalRemainderCoin
//chain.TotalPublishCoin = blockStarChainFlow.AfterTotalPublishCoin
chain.TotalDestroyCoin = blockStarChainFlow.AfterTotalDestroyCoin chain.TotalDestroyCoin = blockStarChainFlow.AfterTotalDestroyCoin
//更新 `block_star_chain` 表 //更新 `block_star_chain` 表
_, err := db.BlockStarChainUpdate(session, chain.Id, chain) _, err := db.BlockStarChainUpdate(session, chain.Id, chain)


Loading…
Cancel
Save