|
@@ -51,7 +51,7 @@ func CalReturnAmountAndRatio(level, ownbuyReturnType, peerNum int, userType stri |
|
|
amountList[i].Val = 0 |
|
|
amountList[i].Val = 0 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
commission = zhios_order_relate_utils.FloatFormat(commission, 6) |
|
|
|
|
|
|
|
|
commission = zhios_order_relate_utils.FloatFormat(commission, 2) |
|
|
|
|
|
|
|
|
for i, coin := range amountList { |
|
|
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, 6) |
|
@@ -163,7 +163,7 @@ func CalcAll(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUser, |
|
|
restAmtList, _ = CalVirtualCommissionMinus(totalAmtList, amountList) |
|
|
restAmtList, _ = CalVirtualCommissionMinus(totalAmtList, amountList) |
|
|
// 累计比例 |
|
|
// 累计比例 |
|
|
accumulateRatioList = ratioList |
|
|
accumulateRatioList = ratioList |
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) |
|
|
|
|
|
|
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) |
|
|
|
|
|
|
|
|
Loop: |
|
|
Loop: |
|
|
for node.ParentUser != nil { //查找上级用户 |
|
|
for node.ParentUser != nil { //查找上级用户 |
|
@@ -247,7 +247,7 @@ func sameMoney(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, res |
|
|
//极差返利 |
|
|
//极差返利 |
|
|
if opt.UserRate[lv].PayMode == 0 && isOnlySubsidy == 0 { |
|
|
if opt.UserRate[lv].PayMode == 0 && isOnlySubsidy == 0 { |
|
|
restAmt -= profit // 剩余可分 |
|
|
restAmt -= profit // 剩余可分 |
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) |
|
|
|
|
|
|
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) |
|
|
peerRate += restRatio |
|
|
peerRate += restRatio |
|
|
totalRatio += restRatio |
|
|
totalRatio += restRatio |
|
|
} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的 |
|
|
} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的 |
|
@@ -258,8 +258,8 @@ func sameMoney(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, res |
|
|
return profit, restAmt, totalRatio, subsidyFee, peerRate, true |
|
|
return profit, restAmt, totalRatio, subsidyFee, peerRate, true |
|
|
} |
|
|
} |
|
|
restAmt -= subsidyFee // 剩余可分 |
|
|
restAmt -= subsidyFee // 剩余可分 |
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) |
|
|
|
|
|
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyBili, 6) |
|
|
|
|
|
|
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) |
|
|
|
|
|
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyBili, 2) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return profit, restAmt, totalRatio, peerRate, subsidyFee, false |
|
|
return profit, restAmt, totalRatio, peerRate, subsidyFee, false |
|
@@ -363,7 +363,7 @@ func sameMoneyV2(lv, isOnlySubsidy int, totalAmtList, restAmtList, profitList, p |
|
|
func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt, teamRatio, totalRatio, peerRate, subsidyFee, subsidyRatio float64) (float64, float64, float64, float64, bool) { |
|
|
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 { |
|
|
if payMode == 1 || teamRatio > peerRate { |
|
|
teamRatio = zhios_order_relate_utils.FloatFormat(teamRatio-totalRatio, 6) |
|
|
|
|
|
|
|
|
teamRatio = zhios_order_relate_utils.FloatFormat(teamRatio-totalRatio, 2) |
|
|
} |
|
|
} |
|
|
//极差返利 |
|
|
//极差返利 |
|
|
if isOnlySubsidy == 0 { |
|
|
if isOnlySubsidy == 0 { |
|
@@ -373,7 +373,7 @@ func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt |
|
|
profit = 0 |
|
|
profit = 0 |
|
|
return profit, restAmt, totalRatio, subsidyFee, true |
|
|
return profit, restAmt, totalRatio, subsidyFee, true |
|
|
} |
|
|
} |
|
|
profit = zhios_order_relate_utils.FloatFormat(teamRatio*totalAmt, 6) |
|
|
|
|
|
|
|
|
profit = zhios_order_relate_utils.FloatFormat(teamRatio*totalAmt, 2) |
|
|
if restAmt < profit { |
|
|
if restAmt < profit { |
|
|
profit = 0 |
|
|
profit = 0 |
|
|
return profit, restAmt, totalRatio, subsidyFee, true |
|
|
return profit, restAmt, totalRatio, subsidyFee, true |
|
@@ -381,7 +381,7 @@ func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt |
|
|
restAmt -= profit // 剩余可分 |
|
|
restAmt -= profit // 剩余可分 |
|
|
|
|
|
|
|
|
} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的 |
|
|
} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的 |
|
|
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyRatio, 6) |
|
|
|
|
|
|
|
|
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyRatio, 2) |
|
|
profit = 0 |
|
|
profit = 0 |
|
|
if restAmt < subsidyFee { |
|
|
if restAmt < subsidyFee { |
|
|
profit = 0 |
|
|
profit = 0 |
|
@@ -390,7 +390,7 @@ func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt |
|
|
} |
|
|
} |
|
|
restAmt -= subsidyFee // 剩余可分 |
|
|
restAmt -= subsidyFee // 剩余可分 |
|
|
} |
|
|
} |
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) |
|
|
|
|
|
|
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) |
|
|
return profit, restAmt, totalRatio, subsidyFee, false |
|
|
return profit, restAmt, totalRatio, subsidyFee, false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -575,7 +575,7 @@ func commSubsidy(opt *PlanOpt, totalAmt, integralTotalAmt float64, lvuser *LvUse |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
subsidyFee = zhios_order_relate_utils.FloatFormat(subsidyFee, 6) |
|
|
|
|
|
|
|
|
subsidyFee = zhios_order_relate_utils.FloatFormat(subsidyFee, 2) |
|
|
for i, coin := range subsidyFeeList { |
|
|
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, 6) |
|
|
if coin.Cid == "0" { |
|
|
if coin.Cid == "0" { |
|
|