From c869a0a548d90c557ad147e80bb059d0d26da5ba Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 2 Jul 2022 10:27:35 +0800 Subject: [PATCH] =?UTF-8?q?add=20reverse:for=20v1.1.0=20=E5=88=86=E4=BD=A3?= =?UTF-8?q?=E6=96=B9=E6=A1=88=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rule/relate_commission.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/rule/relate_commission.go b/rule/relate_commission.go index 1c4a7bc..39e9c9c 100644 --- a/rule/relate_commission.go +++ b/rule/relate_commission.go @@ -147,3 +147,35 @@ func SettleCommWithGoodsDetail(eg *xorm.Engine, dbName string, CommissionParam m profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, isShare, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapData, virType) return profit, pvdFee, sysFee, subsidyFee, lvUser, err } + +//获取自购分享佣金的 +func GetRewardCommission(eg *xorm.Engine, dbName, mode string, CommissionParam md.CommissionFirstParam) (float64, float64, *comm_plan.LvUser, error) { + var ( + isAll = false + isShare = false + isAllLevelReturn = false + commission, shareCommission float64 + ) + if CommissionParam.IsShare == 0 { + isAll = true + } + if CommissionParam.IsShare == 1 { + isShare = true + } + if CommissionParam.IsAllLevelReturn != 0 { + isAllLevelReturn = true + } + var lvUser = &comm_plan.LvUser{} + var mapsDta = map[string]string{"show_level": CommissionParam.ShowLevel} + if isAll { + shareCommission, _, _, _, lvUser, _ = svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, true, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapsDta, mode) + commission, _, _, _, lvUser, _ = svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, false, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapsDta, mode) + } else { + if isShare { + shareCommission, _, _, _, lvUser, _ = svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, isShare, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapsDta, mode) + } else { + commission, _, _, _, lvUser, _ = svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, isShare, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapsDta, mode) + } + } + return commission, shareCommission, lvUser, nil +}