From 05e67e93c7cb04ecfb7087a423fea8ef68e69353 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 29 Nov 2022 19:22:45 +0800 Subject: [PATCH] =?UTF-8?q?add=20reverse:for=20v4.1.8=20=E7=89=9B=E8=B4=9D?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/comm_plan/niubei_all.go | 41 ++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/comm_plan/niubei_all.go b/lib/comm_plan/niubei_all.go index 2b8145b..defb771 100644 --- a/lib/comm_plan/niubei_all.go +++ b/lib/comm_plan/niubei_all.go @@ -71,19 +71,58 @@ func NiuBeiCalcAll(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *L userList.SubsidyFee = 0 // 各种币换算出总的额度 totalAmtList := make([]*VirtualCoinCommission, 0) + amountList := make([]*VirtualCoinCommission, 0) + for coinId, rate := range opt.VirtualCoinMoneyRatioList { + var amount float64 + if coinId == 0 { + amount = totalAmt + } else { + amount = integralTotalAmt * zhios_order_relate_utils.AnyToFloat64(rate) + } + totalAmtList = append(totalAmtList, &VirtualCoinCommission{ + Cid: zhios_order_relate_utils.AnyToString(coinId), + Val: amount, + }) + } var ( node = userList maxLv = node.Lv // 当前等级 - maxLevelWeight = node.LevelWeight // 当前权重 + maxLevelWeight = -2 // 当前权重 peerNum = 0 // 存在同级数 peerRate float64 = 0 // 同级累计比例 peerRateList = make([]*VirtualCoinCommission, 0) // 各虚拟币同级累计 restAmtList = make([]*VirtualCoinCommission, 0) // 各虚拟币剩余额度 accumulateRatioList = make([]*VirtualCoinCommission, 0) // 各虚拟币累计比例 + ratioList = make([]*VirtualCoinCommission, 0) // 各虚拟币累计比例 restAmt = totalAmt - userList.Profit // 剩余比例 totalCommissionRatio float64 = 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 { + amountList = append(amountList, &VirtualCoinCommission{ + Cid: coinId, + Val: 0, + }) + ratioList = append(ratioList, &VirtualCoinCommission{ + Cid: coinId, + Val: 0, + }) + } + } + restAmtList, _ = CalVirtualCommissionMinus(totalAmtList, amountList) Loop: for node.ParentUser != nil { //查找上级用户