|
|
@@ -519,8 +519,14 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if uid == 8 { |
|
|
|
fmt.Println("==================================这里1", level) |
|
|
|
} |
|
|
|
// 判断当前用户等级是否有分佣设置 |
|
|
|
if _, ok := opt.UserRate[level]; !ok { |
|
|
|
if uid == 8 { |
|
|
|
fmt.Println("==================================这里2", zhios_order_relate_utils.SerializeStr(opt)) |
|
|
|
} |
|
|
|
return 0, 0, 0, nil, errors.New("opt.UserRate[level] is nil uid=" + zhios_order_relate_utils.IntToStr(uid)) |
|
|
|
} |
|
|
|
|
|
|
@@ -532,11 +538,16 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee |
|
|
|
} |
|
|
|
// 抖团服务费金额的补贴 |
|
|
|
tikTokSubsidyFeeList := getTikTokOwnSubsidy(opt, level, isShare, rmd) |
|
|
|
|
|
|
|
if uid == 8 { |
|
|
|
fmt.Println("==================================这里3") |
|
|
|
} |
|
|
|
// 获取用户的关系网 |
|
|
|
//userRelationShip, err := UserRelativeNetwork(eg, uid) |
|
|
|
// 如果获取用户关系失败或者佣金方案不存在, 那么只计算当前用户的佣金, 平台佣金, 以及供应商方的佣金 |
|
|
|
if _, ok := comm_plan.Fn[opt.Mode]; !ok || userRelationShip == nil || len(*userRelationShip) == 0 { |
|
|
|
if uid == 8 { |
|
|
|
fmt.Println("==================================这里4", fee) |
|
|
|
} |
|
|
|
// 获得自购的 |
|
|
|
commission, _, amountList, ratioList := comm_plan.CalReturnAmountAndRatio(level, ownbuyReturnType, 0, "own", fee, integralFee, opt) |
|
|
|
if opt.Mode == "lv_winery" { |
|
|
@@ -545,30 +556,19 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee |
|
|
|
if opt.Mode == "lv_ds_check" { |
|
|
|
commission, _, amountList, ratioList = comm_plan.CalReturnAmountAndRatioDsOwn(level, ownbuyReturnType, 0, "own", fee, integralFee, opt) |
|
|
|
} |
|
|
|
if uid == 8 { |
|
|
|
fmt.Println("==================================这里5", commission) |
|
|
|
} |
|
|
|
ratioListMap := convertList2Map(ratioList) |
|
|
|
for k, v := range amountList { |
|
|
|
amountList[k].Val = ratioListMap[v.Cid] * v.Val |
|
|
|
} |
|
|
|
minProfit := 0.00 |
|
|
|
minProfitList := make([]*comm_plan.VirtualCoinCommission, 0) |
|
|
|
if opt.Mode == "lv_ds_check" { |
|
|
|
if level == rmd.MinLevel { |
|
|
|
minProfit = commission |
|
|
|
minProfitList = amountList |
|
|
|
} else { |
|
|
|
commission1, _, amountList1, ratioList1 := comm_plan.CalReturnAmountAndRatioDsOwn(rmd.MinLevel, ownbuyReturnType, 0, "own", fee, integralFee, opt) |
|
|
|
ratioListMap1 := convertList2Map(ratioList1) |
|
|
|
for k, v := range amountList1 { |
|
|
|
amountList1[k].Val = ratioListMap1[v.Cid] * v.Val |
|
|
|
} |
|
|
|
minProfit = commission1 |
|
|
|
minProfitList = amountList1 |
|
|
|
} |
|
|
|
} |
|
|
|
//重新计算佣金 |
|
|
|
return pvdFee, sysFee, subsidyFee, &comm_plan.LvUser{MinProfit: minProfit, MinProfitList: minProfitList, TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, OldDiff: oldDiff, Profit: commission, ProfitList: amountList, Diff: 0}, nil |
|
|
|
return pvdFee, sysFee, subsidyFee, &comm_plan.LvUser{TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, OldDiff: oldDiff, Profit: commission, ProfitList: amountList, Diff: 0}, nil |
|
|
|
} |
|
|
|
if uid == 8 { |
|
|
|
fmt.Println("==================================这里6") |
|
|
|
} |
|
|
|
|
|
|
|
//查出所有等级替换权重 |
|
|
|
levelList, _ := db.UserLevlEgAll(eg) |
|
|
|
levelWeight := 0 |
|
|
|