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