|
|
@@ -233,6 +233,40 @@ Loop: |
|
|
|
|
|
|
|
//公共处理同级计算 (只计算佣金 旧版本用) |
|
|
|
func sameMoney(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, restRatio, subsidyFee, subsidyBili float64, opt *PlanOpt) (float64, float64, float64, float64, float64, bool) { |
|
|
|
//如果不够扣了,并且是比例返利就跳过 |
|
|
|
if restAmt < profit { |
|
|
|
return 0, restAmt, totalRatio, peerRate, subsidyFee, true |
|
|
|
} |
|
|
|
if opt == nil { |
|
|
|
return 0, restAmt, totalRatio, peerRate, subsidyFee, true |
|
|
|
} |
|
|
|
if opt.UserRate == nil { |
|
|
|
return 0, restAmt, totalRatio, peerRate, subsidyFee, true |
|
|
|
} |
|
|
|
if opt.UserRate[lv] == nil { |
|
|
|
return 0, restAmt, totalRatio, peerRate, subsidyFee, true |
|
|
|
} |
|
|
|
//极差返利 |
|
|
|
if opt.UserRate[lv].PayMode == 0 && isOnlySubsidy == 0 { |
|
|
|
restAmt -= profit // 剩余可分 |
|
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) |
|
|
|
peerRate += restRatio |
|
|
|
totalRatio += restRatio |
|
|
|
} else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的 |
|
|
|
profit = 0 |
|
|
|
if opt.UserRate[lv].PayMode == 0 { |
|
|
|
if restAmt < subsidyFee { |
|
|
|
subsidyFee = 0 |
|
|
|
return profit, restAmt, totalRatio, subsidyFee, peerRate, true |
|
|
|
} |
|
|
|
restAmt -= subsidyFee // 剩余可分 |
|
|
|
restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) |
|
|
|
totalRatio += zhios_order_relate_utils.FloatFormat(subsidyBili, 6) |
|
|
|
} |
|
|
|
} |
|
|
|
return profit, restAmt, totalRatio, peerRate, subsidyFee, false |
|
|
|
} |
|
|
|
func sameMoneyWinery(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio, restRatio, subsidyFee, subsidyBili float64, opt *PlanOpt) (float64, float64, float64, float64, float64, bool) { |
|
|
|
//如果不够扣了,并且是比例返利就跳过 |
|
|
|
if restAmt < profit { |
|
|
|
return 0, restAmt, totalRatio, peerRate, subsidyFee, true |
|
|
|