diff --git a/svc/reward_commission.go b/svc/reward_commission.go index cbc0091..6a249e8 100644 --- a/svc/reward_commission.go +++ b/svc/reward_commission.go @@ -112,10 +112,14 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b reward := order[rmd.Oid] profit := zhios_order_relate_utils.StrToFloat64(reward.SelfRateList["0"]) var ulink = &comm_plan.LvUser{} - //共富收益处理 - ulink = getRewardLink(reward.CommonWealthBenefitUid, 2, reward.CommonWealthSystem, ulink, "public_platoon") - //直推收益处理 - ulink = getRewardLink(reward.DirectPushBenefitUid, 1, reward.DirectPush, ulink, "extend") + 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.DirectPushBenefitUid, 1, reward.DirectPush, ulink, "extend") + } else { //共富 直推都是同一个用户的处理 + ulink = getRewardLinkCommWithExtend(reward.CommonWealthBenefitUid, 3, reward.CommonWealthSystem, reward.DirectPush, ulink) + } //自购 ulink = getRewardLink(reward.Uid, 0, reward.SelfRateList, ulink, "own") return profit, pvdFee, sysFee, 0, ulink, nil @@ -133,8 +137,7 @@ func getRewardLink(uid string, diff int, reward map[string]string, ulinkParent * } //组装数据 var ulink = &comm_plan.LvUser{ - Uid: zhios_order_relate_utils.StrToInt(uid), - + Uid: zhios_order_relate_utils.StrToInt(uid), Diff: diff, ParentUser: ulinkParent, } @@ -148,6 +151,37 @@ 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 { + var SubsidyFee = zhios_order_relate_utils.StrToFloat64(reward["0"]) + var SubsidyFeeList = make([]*comm_plan.VirtualCoinCommission, 0) + for k, v := range reward { + var tmp = &comm_plan.VirtualCoinCommission{ + Cid: k, + Val: zhios_order_relate_utils.StrToFloat64(v), + } + 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 tmp = &comm_plan.VirtualCoinCommission{ + Cid: k, + Val: zhios_order_relate_utils.StrToFloat64(v), + } + SubsidyFeeListExtend = append(SubsidyFeeListExtend, tmp) + } + //组装数据 + var ulink = &comm_plan.LvUser{ + Uid: zhios_order_relate_utils.StrToInt(uid), + Diff: diff, + ParentUser: ulinkParent, + } + ulink.SubsidyFee = SubsidyFee + ulink.SubsidyFeeList = SubsidyFeeList + ulink.Profit = SubsidyFeeExtend + ulink.ProfitList = SubsidyFeeListExtend + return ulink +} func getCommission(d *md.CommissionParam, provider string) (string, string) { switch provider {