feat(trading): support multi-item purchase intents
This commit is contained in:
+10
-5
@@ -112,16 +112,22 @@ CREATE TABLE workers (
|
||||
"task_id": "po-20260727-0001", // 可选,上游自带的幂等键;不传则服务端生成
|
||||
"site": "rakuten",
|
||||
"intent": { // gateway 原样透传,结构由 trading 侧定义
|
||||
"item_url": "https://item.rakuten.co.jp/shop/code/",
|
||||
"quantity": 1,
|
||||
"variant_id": "...", // 多规格商品必填,取自 /api/item_detail 的 sku.variants[]
|
||||
"choice": ["名入れ:希望する"], // 店铺自定义必填选项,格式「选项名:取值名」,取自 /api/item_detail 的 options[]
|
||||
"items": [{ // 新格式:一次购买多个商品
|
||||
"item_url": "https://item.rakuten.co.jp/shop/code/",
|
||||
"quantity": 1,
|
||||
"variant_id": "...", // 多规格商品必填,取自 /api/item_detail 的 sku.variants[]
|
||||
"choice": ["名入れ:希望する"] // 店铺自定义必填选项,格式「选项名:取值名」
|
||||
}],
|
||||
"max_total_yen": 30000 // 可选,覆盖本次的金额上限
|
||||
},
|
||||
"callback_url": "https://upstream.example.com/hooks/rakuten-order" // 可选,终结类事件通知,见 §4.8
|
||||
}
|
||||
```
|
||||
|
||||
`items` 必须是非空数组,worker 会按顺序将每项加入同一购物车后再进入结算。
|
||||
为兼容已发布客户端,也可继续使用旧格式:`intent.item_url` 加同级的
|
||||
`quantity` / `variant_id` / `choice`,其语义等同于只有一个元素的 `items`。
|
||||
|
||||
响应 `data`:`{"task_id": "...", "status": "queued", "created": true}`
|
||||
|
||||
**幂等**:同一个 `task_id` 重复提交不新建任务,返回既有任务且 `created=false`。
|
||||
@@ -614,4 +620,3 @@ collector 本身不回写「已经存在于下单任务表 `tasks` 的订单」
|
||||
- [x] 手动 trigger 立即派一轮 list,返回的单在查询队列里可见
|
||||
- [x] `GET /api/account/orders` 列编目;单笔不存在返回 6005
|
||||
- [x] collector 只读规范化字段,不解析 raw/raw_pages 站点原始 JSON
|
||||
|
||||
|
||||
Reference in New Issue
Block a user