diff --git a/lib/comm_plan/all.go b/lib/comm_plan/all.go index 222c249..fc8d93b 100644 --- a/lib/comm_plan/all.go +++ b/lib/comm_plan/all.go @@ -11,11 +11,20 @@ func CalReturnAmountAndRatio(level, ownbuyReturnType, peerNum int, userType stri // 佣金的比例兼容旧系统 比例独立出来的 所以这样算 commissionRatio = getCommissionRatio(userType, level, peerNum, opt.UserRate) commission = fee * commissionRatio - + 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 opt.UserRate[level].ReturnType != nil { //返佣类型 + if returnType != nil { //返佣类型 - for _, coinId := range opt.UserRate[level].ReturnType { + for _, coinId := range returnType { newFee := integralFee if coinId == "0" { newFee = fee @@ -484,6 +493,7 @@ func commSubsidy(opt *PlanOpt, totalAmt, integralTotalAmt float64, lvuser *LvUse } //如果层级不是当前层级 且不是会员升级 if pvdBool == false && k+1 != lvuser.Diff { + fmt.Println("===========", lvuser.Uid, lvuser.Diff) continue } if pvdBool == false { //如果不是会员升级 newLv=旧的等级 @@ -568,6 +578,12 @@ func getCommissionRatio(typ string, level, peerNum int, grade map[int]*LvGrade) // 获取佣金、虚拟币比例 0=佣金 func getVirtualCoinRatio(typ string, level, peerNum int, grade map[int]*LvGrade, coinId string) (ratio string) { + if grade[level].ReturnType == nil { + return "0" + } + if zhios_order_relate_utils.InArr(coinId, grade[level].ReturnType) == false { + return "0" + } ok := false switch typ { case "team":