diff --git a/md/provider.go b/md/provider.go index 98d18f4..bdee453 100644 --- a/md/provider.go +++ b/md/provider.go @@ -1,16 +1,17 @@ package md const ( - PVD_TB = "taobao" - PVD_JD = "jd" - PVD_SN = "suning" - PVD_VIP = "vip" - PVD_PDD = "pdd" - PVD_KL = "kaola" - PVD_TM = "tmall" - PVD_DTK = "dataoke" - PVD_HDK = "haodanku" - PVD_JTT = "jingtuitui" + PVD_TB = "taobao" + PVD_JD = "jd" + PVD_JDOwn = "jd_own" + PVD_SN = "suning" + PVD_VIP = "vip" + PVD_PDD = "pdd" + PVD_KL = "kaola" + PVD_TM = "tmall" + PVD_DTK = "dataoke" + PVD_HDK = "haodanku" + PVD_JTT = "jingtuitui" // 特殊活动免单方案 PVD_FREE = "free" PVD_MEITUAN = "meituan" diff --git a/svc/get_plan_cfg.go b/svc/get_plan_cfg.go index 1301bbf..067c08c 100644 --- a/svc/get_plan_cfg.go +++ b/svc/get_plan_cfg.go @@ -20,12 +20,13 @@ var pvdCfgList = map[string]struct { SK string Sid string }{ - md.PVD_TB: {"third_taobao_svc_ak", "third_taobao_svc_sk", "third_taobao_web_sid"}, - md.PVD_KL: {md.KEY_CFG_KL_AK, md.KEY_CFG_KL_SK, ""}, - md.PVD_SN: {md.KEY_CFG_SN_AK, md.KEY_CFG_SN_SK, ""}, - md.PVD_JD: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID}, - md.PVD_PDD: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID}, - md.PVD_VIP: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID}, + md.PVD_TB: {"third_taobao_svc_ak", "third_taobao_svc_sk", "third_taobao_web_sid"}, + md.PVD_KL: {md.KEY_CFG_KL_AK, md.KEY_CFG_KL_SK, ""}, + md.PVD_SN: {md.KEY_CFG_SN_AK, md.KEY_CFG_SN_SK, ""}, + md.PVD_JD: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID}, + md.PVD_JDOwn: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID}, + md.PVD_PDD: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID}, + md.PVD_VIP: {md.KEY_CFG_ZM_AK, md.KEY_CFG_ZM_SK, md.KEY_CFG_ZM_WEB_ID}, } func GetAllPlan(eg *xorm.Engine, dbName string) (map[string]*model.PlanReward, map[int]*model.PlanCommission, map[int]string) { @@ -82,6 +83,9 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo rewardOpt = rewardOpts["kuaishouTeam"] } } + if pvd == md.PVD_JDOwn && rewardOpts["jd_own"] == nil { + rewardOpt = rewardOpts["jd"] + } if rewardOpt == nil { return nil, zhios_order_relate_logx.Warn("找不到方案记录") } diff --git a/svc/reward_commission.go b/svc/reward_commission.go index 2262f7a..2687fe4 100644 --- a/svc/reward_commission.go +++ b/svc/reward_commission.go @@ -20,7 +20,7 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b virType := commArr["virType"] if virType == "commission" { rmd.PaidPrice = rmd.Commission - if zhios_order_relate_utils.InArr(provider, []string{md.PVD_TB, md.PVD_TM, md.PVD_PDD, md.PVD_SN, md.PVD_KL, md.PVD_JD, md.PVD_VIP}) == false { + if zhios_order_relate_utils.InArr(provider, []string{md.PVD_TB, md.PVD_TM, md.PVD_PDD, md.PVD_SN, md.PVD_KL, md.PVD_JD, md.PVD_JDOwn, md.PVD_VIP}) == false { rmd.GoodsPrice = rmd.Commission } } @@ -78,7 +78,6 @@ func GetRewardCommission(engine *xorm.Engine, rmd *md.CommissionParam, isShare b if cfg == nil { return 0, 0, 0, 0, nil, errors.New("分佣方案未设置") } - // 获取全部佣金 com, price := getCommission(rmd, provider) fmt.Println(com) @@ -469,7 +468,7 @@ func getCommission(d *md.CommissionParam, provider string) (string, string) { commissionRateF := zhios_order_relate_utils.StrToFloat64(d.CommissionRate) / 100 com := currentPriceF * commissionRateF return zhios_order_relate_utils.Float64ToStr(com), currentPrice - case md.PVD_JD: + case md.PVD_JD, md.PVD_JDOwn: if zhios_order_relate_utils.StrToFloat64(d.GoodsPrice) == 0 { //如果价格没有直接返回佣金 return d.Commission, d.PaidPrice @@ -539,7 +538,7 @@ func currentPrice(m *md.CommissionParam, pvd string) string { return zhios_order_relate_utils.Float64ToStr(price) } return m.WlGoodsPrice - case md.PVD_JD: + case md.PVD_JD, md.PVD_JDOwn: //fmt.Println(m.LowestCouponPrice, m.LowerPrice, m.WlGoodsPrice) if m.LowestCouponPrice == "" { if m.CouponPrice != "" {