From 0e00aea5257fa9885d6af05a116ffa8c8557647f Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 18 Sep 2024 18:43:18 +0800 Subject: [PATCH 1/2] 1 --- svc/reward_commission.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/svc/reward_commission.go b/svc/reward_commission.go index 34c61ac..612d699 100644 --- a/svc/reward_commission.go +++ b/svc/reward_commission.go @@ -776,6 +776,9 @@ func getCommission(d *md.CommissionParam, provider string) (string, string) { return zhios_order_relate_utils.Float64ToStr(com), currentPrice default: if zhios_order_relate_utils.StrToFloat64(d.GoodsPrice) == 0 { + if zhios_order_relate_utils.StrToFloat64(d.PaidPrice) > 0 { + return d.Commission, d.PaidPrice + } //如果价格没有直接返回佣金 return d.Commission, d.Commission } From e691583e7335e1666cabfccd22aa25c122c1e8bc Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 20 Sep 2024 09:44:37 +0800 Subject: [PATCH 2/2] 1 --- rule/relate_commission.go | 52 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/rule/relate_commission.go b/rule/relate_commission.go index 8251495..af37f92 100644 --- a/rule/relate_commission.go +++ b/rule/relate_commission.go @@ -147,7 +147,7 @@ func BatchGetCommissionByGoodsExtend(eg *xorm.Engine, dbName string, commissionP return goodsId2lvUser, nil } -//商品详情等使用 +// 商品详情等使用 func SettleCommWithGoodsDetail(eg *xorm.Engine, dbName string, CommissionParam md.CommissionFirstParam) (float64, float64, float64, float64, *comm_plan.LvUser, error) { var ( isShare = false @@ -176,7 +176,7 @@ func SettleCommWithGoodsDetail(eg *xorm.Engine, dbName string, CommissionParam m return profit, pvdFee, sysFee, subsidyFee, lvUser, err } -//商品详情等使用 +// 商品详情等使用 func SettleCommWithGoodsDetailExtend(eg *xorm.Engine, dbName string, CommissionParam md.CommissionFirstParam) (float64, float64, float64, float64, *comm_plan.LvUser, error) { var ( isShare = false @@ -205,7 +205,7 @@ func SettleCommWithGoodsDetailExtend(eg *xorm.Engine, dbName string, CommissionP 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 @@ -304,6 +304,52 @@ func BatchGetCommissionByOrder(engine *xorm.Engine, dbName string, CommissionPar return goodsId2lvUser, nil } +func BatchGetCommissionByOrderMall(engine *xorm.Engine, dbName string, CommissionParamList []*md.CommissionFirstParam) (map[string]*comm_plan.SettleCommissionToGuide, error) { + var ( + isShare = false + isAllLevelReturn = false + ) + goodsId2lvUser := make(map[string]*comm_plan.SettleCommissionToGuide, len(CommissionParamList)) + if len(CommissionParamList) == 0 { + return goodsId2lvUser, errors.New("参数缺失") + } + commArr := GetComm(engine) + plan, commission, virtualCoinMoneyRate := svc.GetAllPlan(engine, dbName) + for _, param := range CommissionParamList { + if param.IsShare != 0 { + isShare = true + } + if param.IsAllLevelReturn != 0 { + isAllLevelReturn = true + } + + if param.Oid == "" { + return goodsId2lvUser, errors.New("订单缺失") + } + if zhios_order_relate_utils.StrToFloat64(param.CommissionParam.GoodsPrice) > 0 { + param.CommissionParam.OldPrice = param.CommissionParam.GoodsPrice + } + param.CommissionParam.ShowLevel = param.ShowLevel + param.CommissionParam.Oid = param.Oid + var mapData = map[string]string{ + "old_lv": param.OldLv, + "new_lv": param.NewLv, + "ownbuy_return_type": zhios_order_relate_utils.IntToStr(param.OwnbuyReturnType), + } + profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(engine, ¶m.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, mapData, commArr, plan, commission, virtualCoinMoneyRate) + if err != nil { + return goodsId2lvUser, err + } + goodsId2lvUser[param.Oid] = &comm_plan.SettleCommissionToGuide{ + Profit: profit, + PvdFee: pvdFee, + SysFee: sysFee, + SubsidyFee: subsidyFee, + LvUser: lvUser, + } + } + return goodsId2lvUser, nil +} func BatchGetCommissionByOrderService(engine *xorm.Engine, dbName string, CommissionParamList []*md.CommissionFirstParam) (map[string]*comm_plan.SettleCommissionToGuide, error) { var ( isShare = false