|
|
@@ -84,9 +84,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b |
|
|
|
if cfg.Mode == "public_platoon" { |
|
|
|
//公排 |
|
|
|
//佣金扣除抽成后 |
|
|
|
fee, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods) |
|
|
|
fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods) |
|
|
|
////积分扣除抽成后 |
|
|
|
integralFee, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods) |
|
|
|
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods) |
|
|
|
//调用公排制度 |
|
|
|
|
|
|
|
userPublicPlatoonSetting, err := db.UserPublicPlatoonSettingGetOneByParams(engine, map[string]interface{}{ |
|
|
@@ -189,9 +189,9 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b |
|
|
|
userLevel = zhios_order_relate_utils.StrToInt(extraData["agent_lv"]) |
|
|
|
} |
|
|
|
//佣金扣除抽成后 |
|
|
|
fee, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods) |
|
|
|
fee, _, pvdFee, sysFee := CommFee(comf, cfg, "commission", rmd.IsGoods) |
|
|
|
////积分扣除抽成后 |
|
|
|
integralFee, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods) |
|
|
|
integralFee, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral", rmd.IsGoods) |
|
|
|
var param = map[string]string{ |
|
|
|
"commission": zhios_order_relate_utils.Float64ToStr(fee), |
|
|
|
"integral": zhios_order_relate_utils.Float64ToStr(integralFee), |
|
|
@@ -471,10 +471,12 @@ func currentPrice(m *md.CommissionParam, pvd string) string { |
|
|
|
return "" |
|
|
|
} |
|
|
|
} |
|
|
|
func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float64, float64, float64) { |
|
|
|
func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float64, float64, float64, float64) { |
|
|
|
var feeFirst float64 = 1 |
|
|
|
if types == "integral" && opt.IntegralOpen == 0 || opt.Mode == "lv_winery" { //积分抽成后台没开启不用扣 |
|
|
|
return fee, 0, 0 |
|
|
|
return fee, feeFirst, 0, 0 |
|
|
|
} |
|
|
|
|
|
|
|
if isGoods == "1" { |
|
|
|
orderBeforeRate := fee * opt.OrderBeforeRate |
|
|
|
fee1 := int64(fee*1e4) - int64(orderBeforeRate*1e4) |
|
|
@@ -496,7 +498,7 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float6 |
|
|
|
if fee < 0 { |
|
|
|
fee = 0 |
|
|
|
} |
|
|
|
return fee, pvdFee, sysFee |
|
|
|
return fee, feeFirst, pvdFee, sysFee |
|
|
|
} |
|
|
|
|
|
|
|
// 根据用户计算对应的手续费 |
|
|
@@ -504,10 +506,12 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types, isGoods string) (float6 |
|
|
|
//pvd 只是为了判断是会员升级的订单 可不传 |
|
|
|
func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee float64, isShare bool, opt *comm_plan.PlanOpt, userRelationShip *[]md.UserRelation, pvd string, newLevel int, eg *xorm.Engine, isGoods string, rmd *md.CommissionParam) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) { |
|
|
|
//佣金扣除抽成后 |
|
|
|
fee, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods) |
|
|
|
var feeFirst float64 = 1 |
|
|
|
var integralFeeFirst float64 = 1 |
|
|
|
fee, feeFirst, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods) |
|
|
|
//积分扣除抽成后 |
|
|
|
var integralSysFee float64 = 0 |
|
|
|
integralFee, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods) |
|
|
|
integralFee, integralFeeFirst, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods) |
|
|
|
// 计算自购补贴比例 |
|
|
|
subsidyFee = 0 |
|
|
|
//如果没登录,要找出权重最低的那个 |
|
|
@@ -552,12 +556,12 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee |
|
|
|
fmt.Println("==================================这里4", fee) |
|
|
|
} |
|
|
|
// 获得自购的 |
|
|
|
commission, _, amountList, ratioList := comm_plan.CalReturnAmountAndRatio(level, ownbuyReturnType, 0, "own", fee, integralFee, opt) |
|
|
|
commission, profitBili, amountList, ratioList := comm_plan.CalReturnAmountAndRatio(level, ownbuyReturnType, 0, "own", fee, integralFee, opt) |
|
|
|
if opt.Mode == "lv_winery" { |
|
|
|
commission, _, amountList, ratioList = comm_plan.CalReturnAmountAndRatioToWinery(level, fee, integralFee, opt) |
|
|
|
commission, profitBili, amountList, ratioList = comm_plan.CalReturnAmountAndRatioToWinery(level, fee, integralFee, opt) |
|
|
|
} |
|
|
|
if opt.Mode == "lv_ds_check" { |
|
|
|
commission, _, amountList, ratioList = comm_plan.CalReturnAmountAndRatioDsOwn(level, ownbuyReturnType, 0, "own", fee, integralFee, opt) |
|
|
|
commission, profitBili, amountList, ratioList = comm_plan.CalReturnAmountAndRatioDsOwn(level, ownbuyReturnType, 0, "own", fee, integralFee, opt) |
|
|
|
} |
|
|
|
if uid == 8 { |
|
|
|
fmt.Println("==================================这里5", commission) |
|
|
@@ -567,7 +571,7 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee |
|
|
|
amountList[k].Val = ratioListMap[v.Cid] * v.Val |
|
|
|
} |
|
|
|
//重新计算佣金 |
|
|
|
return pvdFee, sysFee, subsidyFee, &comm_plan.LvUser{TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, OldDiff: oldDiff, Profit: commission, ProfitList: amountList, Diff: 0}, nil |
|
|
|
return pvdFee, sysFee, subsidyFee, &comm_plan.LvUser{ProfitBili: profitBili, FirstFee: feeFirst, IntegralFirstFee: integralFeeFirst, TikTokOwnSubsidyFeeList: tikTokSubsidyFeeList, OwnSubsidyFeeList: subsidyFeeList, Uid: uid, Lv: level, OldDiff: oldDiff, Profit: commission, ProfitList: amountList, Diff: 0}, nil |
|
|
|
} |
|
|
|
if uid == 8 { |
|
|
|
fmt.Println("==================================这里6") |
|
|
@@ -625,11 +629,11 @@ func CalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee |
|
|
|
//pvd 只是为了判断是会员升级的订单 可不传 |
|
|
|
func NiuBeiCalcCommission(uid, level, oldDiff, ownbuyReturnType int, fee, integralFee float64, isShare bool, opt *comm_plan.PlanOpt, userRelationShip *[]md.UserRelation, pvd string, newLevel int, eg *xorm.Engine, isGoods string, rmd *md.CommissionParam) (pvdFee, sysFee, subsidyFee float64, lvUser *comm_plan.LvUser, err error) { |
|
|
|
//佣金扣除抽成后 |
|
|
|
fee, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods) |
|
|
|
fee, _, pvdFee, sysFee = CommFee(fee, opt, "commission", isGoods) |
|
|
|
//积分扣除抽成后 |
|
|
|
var integralSysFee float64 = 0 |
|
|
|
integralFee, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods) |
|
|
|
integralFeeForPrice, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(rmd.OldPrice), opt, "integral", isGoods) |
|
|
|
integralFee, _, _, integralSysFee = CommFee(integralFee, opt, "integral", isGoods) |
|
|
|
integralFeeForPrice, _, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(rmd.OldPrice), opt, "integral", isGoods) |
|
|
|
// 计算自购补贴比例 |
|
|
|
subsidyFee = 0 |
|
|
|
//如果没登录,要找出权重最低的那个 |
|
|
|