一次修改 1 至 500 个已有商品。该接口支持新增、修改和删除 SKU;新增 SKU 可以设置初始价格,
但不能修改已有 SKU 的市场价或优惠价。

6.1 请求

PUT /openapi/products/actions/batch-update
{
  "products": [
    {
      "spuId": "spu-100001",
      "name": "无水乙醇 AR",
      "brandId": "brand-1001",
      "categoryId": "category-2001",
      "deliveryCycle": "2天",
      "mainImageUrl": "https://supplier.example.com/images/P-100001-v2.jpg",
      "casNumber": "64-17-5",
      "description": "更新后的商品详情",
      "officialWebsite": "https://supplier.example.com/products/P-100001",
      "skus": [
        {
          "originalSpecification": "500ml/瓶",
          "specification": "500mL/瓶"
        },
        {
          "specification": "2L/瓶",
          "marketPrice": 100.00,
          "discountPrice": 89.00
        },
        {
          "originalSpecification": "1L/瓶"
        }
      ]
    },
    {
      "spuId": "spu-100002",
      "name": "甲醇 AR",
      "brandId": "brand-1001",
      "categoryId": "category-2001",
      "deliveryCycle": "3天",
      "mainImageUrl": "https://supplier.example.com/images/P-100002-v2.jpg"
    }
  ]
}

6.2 成功响应

HTTP 状态码:200 OK

{
  "code": "SUCCESS",
  "message": "批量修改处理完成",
  "data": {
    "totalCount": 2,
    "successCount": 1,
    "failureCount": 1,
    "successes": [
      {
        "index": 0,
        "spuId": "spu-100001",
        "productCode": "P-100001"
      }
    ],
    "failures": [
      {
        "index": 1,
        "spuId": "spu-100002",
        "code": "PRODUCT_NOT_FOUND",
        "message": "商品不存在或不属于当前供应商",
        "fields": ["spuId"],
        "sourceData": {
          "spuId": "spu-100002",
          "name": "甲醇 AR",
          "brandId": "brand-1001"
        }
      }
    ]
  }
}

6.3 业务规则

  • products 必填,数量为 1 至 500。
  • 每条商品必须传 spuId,平台使用“当前供应商 + spuId”定位商品。
  • spuId 必须属于当前供应商,不能通过修改接口变更。
  • 商品货号不允许通过修改接口变更。
  • 新增 SKU 只传 specification,并必须提供 marketPrice 和 discountPrice。
  • 修改 SKU 同时传 originalSpecification 和 specification,不允许传价格。
  • 删除 SKU 只传 originalSpecification,不允许传价格;商品至少保留一个 SKU。
  • 已有 SKU 的价格必须通过价格更新接口修改。
  • 请求中没有出现的原有 SKU 保持不变。
  • 修改商品名称、品牌、类目、主图、CAS 号、详情或者 SKU 规格后,商品直接上架。
  • 同一条商品修改失败时,该条商品不保存部分修改。
作者:吴群杰  创建时间:2026-10-10 16:16
最后编辑:吴群杰  更新时间:2026-10-10 17:37