diff --git a/lib/comm_plan/all.go b/lib/comm_plan/all.go index 569b70e..6eaefd3 100644 --- a/lib/comm_plan/all.go +++ b/lib/comm_plan/all.go @@ -51,7 +51,7 @@ func CalReturnAmountAndRatio(level, ownbuyReturnType, peerNum int, userType stri 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 { 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) // 累计比例 accumulateRatioList = ratioList - restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) + restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) Loop: 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 { restAmt -= profit // 剩余可分 - restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) + restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) peerRate += restRatio totalRatio += restRatio } 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 } 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 @@ -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) { // 如果是团队内部支出团队比例大于同级累计比例 或站长支出 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 { @@ -373,7 +373,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, 6) + profit = zhios_order_relate_utils.FloatFormat(teamRatio*totalAmt, 2) if restAmt < profit { profit = 0 return profit, restAmt, totalRatio, subsidyFee, true @@ -381,7 +381,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, 2) profit = 0 if restAmt < subsidyFee { profit = 0 @@ -390,7 +390,7 @@ func teamDiffMoney(profit float64, payMode, isOnlySubsidy int, totalAmt, restAmt } restAmt -= subsidyFee // 剩余可分 } - restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) + restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) 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 { subsidyFeeList[i].Val = zhios_order_relate_utils.FloatFormat(subsidyFeeList[i].Val, 6) if coin.Cid == "0" { diff --git a/lib/comm_plan/other.go b/lib/comm_plan/other.go index e89059a..8cbdd0d 100644 --- a/lib/comm_plan/other.go +++ b/lib/comm_plan/other.go @@ -55,7 +55,7 @@ func CalcOther(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUse restAmtList, _ = CalVirtualCommissionMinus(totalAmtList, amountList) // 累计比例 accumulateRatioList = ratioList - restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) + restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) Loop: for node.ParentUser != nil { //查找上级用户 @@ -145,7 +145,7 @@ func otherSameMoney(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio //极差返利 if opt.UserRate[lv].PayMode == 0 && isOnlySubsidy == 0 { restAmt -= profit // 剩余可分 - restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 6) + restAmt = zhios_order_relate_utils.FloatFormat(restAmt, 2) peerRate += restRatio totalRatio += restRatio } else if isOnlySubsidy == 1 { //如果只返补贴 当成是极差的一部分 所以要扣 不是额外的 @@ -156,8 +156,8 @@ func otherSameMoney(lv, isOnlySubsidy int, restAmt, profit, peerRate, totalRatio return profit, restAmt, totalRatio, subsidyFee, peerRate, true } 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 diff --git a/lib/comm_plan/self.go b/lib/comm_plan/self.go index b3dd040..f1942ad 100644 --- a/lib/comm_plan/self.go +++ b/lib/comm_plan/self.go @@ -7,7 +7,7 @@ import ( ) // 按自购佣金进行计算 -func CalcSelf(opt *PlanOpt, totalAmt float64, integralTotalAmt float64, userList *LvUser, pvd string, sysFee float64, integralSysFee float64,level,levelWeight int) error { +func CalcSelf(opt *PlanOpt, totalAmt float64, integralTotalAmt float64, userList *LvUser, pvd string, sysFee float64, integralSysFee float64, level, levelWeight int) error { grade := opt.UserRate if len(grade) == 0 { return zhios_order_relate_logx.Warn("level grade is not set")