Browse Source

add 区块星链

tags/v1.9.6
DengBiao 2 years ago
parent
commit
f5c58ca2eb
1 changed files with 18 additions and 8 deletions
  1. +18
    -8
      rule/block_star_chain_settlement.go

+ 18
- 8
rule/block_star_chain_settlement.go View File

@@ -45,7 +45,7 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
})
if err != nil {
_ = session.Rollback()
return
return err
}
//initialCoinTotal := zhios_order_relate_utils.StrToFloat64(blockStarChain.InitialCoinTotal) //初始区块币总量
todayPublishCoin := zhios_order_relate_utils.StrToFloat64(blockStarChain.TodayPublishCoin) //今日区块币发行数量(若为0,则按当前每日区块币发行数量)
@@ -68,7 +68,7 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
err = dealIssueCoin(session, int(enum.SystemDestroy), publishCoin, enum.SystemTimingIssue.String(), blockStarChain)
if err != nil {
_ = session.Rollback()
return
return err
}

//4、进行静态区-区块币统计分配
@@ -79,7 +79,7 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
err, destroyCoinForStatic := statisticsAndDistributeCoinForStatic(session, mid, staticAreaCoinNums, *blockStarChain)
if err != nil {
_ = session.Rollback()
return
return err
}

//5、进行动态区-区块币统计分配
@@ -90,7 +90,7 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
err, destroyCoinForDynamic := statisticsAndDistributeCoinForDynamic(session, mid, dynamicAreaCoinNums, *blockStarChain)
if err != nil {
_ = session.Rollback()
return
return err
}

//6、进行运营中心-区块币统计 TODO::未完成分配
@@ -98,12 +98,22 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
publishCoinOperationCenterRate, _ := decimal.NewFromString(blockStarChain.PublishCoinOperationCenterRate) //区块币发行动态占比
publishCoinOperationCenterRate = publishCoinOperationCenterRate.Div(decimal.NewFromFloat(100))
operationCenterCoinNums = zhios_order_relate_utils.StrToFloat64(decimal.NewFromFloat(publishCoin).Mul(publishCoinOperationCenterRate).String())
err, destroyCoinForOperationCenter := statisticsAndDistributeCoinForOperationCenter(session, mid, operationCenterCoinNums, *blockStarChain)
if err != nil {
_ = session.Rollback()
return err
}

//7、进行其他-区块币统计 TODO::未完成分配
var otherCoinNums float64 //动态区分配区块币总数
publishCoinOperationOtherRate, _ := decimal.NewFromString(blockStarChain.PublishCoinOperationOtherRate) //区块币发行动态占比
publishCoinOperationOtherRate = publishCoinOperationOtherRate.Div(decimal.NewFromFloat(100))
otherCoinNums = zhios_order_relate_utils.StrToFloat64(decimal.NewFromFloat(publishCoin).Mul(publishCoinOperationOtherRate).String())
err, destroyCoinForOther := statisticsAndDistributeCoinForOther(session, mid, otherCoinNums, *blockStarChain)
if err != nil {
_ = session.Rollback()
return err
}

//8、插入 block_star_chain_settlement_records 记录
var blockStarChainSettlementRecords = model.BlockStarChainSettlementRecords{
@@ -115,9 +125,9 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
TodayPublishCoinForDynamic: zhios_order_relate_utils.Float64ToStr(dynamicAreaCoinNums),
TodayDestroyCoinForDynamic: zhios_order_relate_utils.Float64ToStr(destroyCoinForDynamic),
TodayPublishCoinForOperationCenter: zhios_order_relate_utils.Float64ToStr(operationCenterCoinNums),
TodayDestroyCoinForOperationCenter: "",
TodayDestroyCoinForOperationCenter: zhios_order_relate_utils.Float64ToStr(destroyCoinForOperationCenter),
TodayPublishCoinForOther: zhios_order_relate_utils.Float64ToStr(otherCoinNums),
TodayDestroyCoinForOther: "",
TodayDestroyCoinForOther: zhios_order_relate_utils.Float64ToStr(destroyCoinForOther),
Date: now.Format("2006-01"),
CreateAt: now,
UpdateAt: now,
@@ -125,14 +135,14 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
_, err = db.BlockStarChainSettlementRecordsInsert(session, &blockStarChainSettlementRecords)
if err != nil {
_ = session.Rollback()
return
return err
}

//6、计算当前每日区块币应发行数量
err = calcNowEverydayPublishCoin(session, *blockStarChain)
if err != nil {
_ = session.Rollback()
return
return err
}
return nil
}


Loading…
Cancel
Save