From 9d1cbd2ec06328ee3ffc2b32c585ea593697504c Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 24 Feb 2023 11:21:25 +0800 Subject: [PATCH] test --- lib/comm_plan/winery.go | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/comm_plan/winery.go b/lib/comm_plan/winery.go index 7c972a9..4c81570 100644 --- a/lib/comm_plan/winery.go +++ b/lib/comm_plan/winery.go @@ -200,7 +200,7 @@ Loop: //新的团队奖 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) + amountList, restAmtList, newAccumulateRatioList, node.ParentUser.SubsidyFeeList, zeroList = teamDiffMoneyV2WineryNew(opt, node.ParentUser.ProfitList, grade[node.Lv].PayMode, isOnlySubsidyFee, totalAmtList, restAmtList, teamRatioList, newAccumulateRatioList, peerRateList, subsidyFeeList, subsidyRatioList) amountMap := make(map[string]float64) for _, v := range amountList { amountMap[v.Cid] = v.Val @@ -342,7 +342,30 @@ func teamDiffMoneyWineryNew(profit float64, payMode, isOnlySubsidy int, totalAmt } // 处理多虚拟币团队的 -func teamDiffMoneyV2WineryNew(profitList []*VirtualCoinCommission, payMode, isOnlySubsidy int, totalAmtList, restAmtList, teamRatioList, totalRatioList, peerRateList, subsidyFeeList, subsidyRatioList []*VirtualCoinCommission) (newProfitList, newRestAmtList, newTotalRatioList, newSubsidyFeeList []*VirtualCoinCommission, zeroList map[string]struct{}) { +func teamDiffMoneyV2WineryNew(opt *PlanOpt, profitList []*VirtualCoinCommission, payMode, isOnlySubsidy int, totalAmtList, restAmtList, teamRatioList, totalRatioList, peerRateList, subsidyFeeList, subsidyRatioList []*VirtualCoinCommission) (newProfitList, newRestAmtList, newTotalRatioList, newSubsidyFeeList []*VirtualCoinCommission, zeroList map[string]struct{}) { + if len(profitList) == 0 { + var returnType = make([]string, 0) + var maxReturnTypeCount = 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 { + profitList = append(profitList, &VirtualCoinCommission{ + Cid: coinId, + Val: 0, + }) + + } + } + } + restAmtMap := convertList2Map(restAmtList) totalAmtMap := convertList2Map(totalAmtList) profitMap := convertList2Map(profitList) @@ -355,6 +378,9 @@ func teamDiffMoneyV2WineryNew(profitList []*VirtualCoinCommission, payMode, isOn newProfitList = make([]*VirtualCoinCommission, 0) for _, coin := range profitList { + if teamRatioMap[coin.Cid] == 0 { + continue + } // 如果是团队内部支出团队比例大于同级累计比例 或站长支出 teamRatioMap[coin.Cid] = zhios_order_relate_utils.FloatFormat(teamRatioMap[coin.Cid]-totalRatioMap[coin.Cid], 6)