diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 3174db913..8461e9aaa 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -3585,7 +3585,7 @@ func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, i return hint, err } -func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, vendorID int, isAsync, isContinueWhenError bool) (hint string, err error) { +func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, vendorID int, ignoreLow, isAsync, isContinueWhenError bool) (hint string, err error) { var ( db = dao.GetDB() jdMap = make(map[int][]*JdStoreSkus) @@ -3650,7 +3650,16 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, for kk, vv := range v { result, err := dao.GetStoreSkuBindByNameID(db, k, kk, model.SkuStatusNormal) if len(result) > 0 && err == nil { - if result[0].UnitPrice > vv { + if ignoreLow { + if result[0].UnitPrice > vv { + storeSkuBindInfo := &StoreSkuBindInfo{ + StoreID: k, + NameID: kk, + UnitPrice: vv, + } + param = append(param, storeSkuBindInfo) + } + } else { storeSkuBindInfo := &StoreSkuBindInfo{ StoreID: k, NameID: kk, @@ -3695,7 +3704,16 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, for kk, vv := range v { result, err := dao.GetStoreSkuBindByNameID(db, k, kk, model.SkuStatusNormal) if len(result) > 0 && err == nil { - if result[0].UnitPrice > vv { + if ignoreLow { + if result[0].UnitPrice > vv { + storeSkuBindInfo := &StoreSkuBindInfo{ + StoreID: k, + NameID: kk, + UnitPrice: vv, + } + param = append(param, storeSkuBindInfo) + } + } else { storeSkuBindInfo := &StoreSkuBindInfo{ StoreID: k, NameID: kk, diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index 1eadb54b3..5bd2a7c54 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -675,6 +675,7 @@ func (c *StoreSkuController) SendSeckillSkusCountMsg() { // @Param token header string true "认证token" // @Param payload formData string true "json数据,JdStoreSkus对象" // @Param vendorID formData int true "厂商ID" +// @Param ignoreLow formData bool true "是否忽略低价商品" // @Param isAsync formData bool true "是否异步,缺省是同步" // @Param isContinueWhenError formData bool true "单个同步失败是否继续,缺省false" // @Success 200 {object} controllers.CallResult @@ -686,7 +687,7 @@ func (c *StoreSkuController) RefreshJxPriceByVendor() { if err = jxutils.Strings2Objs(params.Payload, &skuBindInfos); err != nil { return retVal, "", err } - retVal, err = cms.RefreshJxPriceByVendor(params.Ctx, skuBindInfos, params.VendorID, params.IsAsync, params.IsContinueWhenError) + retVal, err = cms.RefreshJxPriceByVendor(params.Ctx, skuBindInfos, params.VendorID, params.IgnoreLow, params.IsAsync, params.IsContinueWhenError) return retVal, "", err }) }