|
|
@@ -88,16 +88,16 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b |
|
|
|
//佣金扣除抽成后 |
|
|
|
fee, pvdFee, sysFee := CommFee(comf, cfg, "commission") |
|
|
|
////积分扣除抽成后 |
|
|
|
//var integralSysFee float64 = 0 |
|
|
|
//integralFee, _, integralSysFee := CommFee(comf, cfg, "integral") |
|
|
|
integralFee, _, _ := CommFee(zhios_order_relate_utils.StrToFloat64(price), cfg, "integral") |
|
|
|
//调用公排制度 |
|
|
|
var PublicPlatoonRelateCommissionReqList = []*md.PublicPlatoonRelateCommissionReq{ |
|
|
|
{ |
|
|
|
Pvd: newProvider, |
|
|
|
Uid: zhios_order_relate_utils.IntToStr(uid), |
|
|
|
UserLevel: zhios_order_relate_utils.IntToStr(level), |
|
|
|
PendingAmount: zhios_order_relate_utils.Float64ToStr(fee), |
|
|
|
Oid: rmd.Oid, |
|
|
|
Pvd: newProvider, |
|
|
|
Uid: zhios_order_relate_utils.IntToStr(uid), |
|
|
|
UserLevel: zhios_order_relate_utils.IntToStr(level), |
|
|
|
PendingAmount: zhios_order_relate_utils.Float64ToStr(fee), |
|
|
|
PendingIntegral: zhios_order_relate_utils.Float64ToStr(integralFee), |
|
|
|
Oid: rmd.Oid, |
|
|
|
}, |
|
|
|
} |
|
|
|
var order = make(map[string]*md.PublicPlatoonRelateCommissionResp) |
|
|
@@ -114,24 +114,27 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b |
|
|
|
var ulink = &comm_plan.LvUser{} |
|
|
|
if zhios_order_relate_utils.StrToInt(reward.CommonWealthBenefitUid) != zhios_order_relate_utils.StrToInt(reward.DirectPushBenefitUid) { |
|
|
|
//共富收益处理 |
|
|
|
ulink = getRewardLink(reward.CommonWealthBenefitUid, 2, reward.CommonWealthSystem, ulink, "public_platoon") |
|
|
|
ulink = getRewardLink(reward.CommonWealthBenefitUid, 2, reward.CommonWealthSystem, ulink, "public_platoon", cfg) |
|
|
|
//直推收益处理 |
|
|
|
ulink = getRewardLink(reward.DirectPushBenefitUid, 1, reward.DirectPush, ulink, "extend") |
|
|
|
ulink = getRewardLink(reward.DirectPushBenefitUid, 1, reward.DirectPush, ulink, "extend", cfg) |
|
|
|
} else { //共富 直推都是同一个用户的处理 |
|
|
|
ulink = getRewardLinkCommWithExtend(reward.CommonWealthBenefitUid, 3, reward.CommonWealthSystem, reward.DirectPush, ulink) |
|
|
|
ulink = getRewardLinkCommWithExtend(reward.CommonWealthBenefitUid, 3, reward.CommonWealthSystem, reward.DirectPush, ulink, cfg) |
|
|
|
} |
|
|
|
//自购 |
|
|
|
ulink = getRewardLink(reward.Uid, 0, reward.SelfRateList, ulink, "own") |
|
|
|
ulink = getRewardLink(reward.Uid, 0, reward.SelfRateList, ulink, "own", cfg) |
|
|
|
return profit, pvdFee, sysFee, 0, ulink, nil |
|
|
|
} |
|
|
|
} |
|
|
|
func getRewardLink(uid string, diff int, reward map[string]string, ulinkParent *comm_plan.LvUser, types string) *comm_plan.LvUser { |
|
|
|
func getRewardLink(uid string, diff int, reward map[string]string, ulinkParent *comm_plan.LvUser, types string, cfg *comm_plan.PlanOpt) *comm_plan.LvUser { |
|
|
|
var SubsidyFee = zhios_order_relate_utils.StrToFloat64(reward["0"]) |
|
|
|
var SubsidyFeeList = make([]*comm_plan.VirtualCoinCommission, 0) |
|
|
|
for k, v := range reward { |
|
|
|
coinId := zhios_order_relate_utils.StrToInt(k) |
|
|
|
ratio := cfg.VirtualCoinMoneyRatioList[coinId] |
|
|
|
rate := zhios_order_relate_utils.StrToFloat64(ratio) |
|
|
|
var tmp = &comm_plan.VirtualCoinCommission{ |
|
|
|
Cid: k, |
|
|
|
Val: zhios_order_relate_utils.StrToFloat64(v), |
|
|
|
Val: zhios_order_relate_utils.StrToFloat64(v) * rate, |
|
|
|
} |
|
|
|
SubsidyFeeList = append(SubsidyFeeList, tmp) |
|
|
|
} |
|
|
@@ -151,22 +154,31 @@ func getRewardLink(uid string, diff int, reward map[string]string, ulinkParent * |
|
|
|
return ulink |
|
|
|
} |
|
|
|
|
|
|
|
func getRewardLinkCommWithExtend(uid string, diff int, reward map[string]string, rewardExtend map[string]string, ulinkParent *comm_plan.LvUser) *comm_plan.LvUser { |
|
|
|
func getRewardLinkCommWithExtend(uid string, diff int, reward map[string]string, rewardExtend map[string]string, ulinkParent *comm_plan.LvUser, cfg *comm_plan.PlanOpt) *comm_plan.LvUser { |
|
|
|
var SubsidyFee = zhios_order_relate_utils.StrToFloat64(reward["0"]) |
|
|
|
var SubsidyFeeList = make([]*comm_plan.VirtualCoinCommission, 0) |
|
|
|
for k, v := range reward { |
|
|
|
coinId := zhios_order_relate_utils.StrToInt(k) |
|
|
|
ratio := cfg.VirtualCoinMoneyRatioList[coinId] |
|
|
|
rate := zhios_order_relate_utils.StrToFloat64(ratio) |
|
|
|
var tmp = &comm_plan.VirtualCoinCommission{ |
|
|
|
Cid: k, |
|
|
|
Val: zhios_order_relate_utils.StrToFloat64(v), |
|
|
|
Val: zhios_order_relate_utils.StrToFloat64(v) * rate, |
|
|
|
} |
|
|
|
SubsidyFeeList = append(SubsidyFeeList, tmp) |
|
|
|
} |
|
|
|
var SubsidyFeeExtend = zhios_order_relate_utils.StrToFloat64(rewardExtend["0"]) |
|
|
|
var SubsidyFeeListExtend = make([]*comm_plan.VirtualCoinCommission, 0) |
|
|
|
for k, v := range rewardExtend { |
|
|
|
var rate float64 = 1 |
|
|
|
coinId := zhios_order_relate_utils.StrToInt(k) |
|
|
|
if coinId > 0 { |
|
|
|
ratio := cfg.VirtualCoinMoneyRatioList[coinId] |
|
|
|
rate = zhios_order_relate_utils.StrToFloat64(ratio) |
|
|
|
} |
|
|
|
var tmp = &comm_plan.VirtualCoinCommission{ |
|
|
|
Cid: k, |
|
|
|
Val: zhios_order_relate_utils.StrToFloat64(v), |
|
|
|
Val: zhios_order_relate_utils.StrToFloat64(v) * rate, |
|
|
|
} |
|
|
|
SubsidyFeeListExtend = append(SubsidyFeeListExtend, tmp) |
|
|
|
} |
|
|
@@ -496,14 +508,19 @@ func BatchGetPublicPlatoonRelateCommissionByGoods(engine *xorm.Engine, masterId |
|
|
|
var directPush = make(map[string]string) |
|
|
|
var selfRateList = make(map[string]string) |
|
|
|
var commonWealthSystem = make(map[string]string) |
|
|
|
var pendingAmount = param.PendingAmount |
|
|
|
for _, coinId := range lvGrade.ReturnType { |
|
|
|
selfRateList[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.SelfRateList[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100) |
|
|
|
commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100) |
|
|
|
directPush[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.DirectPush[coinId]) * zhios_order_relate_utils.StrToFloat64(param.PendingAmount) / 100) |
|
|
|
if zhios_order_relate_utils.StrToInt(coinId) > 0 { //积分更换基数 |
|
|
|
pendingAmount = param.PendingIntegral |
|
|
|
} |
|
|
|
selfRateList[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.SelfRateList[coinId]) * zhios_order_relate_utils.StrToFloat64(pendingAmount) / 100) |
|
|
|
commonWealthSystem[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.CommonWealthSystem[coinId]) * zhios_order_relate_utils.StrToFloat64(pendingAmount) / 100) |
|
|
|
directPush[coinId] = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(lvGrade.DirectPush[coinId]) * zhios_order_relate_utils.StrToFloat64(pendingAmount) / 100) |
|
|
|
} |
|
|
|
resp[param.Oid] = &md.PublicPlatoonRelateCommissionResp{ |
|
|
|
Uid: param.Uid, |
|
|
|
PendingAmount: param.PendingAmount, |
|
|
|
PendingIntegral: param.PendingIntegral, |
|
|
|
Oid: param.Oid, |
|
|
|
SelfRateList: selfRateList, |
|
|
|
CommonWealthSystem: commonWealthSystem, |
|
|
|