diff --git a/rule/relate_commission.go b/rule/relate_commission.go index 25d074e..b03e0ba 100644 --- a/rule/relate_commission.go +++ b/rule/relate_commission.go @@ -22,10 +22,12 @@ func GetComm(eg *xorm.Engine) map[string]string { var arg = map[string]string{ "virType": virType, "integralRewardMultiple": "0", + "integralCoinId": "0", } chain := db.GetGreenChain(eg) if chain != nil { arg["integralRewardMultiple"] = zhios_order_relate_utils.IntToStr(chain.IntegralRewardMultiple) + arg["integralCoinId"] = zhios_order_relate_utils.IntToStr(chain.Coin2) } return arg } diff --git a/svc/reward_commission.go b/svc/reward_commission.go index 311108f..c836757 100644 --- a/svc/reward_commission.go +++ b/svc/reward_commission.go @@ -220,17 +220,28 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b if ulink == nil { return 0, 0, 0, 0, nil, nil } + comm(commArr, ulink) + return ulink.Profit, pvdFee, sysFee, subsidyFee, ulink, nil +} +func comm(commArr map[string]string, ulink *comm_plan.LvUser) *comm_plan.LvUser { if zhios_order_relate_utils.StrToFloat64(commArr["integralRewardMultiple"]) > 0 { for k, v := range ulink.OwnSubsidyFeeList { - ulink.OwnSubsidyFeeList[k] = v * zhios_order_relate_utils.StrToFloat64(commArr["integralRewardMultiple"]) + if k == commArr["integralCoinId"] && zhios_order_relate_utils.StrToInt(k) > 0 { + ulink.OwnSubsidyFeeList[k] = v * zhios_order_relate_utils.StrToFloat64(commArr["integralRewardMultiple"]) + } } for k, v := range ulink.ProfitList { - ulink.ProfitList[k].Val = v.Val * zhios_order_relate_utils.StrToFloat64(commArr["integralRewardMultiple"]) + if v.Cid == commArr["integralCoinId"] && zhios_order_relate_utils.StrToInt(v.Cid) > 0 { + ulink.ProfitList[k].Val = v.Val * zhios_order_relate_utils.StrToFloat64(commArr["integralRewardMultiple"]) + } } } - - return ulink.Profit, pvdFee, sysFee, subsidyFee, ulink, nil + if ulink.ParentUser != nil { + ulink.ParentUser = comm(commArr, ulink.ParentUser) + } + return ulink } + 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)