|
|
@@ -137,7 +137,7 @@ Loop: |
|
|
|
} |
|
|
|
} |
|
|
|
//新的团队奖 |
|
|
|
commission, _, amountList, teamRatioList := CalReturnAmountAndRatioWineryTeam(node.ParentUser.Lv, userList.OwnbuyReturnType, peerNum, "new_team", totalAmt, integralTotalAmt, opt) |
|
|
|
commission, _, amountList, teamRatioList := CalReturnAmountAndRatioWineryTeamNew(node.ParentUser.Lv, userList.OwnbuyReturnType, peerNum, "new_team", totalAmt, integralTotalAmt, opt) |
|
|
|
commission, restAmt, newTotalCommissionRatio, node.ParentUser.SubsidyFee, isBreak = teamDiffMoneyWineryNew(node.ParentUser.Profit, grade[node.Lv].PayMode, isOnlySubsidyFee, totalAmt, restAmt, grade[node.ParentUser.Lv].TeamRate, newTotalCommissionRatio, peerRate, node.ParentUser.SubsidyFee, subsidyRatio) |
|
|
|
amountList, restAmtList, newAccumulateRatioList, node.ParentUser.SubsidyFeeList, zeroList = teamDiffMoneyV2WineryNew(node.ParentUser.ProfitList, grade[node.Lv].PayMode, isOnlySubsidyFee, totalAmtList, restAmtList, teamRatioList, newAccumulateRatioList, peerRateList, subsidyFeeList, subsidyRatioList) |
|
|
|
amountMap := make(map[string]float64) |
|
|
@@ -379,6 +379,58 @@ func CalReturnAmountAndRatioWineryTeam(level, ownbuyReturnType, peerNum int, use |
|
|
|
return commission, commissionRatio, amountList, ratioList |
|
|
|
} |
|
|
|
|
|
|
|
func CalReturnAmountAndRatioWineryTeamNew(level, ownbuyReturnType, peerNum int, userType string, fee, integralFee float64, opt *PlanOpt) (commission, commissionRatio float64, amountList, ratioList []*VirtualCoinCommission) { |
|
|
|
var maxReturnTypeCount = 0 |
|
|
|
var returnType = make([]string, 0) |
|
|
|
for _, v := range opt.UserRate { |
|
|
|
if v.ReturnType != nil { |
|
|
|
if len(v.ReturnType) > maxReturnTypeCount { |
|
|
|
maxReturnTypeCount = len(v.ReturnType) |
|
|
|
returnType = v.ReturnType |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 新版支持多种虚拟币 支持的种类id保存在ReturnType id=0代表现金佣金 其他为虚拟币 |
|
|
|
if returnType != nil { //返佣类型 |
|
|
|
for _, coinId := range returnType { |
|
|
|
newFee := integralFee |
|
|
|
if coinId == "0" { |
|
|
|
newFee = fee |
|
|
|
} |
|
|
|
ratio := getVirtualCoinRatio(userType, level, peerNum, opt.UserRate, coinId) |
|
|
|
amount := getCoinAmount(ratio, zhios_order_relate_utils.StrToInt(coinId), newFee, opt.VirtualCoinMoneyRatioList) |
|
|
|
if coinId != "0" && opt.Mode == "lv_winery" && userType == "own" { //酒庄模式不在这里计算 |
|
|
|
amount = 0 |
|
|
|
} |
|
|
|
if coinId == "0" { |
|
|
|
commission = amount |
|
|
|
} |
|
|
|
amountList = append(amountList, &VirtualCoinCommission{ |
|
|
|
Cid: coinId, |
|
|
|
Val: amount, |
|
|
|
}) |
|
|
|
ratioList = append(ratioList, &VirtualCoinCommission{ |
|
|
|
Cid: coinId, |
|
|
|
Val: zhios_order_relate_utils.AnyToFloat64(ratio), |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ownbuyReturnType == 1 { //自购不返利 |
|
|
|
commission = 0 |
|
|
|
for i := range amountList { |
|
|
|
amountList[i].Val = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
commission = zhios_order_relate_utils.FloatFormat(commission, 2) |
|
|
|
|
|
|
|
for i, coin := range amountList { |
|
|
|
amountList[i].Val = zhios_order_relate_utils.FloatFormat(coin.Val, 6) |
|
|
|
} |
|
|
|
|
|
|
|
return commission, commissionRatio, amountList, ratioList |
|
|
|
} |
|
|
|
|
|
|
|
func CalReturnAmountAndRatioWinery(level, ownbuyReturnType, peerNum int, userType string, profit float64, profitList []*VirtualCoinCommission, opt *PlanOpt) (commission, commissionRatio float64, amountList, ratioList []*VirtualCoinCommission) { |
|
|
|
// 佣金的比例兼容旧系统 比例独立出来的 所以这样算 |
|
|
|
commissionRatio = getCommissionRatio(userType, level, peerNum, opt.UserRate) |
|
|
@@ -458,6 +510,9 @@ func CalReturnAmountAndRatioExtendWinery(level, ownbuyReturnType, peerNum int, u |
|
|
|
if coinId != "0" && opt.Mode == "lv_winery" && userType == "own" { //酒庄模式不在这里计算 |
|
|
|
amount = 0 |
|
|
|
} |
|
|
|
if coinId == "0" { |
|
|
|
commission = amount |
|
|
|
} |
|
|
|
amountList = append(amountList, &VirtualCoinCommission{ |
|
|
|
Cid: coinId, |
|
|
|
Val: amount, |
|
|
|