huangjiajun 5 місяці тому
джерело
коміт
65522de4a7
1 змінених файлів з 17 додано та 17 видалено
  1. +17
    -17
      lib/comm_plan/all.go

+ 17
- 17
lib/comm_plan/all.go Переглянути файл

@@ -53,10 +53,10 @@ func CalReturnAmountAndRatio(level, ownbuyReturnType, peerNum int, userType stri
amountList[i].Val = 0
}
}
commission = zhios_order_relate_utils.FloatFormat(commission, 3)
commission = zhios_order_relate_utils.FloatFormat(commission, 8)

for i, coin := range amountList {
amountList[i].Val = zhios_order_relate_utils.FloatFormat(coin.Val, 6)
amountList[i].Val = zhios_order_relate_utils.FloatFormat(coin.Val, 8)
}

return commission, commissionRatio, amountList, ratioList
@@ -165,7 +165,7 @@ func CalcAll(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUser,
restAmtList, _ = CalVirtualCommissionMinus(totalAmtList, amountList)
// 累计比例
accumulateRatioList = ratioList
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 3)
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 8)

Loop:
for node.ParentUser != nil { //查找上级用户
@@ -249,7 +249,7 @@ func sameMoney(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, res
//极差返利
if opt.UserRate[lv].PayMode == 0 && isOnlySubsidy == 0 {
restAmt -= profit // 剩余可分
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 3)
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 8)
peerRate += restRatio
totalRatio += restRatio
} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的
@@ -260,8 +260,8 @@ func sameMoney(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, res
return profit, restAmt, totalRatio, subsidyFee, peerRate, true
}
restAmt -= subsidyFee // 剩余可分
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 3)
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyBili, 6)
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 8)
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyBili, 8)
}
}
return profit, restAmt, totalRatio, peerRate, subsidyFee, false
@@ -283,7 +283,7 @@ func sameMoneyWinery(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRati
//极差返利
if opt.UserRate[lv].PayMode == 0 && isOnlySubsidy == 0 {
restAmt -= profit // 剩余可分
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2)
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 8)
peerRate += restRatio
//totalRatio += restRatio
} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的
@@ -294,7 +294,7 @@ func sameMoneyWinery(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRati
return profit, restAmt, totalRatio, subsidyFee, peerRate, true
}
restAmt -= subsidyFee // 剩余可分
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2)
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 8)
//totalRatio += zhios_order_relate_utils.FloatFormat(subsidyBili, 6)
}
}
@@ -492,7 +492,7 @@ func sameMoneyV2Winery(lv, isOnlySubsidy int, totalAmtList, restAmtList, profitL
func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt, teamRatio, totalRatio, peerRate, subsidyFee, subsidyRatio float64) (float64, float64, float64, float64, bool) {
// 如果是团队内部支出团队比例大于同级累计比例 或站长支出
if payMode == 1 || teamRatio > peerRate {
teamRatio = zhios_order_relate_utils.FloatFormat(teamRatio-totalRatio, 6)
teamRatio = zhios_order_relate_utils.FloatFormat(teamRatio-totalRatio, 8)
}
//极差返利
if isOnlySubsidy == 0 {
@@ -502,7 +502,7 @@ func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt
profit = 0
return profit, restAmt, totalRatio, subsidyFee, true
}
profit = zhios_order_relate_utils.FloatFormat(teamRatio*totalAmt, 3)
profit = zhios_order_relate_utils.FloatFormat(teamRatio*totalAmt, 8)
if restAmt < profit {
profit = 0
return profit, restAmt, totalRatio, subsidyFee, true
@@ -510,7 +510,7 @@ func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt
restAmt -= profit // 剩余可分

} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyRatio, 6)
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyRatio, 8)
profit = 0
if restAmt < subsidyFee {
profit = 0
@@ -519,7 +519,7 @@ func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt
}
restAmt -= subsidyFee // 剩余可分
}
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 3)
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 8)
return profit, restAmt, totalRatio, subsidyFee, false
}

@@ -540,7 +540,7 @@ func teamDiffMoneyV2(profitList []*VirtualCoinCommission, payMode, isOnlySubsidy
for _, coin := range profitList {
// 如果是团队内部支出团队比例大于同级累计比例 或站长支出
if payMode == 1 || teamRatioMap[coin.Cid] > peerRateMap[coin.Cid] {
teamRatioMap[coin.Cid] = zhios_order_relate_utils.FloatFormat(teamRatioMap[coin.Cid]-totalRatioMap[coin.Cid], 6)
teamRatioMap[coin.Cid] = zhios_order_relate_utils.FloatFormat(teamRatioMap[coin.Cid]-totalRatioMap[coin.Cid], 8)
}

if isOnlySubsidy == 0 {
@@ -548,7 +548,7 @@ func teamDiffMoneyV2(profitList []*VirtualCoinCommission, payMode, isOnlySubsidy

profitOne := &VirtualCoinCommission{}
profitOne.Cid = coin.Cid
profitOne.Val = zhios_order_relate_utils.FloatFormat(totalAmtMap[coin.Cid]*teamRatioMap[coin.Cid], 6)
profitOne.Val = zhios_order_relate_utils.FloatFormat(totalAmtMap[coin.Cid]*teamRatioMap[coin.Cid], 8)
// 剩余不足或比例小于0
if teamRatioMap[coin.Cid] < 0 || restAmtMap[coin.Cid] < profitOne.Val {
zeroList[coin.Cid] = struct{}{}
@@ -558,7 +558,7 @@ func teamDiffMoneyV2(profitList []*VirtualCoinCommission, payMode, isOnlySubsidy

restAmtMap[coin.Cid] -= profitOne.Val
} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的
totalRatioMap[coin.Cid] += zhios_order_relate_utils.FloatFormat(subsidyRatioMap[coin.Cid], 6)
totalRatioMap[coin.Cid] += zhios_order_relate_utils.FloatFormat(subsidyRatioMap[coin.Cid], 8)
profitMap[coin.Cid] = 0
if restAmtMap[coin.Cid] < subsidyFeeMap[coin.Cid] {
subsidyFeeMap[coin.Cid] = 0
@@ -708,9 +708,9 @@ func commSubsidy(opt *PlanOpt, totalAmt, integralTotalAmt float64, lvuser *LvUse
}
}
}
subsidyFee = zhios_order_relate_utils.FloatFormat(subsidyFee, 2)
subsidyFee = zhios_order_relate_utils.FloatFormat(subsidyFee, 8)
for i, coin := range subsidyFeeList {
subsidyFeeList[i].Val = zhios_order_relate_utils.FloatFormat(subsidyFeeList[i].Val, 6)
subsidyFeeList[i].Val = zhios_order_relate_utils.FloatFormat(subsidyFeeList[i].Val, 8)
if coin.Cid == "0" {
subsidyFee += coin.Val // 添加上额外补贴到外部的补贴金额
}


Завантаження…
Відмінити
Зберегти