Преглед на файлове

update 绿色积分

tags/v3.7.6
DengBiao преди 1 година
родител
ревизия
6bad4cacdb
променени са 1 файла, в които са добавени 14 реда и са изтрити 14 реда
  1. +14
    -14
      rule/block_green_chain_settlement.go

+ 14
- 14
rule/block_green_chain_settlement.go Целия файл

@@ -144,12 +144,11 @@ func DailySettlementBlockGreenChain(engine *xorm.Engine, mid string, isTask bool
}

//5、进行空投区-区块币统计分配
destroyCoinForAirdrop := 3522.00
//err, destroyCoinForAirdrop := statisticsAndDistributeCoinForAirdrop(session, mid, airdropAreaCoinNums, blockGreenChain)
//if err != nil {
// _ = session.Rollback()
// return err
//}
err, destroyCoinForAirdrop := statisticsAndDistributeCoinForAirdrop(session, mid, airdropAreaCoinNums, blockGreenChain)
if err != nil {
_ = session.Rollback()
return err
}

//6、插入 block_star_chain_settlement_records 记录
var blockGreenChainSettlementRecords = model.BlockGreenChainSettlementRecords{
@@ -226,9 +225,9 @@ func DailySettlementBlockGreenChain(engine *xorm.Engine, mid string, isTask bool
TODO:: 公式【 个人贡献值/全网贡献值x2100枚=每天获取的绿色积分 】
*/
func statisticsAndDistributeCoinForConsume(session *xorm.Session, userIds []int, mid string, publishCoin float64, chain *model.BlockGreenChain) (err error, unassignedTotalCoinValue float64) {
publishCoinValue := decimal.NewFromFloat(publishCoin) //消费区发行区块币数量
platformGuidePriceForCoinValue := decimal.NewFromFloat(zhios_order_relate_utils.StrToFloat64(chain.PlatformGuidePriceForCoin)) //今日平台区块币指导价
var unassignedTotalCoin = decimal.NewFromFloat(0) //分配的区块币
publishCoinValue := decimal.NewFromFloat(publishCoin) //消费区发行区块币数量
//platformGuidePriceForCoinValue := decimal.NewFromFloat(zhios_order_relate_utils.StrToFloat64(chain.PlatformGuidePriceForCoin)) //今日平台区块币指导价
var unassignedTotalCoin = decimal.NewFromFloat(0) //分配的区块币
var userVirtualAmount model.UserVirtualAmount
var userVirtualAmounts []model.UserVirtualAmount
//1、统计出消费区的总贡献值
@@ -247,7 +246,8 @@ func statisticsAndDistributeCoinForConsume(session *xorm.Session, userIds []int,
for _, item := range userVirtualAmounts {
amount := decimal.NewFromFloat(zhios_order_relate_utils.StrToFloat64(item.Amount)) //用户贡献值余额
getCoin := amount.Div(sumStaticValue).Mul(publishCoinValue) //得到的区块币
needDestroyContribution := getCoin.Mul(platformGuidePriceForCoinValue) //需销毁贡献值
//needDestroyContribution := getCoin.Mul(platformGuidePriceForCoinValue) //需销毁贡献值
needDestroyContribution := amount //需销毁贡献值

coinAmount, err := svc.GetUserCoinAmount(session, mid, chain.Coin2, item.Uid) //获取此时用户的"贡献值"
if err != nil {
@@ -257,9 +257,9 @@ func statisticsAndDistributeCoinForConsume(session *xorm.Session, userIds []int,

//3.1判断静态贡献值是否足够
if needDestroyContribution.GreaterThan(coinAmountValue) {
//TODO::公式【得到的区块币 = ((需销毁贡献值 - 用户贡献值余额) / 今日平台区块币指导价)】
tempCoin := (needDestroyContribution.Sub(coinAmountValue)).Div(platformGuidePriceForCoinValue)
getCoin = getCoin.Sub(tempCoin)
////TODO::公式【得到的区块币 = ((需销毁贡献值 - 用户贡献值余额) / 今日平台区块币指导价)】
//tempCoin := (needDestroyContribution.Sub(coinAmountValue)).Div(platformGuidePriceForCoinValue)
//getCoin = getCoin.Sub(tempCoin)
needDestroyContribution = coinAmountValue
}
unassignedTotalCoin = unassignedTotalCoin.Add(getCoin)
@@ -325,7 +325,7 @@ func statisticsAndDistributeCoinForAirdrop(session *xorm.Session, mid string, pu
for _, item := range userList {
var singleValue = decimal.NewFromFloat(0)

if item.AirdropDate != "0000-00" {
if item.AirdropDate != "0000-00-00" {
startAt, err := time.ParseInLocation("2006-01-02", chain.StartAt, time.Local) //起始时间
if err != nil {
return err, unassignedTotalCoinValue


Зареждане…
Отказ
Запис