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 a884d8c..2c52492 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 @@ -128,7 +128,9 @@ public final class AliexpressProductSource implements LingxingProductSource { *
  • imageUrls ← {@code skuImage},为空时用 {@code imageUrls}(父体图)
  • *
  • status ← {@code status}(文档只给了「可售」=2,其余归 UNKNOWN)
  • *
  • rawStatus ← {@code statusName} 原值(中文)
  • - *
  • price ← {@code effectiveSupplyPrice} + {@code currencyCode}
  • + *
  • price ← 优先 {@code effectiveSupplyPrice}(已格式化的字符串); + * 缺失时用 {@code price}(单位:分)除以 100 转成标准金额; + * 再缺失时取当前生效的 {@code supplyPriceList} 条目
  • *
  • listedAt ← {@code createTime}(北京时间,按 UTC 换算)
  • *
  • updatedAt ← 无
  • *
  • attributes ← 其余全部原始字段
  • @@ -138,7 +140,10 @@ public final class AliexpressProductSource implements LingxingProductSource { ZoneId zone = ZoneId.of(call.ctx().account().marketplaceZone()); String image = firstNonBlank(dto.getSkuImage(), dto.getImageUrls()); String currency = trimToNull(dto.getCurrencyCode()); - String price = firstNonBlank(dto.getEffectiveSupplyPrice(), currentSupplyPrice(dto.getSupplyPriceList())); + String price = firstNonBlank( + dto.getEffectiveSupplyPrice(), + centsToAmount(dto.getPrice()), + currentSupplyPrice(dto.getSupplyPriceList())); return ProductListing.builder() .platform(call.ctx().platform()) @@ -157,6 +162,19 @@ public final class AliexpressProductSource implements LingxingProductSource { .build(); } + /** + * 接口的 {@code price} 单位是分,统一模型用标准金额(元),此处除以 100。 + * + *

    文档示例 99990000 与 effectiveSupplyPrice 59.99 不一致,属于文档笔误; + * 以「单位分」为准做换算。

    + */ + private static String centsToAmount(Long cents) { + if (cents == null) { + return null; + } + return java.math.BigDecimal.valueOf(cents, 2).toPlainString(); + } + /** 当前生效供货价:优先 endStr 为空,否则取 beginStr 最大的一条。 */ private static String currentSupplyPrice(List prices) { if (prices == null || prices.isEmpty()) {