|
|
@@ -239,9 +239,9 @@ func statisticsAndDistributeCoinForStatic(session *xorm.Session, userIds []int, |
|
|
|
//TODO::公式【得到的区块币 = ((需销毁贡献值 - 用户贡献值余额) / 今日平台区块币指导价)】 |
|
|
|
tempCoin := (needDestroyContribution.Sub(coinAmountValue)).Div(platformGuidePriceForCoinValue) |
|
|
|
getCoin = getCoin.Sub(tempCoin) |
|
|
|
unassignedTotalCoin.Add(getCoin) |
|
|
|
needDestroyContribution = coinAmountValue |
|
|
|
} |
|
|
|
unassignedTotalCoin.Add(getCoin) |
|
|
|
|
|
|
|
//3.2给相应用户加上分配到的虚拟币 |
|
|
|
err = DealUserCoin(session, md.DealUserCoinReq{ |
|
|
@@ -275,9 +275,7 @@ func statisticsAndDistributeCoinForStatic(session *xorm.Session, userIds []int, |
|
|
|
} |
|
|
|
|
|
|
|
//4、处理未分配完的区块币-静态区 |
|
|
|
//unassignedTotalCoinValue = zhios_order_relate_utils.StrToFloat64(unassignedTotalCoin.String()) |
|
|
|
if publishCoinValue.GreaterThan(unassignedTotalCoin) { |
|
|
|
//if unassignedTotalCoinValue > 0 { |
|
|
|
unassignedTotalCoinValue, _ = publishCoinValue.Sub(unassignedTotalCoin).Float64() |
|
|
|
err := DealDestroyCoin(session, int(enum.StaticUnallocatedAndDestroy), unassignedTotalCoinValue, enum.StaticUnallocatedAndDestroy.String(), chain) |
|
|
|
if err != nil { |
|
|
@@ -327,9 +325,9 @@ func statisticsAndDistributeCoinForDynamic(session *xorm.Session, userIds []int, |
|
|
|
//TODO::公式【得到的区块币 - ((需销毁贡献值 - 用户贡献值余额) / 今日平台区块币指导价)】 |
|
|
|
tempCoin := (needDestroyContribution.Sub(coinAmountValue)).Div(platformGuidePriceForCoinValue) |
|
|
|
getCoin = getCoin.Sub(tempCoin) |
|
|
|
unassignedTotalCoin.Add(getCoin) |
|
|
|
needDestroyContribution = coinAmountValue |
|
|
|
} |
|
|
|
unassignedTotalCoin.Add(getCoin) |
|
|
|
|
|
|
|
//3.2给相应用户加上分配到的虚拟币 |
|
|
|
err = DealUserCoin(session, md.DealUserCoinReq{ |
|
|
@@ -363,9 +361,7 @@ func statisticsAndDistributeCoinForDynamic(session *xorm.Session, userIds []int, |
|
|
|
} |
|
|
|
|
|
|
|
//4、处理未分配完的区块币-动态区 |
|
|
|
//unassignedTotalCoinValue = zhios_order_relate_utils.StrToFloat64(unassignedTotalCoin.String()) |
|
|
|
if publishCoinValue.GreaterThan(unassignedTotalCoin) { |
|
|
|
//if unassignedTotalCoinValue > 0 { |
|
|
|
unassignedTotalCoinValue, _ = publishCoinValue.Sub(unassignedTotalCoin).Float64() |
|
|
|
err := DealDestroyCoin(session, int(enum.DynamicallyUnallocatedAndDestroy), unassignedTotalCoinValue, enum.DynamicallyUnallocatedAndDestroy.String(), chain) |
|
|
|
if err != nil { |
|
|
@@ -452,7 +448,7 @@ func statisticsAndDistributeCoinForOperationCenter(session *xorm.Session, mid st |
|
|
|
//4、处理未分配完的区块币-运营中心 |
|
|
|
unassignedTotalCoinValue, _ = publishCoinValue.Sub(totalCoin).Float64() |
|
|
|
if unassignedTotalCoinValue > 0 { |
|
|
|
err := DealDestroyCoin(session, int(enum.OtherUnallocatedAndDestroy), unassignedTotalCoinValue, enum.OtherUnallocatedAndDestroy.String(), chain) |
|
|
|
err := DealDestroyCoin(session, int(enum.OperationCenterUnallocatedAndDestroy), unassignedTotalCoinValue, enum.OperationCenterUnallocatedAndDestroy.String(), chain) |
|
|
|
if err != nil { |
|
|
|
return err, unassignedTotalCoinValue |
|
|
|
} |
|
|
|