- dao.GetPromotionSkuPriceMap

- 京西活动要求不能冲突
This commit is contained in:
gazebo
2019-06-20 11:20:28 +08:00
parent bb7834c268
commit ae9833361a
4 changed files with 85 additions and 43 deletions

View File

@@ -283,13 +283,25 @@ func CreateJdPromotion(ctx *jxcontext.Context, vendorID int, isIDJd bool, isAsyn
Source: PromotionSourceOpenPlatform,
}
if vendorPromotionID == "" && vendorID == model.VendorIDJD {
skuIDs := make([]int, len(params.SkuPrices))
skuPriceMap := make(map[int64]*SkuPrice)
for k, v := range params.SkuPrices {
skuIDs[k] = v.SkuID
skuPriceMap[int64(v.SkuID)] = v
skuIDs := make([]int, len(params.SkuPrices))
skuPriceMap := make(map[int64]*SkuPrice)
for k, v := range params.SkuPrices {
skuIDs[k] = v.SkuID
skuPriceMap[int64(v.SkuID)] = v
}
if len(skuIDs) == 0 {
return "", fmt.Errorf("商品列表为空")
}
if vendorID == model.VendorIDJX {
conflictPromotion, err2 := dao.GetPromotionSkuPriceMap(db, params.StoreIDs, skuIDs, promotion.BeginAt, promotion.EndAt)
if err = err2; err != nil {
return "", err
}
if len(conflictPromotion) > 0 {
return "", fmt.Errorf("有冲突配置:%s", utils.Format4Output(conflictPromotion, true))
}
}
if vendorPromotionID == "" && vendorID == model.VendorIDJD {
sql := `
SELECT t1.*, t2.jd_id, t3.vendor_store_id
FROM store_sku_bind t1