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 +}