From a4ba27e71516bafaf6fa6aeabd8c59385fd46c8f Mon Sep 17 00:00:00 2001 From: chenchuchuan <13554600537@163.com> Date: Wed, 4 Nov 2026 14:51:32 +0800 Subject: [PATCH] =?UTF-8?q?refactor(lingxing):=20=E9=A2=86=E6=98=9F=20shop?= =?UTF-8?q?ify=20=E6=8E=A5=E5=8F=A3=E6=8C=89=20Target=20=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=EF=BC=9B=E5=BA=97=E9=93=BA=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 平台改名: - platform/shopify/ → platform/target/ - ShopifySubPlatform / ShopifyProductSource / ShopifyListingDto / ShopifyLocationDto → Target* 系列 - Platform.SHOPIFY 保留(供直连场景),领星侧改用 Platform.TARGET - 领星接口路径不变(/basicOpen/multiplatform/shopify/variantList) 店铺过滤: - 各商品 Source 不再无条件拼 store_ids / storeIds / sid / vc_store_ids - 账户 externalStoreId 为空时不传,由平台侧校验是否必填; SDK 不做上层校验,只负责透传 Co-Authored-By: Claude --- .../main/java/common/ecommerce/model/Platform.java | 2 +- .../common/ecommerce/lingxing/LingxingApi.java | 5 +++- .../lingxing/adapter/LingxingAdapter.java | 2 +- .../lingxing/adapter/LingxingAdapterFactory.java | 2 +- .../lingxing/dto/LingxingPlatformInfoDto.java | 2 +- .../lingxing/platform/LingxingOutboundSource.java | 1 - .../platform/LingxingSubPlatformDefaults.java | 4 +-- .../product/AliexpressProductSource.java | 6 ++++- .../amazon/sc/product/AmazonScProductSource.java | 6 ++++- .../amazon/vc/product/AmazonVcProductSource.java | 6 ++++- .../platform/ebay/product/EbayProductSource.java | 6 ++++- .../platform/shein/product/SheinProductSource.java | 6 ++++- .../TargetSubPlatform.java} | 14 +++++----- .../dto/TargetListingDto.java} | 10 +++---- .../dto/TargetLocationDto.java} | 6 ++--- .../product/TargetProductSource.java} | 31 +++++++++++++--------- .../platform/temu/product/TemuProductSource.java | 6 ++++- .../tiktok/product/TiktokProductSource.java | 6 ++++- .../walmart/product/WalmartProductSource.java | 6 ++++- 19 files changed, 84 insertions(+), 43 deletions(-) rename lingxing/src/main/java/common/ecommerce/lingxing/platform/{shopify/ShopifySubPlatform.java => target/TargetSubPlatform.java} (68%) rename lingxing/src/main/java/common/ecommerce/lingxing/platform/{shopify/dto/ShopifyListingDto.java => target/dto/TargetListingDto.java} (90%) rename lingxing/src/main/java/common/ecommerce/lingxing/platform/{shopify/dto/ShopifyLocationDto.java => target/dto/TargetLocationDto.java} (88%) rename lingxing/src/main/java/common/ecommerce/lingxing/platform/{shopify/product/ShopifyProductSource.java => target/product/TargetProductSource.java} (88%) diff --git a/core/src/main/java/common/ecommerce/model/Platform.java b/core/src/main/java/common/ecommerce/model/Platform.java index d08b808..b6e49cd 100644 --- a/core/src/main/java/common/ecommerce/model/Platform.java +++ b/core/src/main/java/common/ecommerce/model/Platform.java @@ -24,7 +24,7 @@ public enum Platform { EBAY, /** SHEIN(首期经领星接入) */ SHEIN, - /** Shopify(首期经领星接入) */ + /** Shopify。当前领星侧该接口按 Target 对接,保留此值以备直连使用。 */ SHOPIFY, /** AliExpress(首期经领星接入) */ ALIEXPRESS, diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/LingxingApi.java b/lingxing/src/main/java/common/ecommerce/lingxing/LingxingApi.java index 7d929e7..570b357 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/LingxingApi.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/LingxingApi.java @@ -50,7 +50,10 @@ public enum LingxingApi { /** Temu 在线商品。POST,offset/length(上限 1000)或游标分页,返回 data.list。 */ LISTING_TEMU("/basicOpen/multiplatform/temu/list", 1), - /** Shopify 在线商品(变体维度)。POST,offset/length(上限 1000),返回 data.list。 */ + /** + * Target 在线商品(领星侧路径仍叫 shopify,返回变体维度)。 + * POST,offset/length(上限 1000),返回 data.list。 + */ LISTING_SHOPIFY("/basicOpen/multiplatform/shopify/variantList", 1), /** eBay 在线商品。POST,offset/length(上限 200),返回 data 数组。 */ diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapter.java b/lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapter.java index 9399b70..b78b795 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapter.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapter.java @@ -125,7 +125,7 @@ public final class LingxingAdapter implements SalesOrderCapable, ProductCapable, @Override public Set platforms() { return EnumSet.of(Platform.AMAZON_SC, Platform.AMAZON_VC, Platform.WALMART_SC, Platform.TIKTOK, - Platform.TEMU, Platform.EBAY, Platform.SHEIN, Platform.SHOPIFY, + Platform.TEMU, Platform.EBAY, Platform.SHEIN, Platform.TARGET, Platform.ALIEXPRESS, Platform.MIRAKL, Platform.CUSTOM); } diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapterFactory.java b/lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapterFactory.java index bb3063a..2034b12 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapterFactory.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/adapter/LingxingAdapterFactory.java @@ -40,7 +40,7 @@ public final class LingxingAdapterFactory implements AdapterFactory { @Override public EnumSet platforms() { return EnumSet.of(Platform.AMAZON_SC, Platform.AMAZON_VC, Platform.WALMART_SC, Platform.TIKTOK, - Platform.TEMU, Platform.EBAY, Platform.SHEIN, Platform.SHOPIFY, + Platform.TEMU, Platform.EBAY, Platform.SHEIN, Platform.TARGET, Platform.ALIEXPRESS, Platform.MIRAKL, Platform.CUSTOM); } diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/dto/LingxingPlatformInfoDto.java b/lingxing/src/main/java/common/ecommerce/lingxing/dto/LingxingPlatformInfoDto.java index dd4edec..185c3cf 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/dto/LingxingPlatformInfoDto.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/dto/LingxingPlatformInfoDto.java @@ -20,7 +20,7 @@ public class LingxingPlatformInfoDto { @JsonProperty("platform_code") private String platformCode; - /** 平台订单唯一标识;Shopify 下与 platform_order_name 不同。 */ + /** 平台订单唯一标识;Target(领星路径 shopify)下与 platform_order_name 不同。 */ @JsonProperty("platform_order_no") private String platformOrderNo; diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingOutboundSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingOutboundSource.java index dfca0a8..4b4e98a 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingOutboundSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingOutboundSource.java @@ -1,6 +1,5 @@ package common.ecommerce.lingxing.platform; -import common.ecommerce.lingxing.platform.LingxingCall; import common.ecommerce.model.fulfillment.OutboundPackage; import common.ecommerce.model.fulfillment.OutboundResult; diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingSubPlatformDefaults.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingSubPlatformDefaults.java index d6b8c64..c624265 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingSubPlatformDefaults.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/LingxingSubPlatformDefaults.java @@ -7,7 +7,7 @@ import common.ecommerce.lingxing.platform.amazon.sc.AmazonScSubPlatform; import common.ecommerce.lingxing.platform.amazon.vc.AmazonVcSubPlatform; import common.ecommerce.lingxing.platform.ebay.EbaySubPlatform; import common.ecommerce.lingxing.platform.shein.SheinSubPlatform; -import common.ecommerce.lingxing.platform.shopify.ShopifySubPlatform; +import common.ecommerce.lingxing.platform.target.TargetSubPlatform; import common.ecommerce.lingxing.platform.temu.TemuSubPlatform; import common.ecommerce.lingxing.platform.tiktok.TiktokSubPlatform; import common.ecommerce.lingxing.platform.walmart.WalmartSubPlatform; @@ -31,7 +31,7 @@ public final class LingxingSubPlatformDefaults { .register(new WalmartSubPlatform(transport, json)) .register(new TemuSubPlatform(transport, json)) .register(new SheinSubPlatform(transport, json)) - .register(new ShopifySubPlatform(transport, json)) + .register(new TargetSubPlatform(transport, json)) .register(new EbaySubPlatform(transport, json)) .register(new AliexpressSubPlatform(transport, json)) .register(new TiktokSubPlatform(transport, json)) diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java index c80f409..bdb85e9 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/aliexpress/product/AliexpressProductSource.java @@ -55,7 +55,11 @@ public final class AliexpressProductSource implements LingxingProductSource { body.put("isParent", IS_CHILD); body.put("offset", offset); body.put("length", length); - body.put("storeIds", Collections.singletonList(parseStoreId(call.ctx().account().externalStoreId()))); + // storeIds 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("storeIds", Collections.singletonList(parseStoreId(storeId))); + } applyTimeWindow(body, query); HttpRequest req = call.signed(LingxingApi.LISTING_ALIEXPRESS, body, "products.pull"); diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java index 24cb038..e235b1d 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/sc/product/AmazonScProductSource.java @@ -48,7 +48,11 @@ public final class AmazonScProductSource implements LingxingProductSource { int offset = query.cursor() == null ? 0 : Integer.parseInt(query.cursor()); Map body = new LinkedHashMap(); - body.put("sid", call.ctx().account().externalStoreId()); + // sid 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("sid", storeId); + } body.put("offset", offset); body.put("length", length); Instant from = query.updatedAfter(); diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/vc/product/AmazonVcProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/vc/product/AmazonVcProductSource.java index fd7b30c..80057e2 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/vc/product/AmazonVcProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/amazon/vc/product/AmazonVcProductSource.java @@ -49,7 +49,11 @@ public final class AmazonVcProductSource implements LingxingProductSource { Map body = new LinkedHashMap(); body.put("offset", offset); body.put("length", length); - body.put("vc_store_ids", Collections.singletonList(call.ctx().account().externalStoreId())); + // vc_store_ids 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("vc_store_ids", Collections.singletonList(storeId)); + } HttpRequest req = call.signed(LingxingApi.LISTING_AMAZON_VC, body, "products.pull"); HttpResponse resp = call.execute(req); LingxingEnvelope envelope = call.envelope(resp, "products.pull"); diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java index e40f2c1..03682c5 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/ebay/product/EbayProductSource.java @@ -55,7 +55,11 @@ public final class EbayProductSource implements LingxingProductSource { Map body = new LinkedHashMap(); body.put("offset", offset); body.put("length", length); - body.put("store_ids", Collections.singletonList(call.ctx().account().externalStoreId())); + // store_ids 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("store_ids", Collections.singletonList(storeId)); + } applyTimeWindow(body, query); HttpRequest req = call.signed(LingxingApi.LISTING_EBAY, body, "products.pull"); diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java index cee6ede..8fa82d3 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/shein/product/SheinProductSource.java @@ -40,7 +40,11 @@ public final class SheinProductSource implements LingxingProductSource { Map body = new LinkedHashMap(); body.put("offset", offset); body.put("length", length); - body.put("storeIds", Collections.singletonList(call.ctx().account().externalStoreId())); + // storeIds 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("storeIds", Collections.singletonList(storeId)); + } HttpRequest req = call.signed(LingxingApi.LISTING_SHEIN, body, "products.pull"); HttpResponse resp = call.execute(req); LingxingEnvelope envelope = call.envelope(resp, "products.pull"); diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/ShopifySubPlatform.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/TargetSubPlatform.java similarity index 68% rename from lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/ShopifySubPlatform.java rename to lingxing/src/main/java/common/ecommerce/lingxing/platform/target/TargetSubPlatform.java index 11c36f2..014bcb7 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/ShopifySubPlatform.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/TargetSubPlatform.java @@ -1,4 +1,4 @@ -package common.ecommerce.lingxing.platform.shopify; +package common.ecommerce.lingxing.platform.target; import common.ecommerce.http.HttpTransport; import common.ecommerce.http.JacksonJsonCodec; @@ -6,26 +6,26 @@ import common.ecommerce.lingxing.platform.LingxingSubPlatform; import common.ecommerce.lingxing.platform.LingxingProductSource; import common.ecommerce.lingxing.platform.multiplatform.outbound.MultiPlatformOutboundSource; import common.ecommerce.lingxing.platform.LingxingOutboundSource; -import common.ecommerce.lingxing.platform.shopify.product.ShopifyProductSource; +import common.ecommerce.lingxing.platform.target.product.TargetProductSource; import common.ecommerce.model.Platform; /** - * 领星 · Shopify 子平台:只做能力组合。 + * 领星 · Target 子平台:只做能力组合。 */ -public final class ShopifySubPlatform implements LingxingSubPlatform { +public final class TargetSubPlatform implements LingxingSubPlatform { /** 快速出库是多平台通用接口,各子平台共用。 */ private static final MultiPlatformOutboundSource OUTBOUND = new MultiPlatformOutboundSource(); private final LingxingProductSource products; - public ShopifySubPlatform(HttpTransport transport, JacksonJsonCodec json) { - this.products = new ShopifyProductSource(); + public TargetSubPlatform(HttpTransport transport, JacksonJsonCodec json) { + this.products = new TargetProductSource(); } @Override public Platform platform() { - return Platform.SHOPIFY; + return Platform.TARGET; } @Override diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/dto/ShopifyListingDto.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetListingDto.java similarity index 90% rename from lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/dto/ShopifyListingDto.java rename to lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetListingDto.java index d1db7e4..0220b98 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/dto/ShopifyListingDto.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetListingDto.java @@ -1,4 +1,4 @@ -package common.ecommerce.lingxing.platform.shopify.dto; +package common.ecommerce.lingxing.platform.target.dto; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -9,16 +9,16 @@ import java.util.ArrayList; import java.util.List; /** - * 领星 · Shopify 在线商品({@code /basicOpen/multiplatform/shopify/variantList} 的 {@code data.list[]})。 + * 领星 · Target 在线商品({@code /basicOpen/multiplatform/shopify/variantList} 的 {@code data.list[]})。 * *

文档字段是 snake_case;这里用 camelCase 的 Java 字段 + {@code @JsonProperty} 映射。

* - *

Shopify 按变体(variant)返回,{@code msku} 是平台侧 SKU。

+ *

Target(领星路径 shopify)按变体(variant)返回,{@code msku} 是平台侧 SKU。

*/ @Getter @Setter @JsonIgnoreProperties(ignoreUnknown = true) -public class ShopifyListingDto { +public class TargetListingDto { /** 商品 ID。 */ @JsonProperty("item_id") @@ -162,5 +162,5 @@ public class ShopifyListingDto { /** 各仓位信息。 */ @JsonProperty("location_infos") - private List locationInfos = new ArrayList(); + private List locationInfos = new ArrayList(); } diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/dto/ShopifyLocationDto.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetLocationDto.java similarity index 88% rename from lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/dto/ShopifyLocationDto.java rename to lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetLocationDto.java index b94f00c..6faf8d1 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/dto/ShopifyLocationDto.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/dto/TargetLocationDto.java @@ -1,15 +1,15 @@ -package common.ecommerce.lingxing.platform.shopify.dto; +package common.ecommerce.lingxing.platform.target.dto; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; -/** Shopify 商品仓位信息({@code location_infos[]})。 */ +/** Target 商品仓位信息({@code location_infos[]})。 */ @Getter @Setter @JsonIgnoreProperties(ignoreUnknown = true) -public class ShopifyLocationDto { +public class TargetLocationDto { /** 仓位 id。 */ @JsonProperty("location_id") diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/product/ShopifyProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java similarity index 88% rename from lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/product/ShopifyProductSource.java rename to lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java index 745c443..3d8e66c 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/shopify/product/ShopifyProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/target/product/TargetProductSource.java @@ -1,4 +1,4 @@ -package common.ecommerce.lingxing.platform.shopify.product; +package common.ecommerce.lingxing.platform.target.product; import common.ecommerce.http.HttpRequest; import common.ecommerce.http.HttpResponse; @@ -6,7 +6,7 @@ import common.ecommerce.lingxing.LingxingApi; import common.ecommerce.lingxing.http.LingxingEnvelope; import common.ecommerce.lingxing.platform.LingxingCall; import common.ecommerce.lingxing.platform.LingxingProductSource; -import common.ecommerce.lingxing.platform.shopify.dto.ShopifyListingDto; +import common.ecommerce.lingxing.platform.target.dto.TargetListingDto; import common.ecommerce.model.ChannelProvider; import common.ecommerce.model.product.ProductListing; import common.ecommerce.model.product.ProductQuery; @@ -27,12 +27,15 @@ import java.util.Locale; import java.util.Map; /** - * 领星 · Shopify 在线商品(变体维度)。 + * 领星 · Target 在线商品(变体维度)。 * *

接口 {@code /basicOpen/multiplatform/shopify/variantList}:POST,{@code offset}/{@code length} * (上限 1000),返回 {@code data.list};令牌桶容量 1。

+ * + *

{@code store_ids} 是非必填项:文档未标必填,不传时返回该 app 下所有店铺的商品。 + * 这里按账户的 {@code externalStoreId} 过滤,避免把其它店铺的商品混进同一个 omsStoreId。

*/ -public final class ShopifyProductSource implements LingxingProductSource { +public final class TargetProductSource implements LingxingProductSource { private static final int MAX_PAGE_SIZE = 1000; @@ -46,16 +49,20 @@ public final class ShopifyProductSource implements LingxingProductSource { Map body = new LinkedHashMap(); body.put("offset", offset); body.put("length", length); - body.put("store_ids", Collections.singletonList(call.ctx().account().externalStoreId())); + // store_ids 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("store_ids", Collections.singletonList(storeId)); + } applyTimeWindow(body, query); HttpRequest req = call.signed(LingxingApi.LISTING_SHOPIFY, body, "products.pull"); HttpResponse resp = call.execute(req); LingxingEnvelope envelope = call.envelope(resp, "products.pull"); - List dtos = call.json().listAt(envelope.body(), "data.list", ShopifyListingDto.class); + List dtos = call.json().listAt(envelope.body(), "data.list", TargetListingDto.class); List out = new ArrayList(dtos.size()); - for (ShopifyListingDto dto : dtos) { + for (TargetListingDto dto : dtos) { out.add(toProductListing(dto, call)); } @@ -98,7 +105,7 @@ public final class ShopifyProductSource implements LingxingProductSource { } /** - * 领星 Shopify 商品 → 统一模型。 + * 领星 Target 商品 → 统一模型。 * *

统一字段来源:

*
    @@ -115,7 +122,7 @@ public final class ShopifyProductSource implements LingxingProductSource { *
  • attributes ← 其余全部原始字段
  • *
*/ - private ProductListing toProductListing(ShopifyListingDto dto, LingxingCall call) { + private ProductListing toProductListing(TargetListingDto dto, LingxingCall call) { ZoneId zone = ZoneId.of(call.ctx().account().marketplaceZone()); String currency = currencyOf(dto.getCurrencyIcon()); String image = firstNonBlank(dto.getPictureUrl(), dto.getParentPictureUrl()); @@ -139,8 +146,8 @@ public final class ShopifyProductSource implements LingxingProductSource { .build(); } - /** Shopify:1 active / 2 draft / 3 archived / 4 deleted。 */ - private static ProductStatus statusOf(ShopifyListingDto dto) { + /** Target:1 active / 2 draft / 3 archived / 4 deleted。 */ + private static ProductStatus statusOf(TargetListingDto dto) { if (dto.getStatus() == null) { String name = dto.getStatusName(); if (name != null) { @@ -170,7 +177,7 @@ public final class ShopifyProductSource implements LingxingProductSource { } } - private static Map attributesOf(ShopifyListingDto dto) { + private static Map attributesOf(TargetListingDto dto) { Map attrs = new LinkedHashMap(); attrs.put("item_id", dto.getItemId()); attrs.put("item_url", dto.getItemUrl()); diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java index 6676df1..a13076a 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/temu/product/TemuProductSource.java @@ -45,7 +45,11 @@ public final class TemuProductSource implements LingxingProductSource { body.put("offset", offset); body.put("length", length); body.put("useCursor", Boolean.FALSE); - body.put("storeIds", Collections.singletonList(call.ctx().account().externalStoreId())); + // storeIds 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("storeIds", Collections.singletonList(storeId)); + } applyTimeWindow(body, query); HttpRequest req = call.signed(LingxingApi.LISTING_TEMU, body, "products.pull"); diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java index f13fc6d..181c86f 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/tiktok/product/TiktokProductSource.java @@ -39,7 +39,11 @@ public final class TiktokProductSource implements LingxingProductSource { Map body = new LinkedHashMap(); body.put("offset", offset); body.put("length", length); - body.put("storeIds", Collections.singletonList(call.ctx().account().externalStoreId())); + // storeIds 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("storeIds", Collections.singletonList(storeId)); + } HttpRequest req = call.signed(LingxingApi.LISTING_TIKTOK, body, "products.pull"); HttpResponse resp = call.execute(req); LingxingEnvelope envelope = call.envelope(resp, "products.pull"); diff --git a/lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java b/lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java index f16724c..3318e8c 100644 --- a/lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java +++ b/lingxing/src/main/java/common/ecommerce/lingxing/platform/walmart/product/WalmartProductSource.java @@ -64,7 +64,11 @@ public final class WalmartProductSource implements LingxingProductSource { Map body = new LinkedHashMap(); body.put("offset", offset); body.put("length", length); - body.put("store_ids", Collections.singletonList(call.ctx().account().externalStoreId())); + // store_ids 非必填:账户配了才传,由平台侧校验是否必填 + String storeId = call.ctx().account().externalStoreId(); + if (storeId != null && !storeId.trim().isEmpty()) { + body.put("store_ids", Collections.singletonList(storeId)); + } applyTimeWindow(body, query); HttpRequest req = call.signed(LingxingApi.LISTING_WALMART, body, "products.pull");