|
|
@@ -60,6 +60,33 @@ func CalReturnAmountAndRatio(level, ownbuyReturnType, peerNum int, userType stri |
|
|
|
return commission, commissionRatio, amountList, ratioList |
|
|
|
} |
|
|
|
|
|
|
|
//佣金 积分 区块币计算 |
|
|
|
func CalReturnAmountAndRatioByLevel(level, ownbuyReturnType, peerNum int, userType string, fee, integralFee float64, opt *PlanOpt) (commissionRatio float64, ratioList []*VirtualCoinCommission) { |
|
|
|
// 佣金的比例兼容旧系统 比例独立出来的 所以这样算 |
|
|
|
commissionRatio = getCommissionRatio(userType, level, peerNum, opt.UserRate) |
|
|
|
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 { |
|
|
|
ratio := getVirtualCoinRatio(userType, level, peerNum, opt.UserRate, coinId) |
|
|
|
ratioList = append(ratioList, &VirtualCoinCommission{ |
|
|
|
Cid: coinId, |
|
|
|
Val: zhios_order_relate_utils.AnyToFloat64(ratio), |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
return commissionRatio, ratioList |
|
|
|
} |
|
|
|
|
|
|
|
//佣金 积分 区块币计算 |
|
|
|
func CalReturnAmountAndRatioToWinery(level int, fee, integralFee float64, opt *PlanOpt) (commission, commissionRatio float64, amountList, ratioList []*VirtualCoinCommission) { |
|
|
|
if opt.UserRate[level].ReturnType != nil { //返佣类型 |
|
|
@@ -89,7 +116,7 @@ func CalReturnAmountAndRatioToWinery(level int, fee, integralFee float64, opt *P |
|
|
|
} |
|
|
|
|
|
|
|
// 按总佣金的比例进行划分计算 |
|
|
|
func CalcAll(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUser, pvd string, sysFee float64, integralSysFee float64) error { |
|
|
|
func CalcAll(opt *PlanOpt, totalAmt, integralTotalAmt float64, userList *LvUser, pvd string, sysFee float64, integralSysFee float64, levelWeight int) error { |
|
|
|
grade := opt.UserRate |
|
|
|
if len(grade) == 0 { |
|
|
|
return zhios_order_relate_logx.Warn("level grade is not set") |
|
|
|