qmai-cli-public 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/npm/install.js +128 -32
- package/package.json +2 -1
- package/skills/qmai-delivery/SKILL.md +52 -0
- package/skills/qmai-delivery/references/qmai-delivery-order.md +23 -0
- package/skills/qmai-delivery/references/qmai-delivery-status.md +19 -0
- package/skills/qmai-finance/SKILL.md +53 -0
- package/skills/qmai-finance/references/qmai-finance-statement.md +22 -0
- package/skills/qmai-finance/references/qmai-finance-stats.md +22 -0
- package/skills/qmai-inventory/SKILL.md +72 -0
- package/skills/qmai-inventory/references/qmai-inventory-master.md +29 -0
- package/skills/qmai-inventory/references/qmai-inventory-sales.md +25 -0
- package/skills/qmai-inventory/references/qmai-inventory-stock.md +29 -0
- package/skills/qmai-marketing/SKILL.md +80 -0
- package/skills/qmai-marketing/references/qmai-marketing-card-pricing.md +29 -0
- package/skills/qmai-marketing/references/qmai-marketing-coupon.md +27 -0
- package/skills/qmai-member/SKILL.md +175 -0
- package/skills/qmai-member/references/qmai-member-asset.md +35 -0
- package/skills/qmai-member/references/qmai-member-profile-tag.md +51 -0
- package/skills/qmai-order/SKILL.md +64 -0
- package/skills/qmai-order/references/qmai-order-query.md +26 -0
- package/skills/qmai-order/references/qmai-order-write.md +21 -0
- package/skills/qmai-product/SKILL.md +183 -0
- package/skills/qmai-product/references/qmai-product-advanced.md +92 -0
- package/skills/qmai-product/references/qmai-product-batch.md +113 -0
- package/skills/qmai-product/references/qmai-product-category.md +67 -0
- package/skills/qmai-product/references/qmai-product-crud.md +126 -0
- package/skills/qmai-queue/SKILL.md +38 -0
- package/skills/qmai-queue/references/qmai-queue-read.md +21 -0
- package/skills/qmai-shared/SKILL.md +155 -0
- package/skills/qmai-shared/references/qmai-shared-auth.md +54 -0
- package/skills/qmai-shared/references/qmai-shared-config.md +69 -0
- package/skills/qmai-store/SKILL.md +90 -0
- package/skills/qmai-store/references/qmai-store-read.md +45 -0
- package/skills/qmai-store/references/qmai-store-write.md +44 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qmai-product
|
|
3
|
+
version: 3.1.0
|
|
4
|
+
description: "商品管理:列表、同步、上下架、估清、售罄、置满、做法启停、实时查询、批量导入导出、批量调价"
|
|
5
|
+
metadata:
|
|
6
|
+
bins: [qmai]
|
|
7
|
+
help: "qmai product --help"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
> 前置条件: 请先阅读 ../qmai-shared/SKILL.md 了解认证和配置
|
|
11
|
+
|
|
12
|
+
## 核心概念
|
|
13
|
+
|
|
14
|
+
- **列表商品 (OpenProduct)**: API 返回的商品结构,字段包括 id(数字ID)、name(名称)、status(10=上架/20=下架)、showPriceLow(价格,单位:分)、categoryNameList(分类名数组)、goodsSkuList(SKU列表)
|
|
15
|
+
- **同步商品 (ShopGoods)**: 创建/更新用的输入,用户只需填写 tradeName/tradePrice/tradeNo/className/stock 五个字段,Sync() 方法会自动补全 20+ 个 API 必填字段
|
|
16
|
+
- **SaleChannel**: 1(堂食)| 2(外卖)| 11(堂食+外卖)
|
|
17
|
+
- **SaleType**: 1(普通商品)| 2(套餐)
|
|
18
|
+
- **shopCode**: 门店编码,从 profile config 自动读取
|
|
19
|
+
- **tradeMark**: SKU 级别的商品标识,用于上下架操作(BatchUp/BatchDown)
|
|
20
|
+
|
|
21
|
+
## Shortcuts(推荐优先使用)
|
|
22
|
+
|
|
23
|
+
| Shortcut | 说明 | 示例 |
|
|
24
|
+
|----------|------|------|
|
|
25
|
+
| +quick-add | 快速添加商品 | `qmai product +quick-add "拿铁" 32.00` |
|
|
26
|
+
| +on-sale | 批量上架 | `qmai product +on-sale --trade-marks TM001,TM002` |
|
|
27
|
+
| +off-sale | 批量下架 | `qmai product +off-sale --trade-marks TM001` |
|
|
28
|
+
| +price-adjust | 快速调价 | `qmai product +price-adjust +10%` |
|
|
29
|
+
|
|
30
|
+
## API 命令
|
|
31
|
+
|
|
32
|
+
### 商品列表
|
|
33
|
+
```bash
|
|
34
|
+
qmai product list [--name 咖啡] [--sale-channel 1] [--sale-type 1] [--page 1] [--page-size 20]
|
|
35
|
+
```
|
|
36
|
+
> 注意: page-size 最大 50
|
|
37
|
+
|
|
38
|
+
### 商品详情
|
|
39
|
+
```bash
|
|
40
|
+
qmai product get <id|name>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 创建/同步商品(通过 Sync API)
|
|
44
|
+
```bash
|
|
45
|
+
qmai product create --name "美式咖啡" --price 28.00 --trade-no P001 [--class 饮品]
|
|
46
|
+
qmai product create --from-json goods.json
|
|
47
|
+
qmai product create --name "拿铁" --price 32.00 --dry-run
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 更新商品(通过 Sync API)
|
|
51
|
+
```bash
|
|
52
|
+
qmai product update <tradeNo> --name "新名称" --price 30.00 [--class 饮品]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 下架商品
|
|
56
|
+
```bash
|
|
57
|
+
qmai product delete <tradeMark> --force [--sale-channel 1]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 批量上架/下架
|
|
61
|
+
```bash
|
|
62
|
+
qmai product batch-status --action up --trade-marks TM001,TM002 [--sale-channel 1]
|
|
63
|
+
qmai product batch-status --action down --trade-marks TM001 --dry-run
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 估清 / 取消估清
|
|
67
|
+
```bash
|
|
68
|
+
qmai product estimate-clear --trade-mark TM001 --dry-run
|
|
69
|
+
qmai product cancel-estimate-clear --trade-mark TM001
|
|
70
|
+
qmai product cancel-estimate-clear --trade-marks TM001,TM002 --sale-channel 1 --sale-type 2
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 售罄 / 置满
|
|
74
|
+
```bash
|
|
75
|
+
qmai product sold-out --trade-marks TM001,TM002 --sale-channels 3 --sale-types 1
|
|
76
|
+
qmai product fill-full --trade-marks TM001 --sale-channels 3 --sale-types 1 --dry-run
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 做法启停
|
|
80
|
+
```bash
|
|
81
|
+
qmai product practice-status --practice-values 少糖,去冰 --status 1
|
|
82
|
+
qmai product practice-status --practice-values 热饮 --status 0 --dry-run
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 实时数据 / 加料 / 支持做法的商品列表
|
|
86
|
+
```bash
|
|
87
|
+
qmai product attach-list --sale-channel 3 --sale-type 1
|
|
88
|
+
qmai product list-with-practice --sale-channel 3 --sale-type 1 --status 10 --include-properties PRACTICE,SKU
|
|
89
|
+
qmai product energy --goods-id 20001 --store-id 10001
|
|
90
|
+
qmai product realtime --store-id 10001 --goods-ids 20001,20002 --sale-channel 3 --sale-type 1
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 删除任务
|
|
94
|
+
```bash
|
|
95
|
+
qmai product delete-task --sale-channel 3 --sale-type 1 --trade-marks TM001,TM002 --dry-run
|
|
96
|
+
qmai product delete-task --sale-channel 4 --sale-type 0 --spec-codes SKU001,SKU002
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 批量导入(通过 Sync API)
|
|
100
|
+
```bash
|
|
101
|
+
qmai product import --file products.csv --dry-run # 预览
|
|
102
|
+
qmai product import --file products.csv # 执行
|
|
103
|
+
qmai product import --file products.json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 批量导出
|
|
107
|
+
```bash
|
|
108
|
+
qmai product export --file products.csv
|
|
109
|
+
qmai product export --file products.json --name 咖啡
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 批量调价
|
|
113
|
+
```bash
|
|
114
|
+
qmai product batch-price --adjust +10% --dry-run
|
|
115
|
+
qmai product batch-price --adjust -5%
|
|
116
|
+
qmai product batch-price --adjust +2.00
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 分类
|
|
120
|
+
```bash
|
|
121
|
+
qmai product category # 提示通过 --class 参数在创建/同步时指定分类
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 开放平台 API 端点
|
|
125
|
+
|
|
126
|
+
| 操作 | 端点 |
|
|
127
|
+
|------|------|
|
|
128
|
+
| 商品列表 | POST /v3/goods/item/getItemList |
|
|
129
|
+
| 商品同步 | POST /v3/goods/sync/shopGoodsSync |
|
|
130
|
+
| 批量上架 | POST /v3/goods/item/externalUp |
|
|
131
|
+
| 批量下架 | POST /v3/goods/item/externalDown |
|
|
132
|
+
| 估清 | POST /v3/goods/item/sellOut |
|
|
133
|
+
| 取消估清 | POST /v3/goods/item/fillUp |
|
|
134
|
+
| 批量售罄 | POST /v3/goods/item/externalEmpty |
|
|
135
|
+
| 批量置满 | POST /v3/goods/item/externalFull |
|
|
136
|
+
| 查询门店加料列表 | POST /v3/goods/item/shopGoodsAttachList |
|
|
137
|
+
| 查询门店商品列表(支持做法) | POST /v3/goods/item/getShopGoodsList |
|
|
138
|
+
| 查询商品能量值 | POST /v3/goods/nutritional/energy |
|
|
139
|
+
| 门店商品实时数据查询 | POST /v3/newPattern/goodsCenter/post/v2/item/real-time/list |
|
|
140
|
+
| 门店商品做法启用停用 | POST /v3/goods/item/practiceOnOff |
|
|
141
|
+
| 提交商品删除任务 | POST /v3/goods/sync/tripartiteShopGoodsDel |
|
|
142
|
+
|
|
143
|
+
## API 响应结构
|
|
144
|
+
|
|
145
|
+
### 列表响应 (getItemList)
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"data": {
|
|
149
|
+
"data": [ ... ], // 商品数组(注意:嵌套在 data.data 中)
|
|
150
|
+
"total": 380
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 商品对象字段
|
|
156
|
+
| 字段 | 类型 | 说明 |
|
|
157
|
+
|------|------|------|
|
|
158
|
+
| id | int64 | 商品列表 ID |
|
|
159
|
+
| goodsId | int64 | 底层商品 ID |
|
|
160
|
+
| name | string | 商品名称 |
|
|
161
|
+
| status | int | 10=上架, 20=下架 |
|
|
162
|
+
| showPriceLow | int | 价格(**单位:分**,显示时 /100) |
|
|
163
|
+
| categoryNameList | []string | 分类名称数组 |
|
|
164
|
+
| goodsSkuList | []object | SKU 列表,含 skuId/tradeMark/salePrice/inventory |
|
|
165
|
+
| saleChannel | int | 销售渠道 |
|
|
166
|
+
|
|
167
|
+
## 注意事项(Agent 必读)
|
|
168
|
+
|
|
169
|
+
- **价格单位**: 列表 API 返回的 showPriceLow/showPriceHigh 单位是**分**,显示时需除以 100
|
|
170
|
+
- **状态码**: 10=上架, 20=下架(不是 1/0)
|
|
171
|
+
- **库存类型**: API 返回的 inventory 可能是 int 或 float,代码中用 float64 接收
|
|
172
|
+
- **分页限制**: page-size 最大 50
|
|
173
|
+
- **Sync API 必填字段多**: 用户只需填 5 个字段,Sync() 自动补全 pictureUrlList、categoryList(含 name/mark/isRequired/isBackend/isFront)、skuList(含 tradeMark/marketPrice/stock/clearStatus)、saleTime 等
|
|
174
|
+
- **同步是异步的**: Sync API 返回成功后,商品不会立即出现在列表中
|
|
175
|
+
- **删除任务不可撤销**: `delete-task` 只是提交删除任务,但业务效果不可撤销
|
|
176
|
+
- **实时数据查询**: `realtime` 需要 `storeId`,不是 `shopCode`
|
|
177
|
+
- **支持做法列表**: `list-with-practice` 需要显式传 `saleChannel`、`saleType` 和 `status`
|
|
178
|
+
- 批量操作前务必使用 `--dry-run` 预览
|
|
179
|
+
- 价格调整不可撤回,建议先 `export` 备份
|
|
180
|
+
- 下架操作需要 `--force` 确认
|
|
181
|
+
- 导入 CSV 首行必须为表头: trade_name,trade_price,trade_no,class_name,stock
|
|
182
|
+
- shopCode 从 profile config 自动读取,无需手动指定
|
|
183
|
+
- Debug 模式 (`--debug`) 会在一行日志中打印完整请求和响应 JSON
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# 商品高级命令指南
|
|
2
|
+
|
|
3
|
+
## 估清与取消估清
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# 商品估清
|
|
7
|
+
qmai product estimate-clear --trade-mark TM001
|
|
8
|
+
|
|
9
|
+
# 取消估清
|
|
10
|
+
qmai product cancel-estimate-clear --trade-mark TM001
|
|
11
|
+
|
|
12
|
+
# 指定渠道和售卖类型取消估清
|
|
13
|
+
qmai product cancel-estimate-clear \
|
|
14
|
+
--trade-marks TM001,TM002 \
|
|
15
|
+
--sale-channel 1 \
|
|
16
|
+
--sale-type 2 \
|
|
17
|
+
--is-all-empty 1
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
> `estimate-clear` 走 `sellOut`,`cancel-estimate-clear` 走 `fillUp`。
|
|
21
|
+
|
|
22
|
+
## 售罄与置满
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 批量售罄
|
|
26
|
+
qmai product sold-out --trade-marks TM001,TM002 --sale-channels 3 --sale-types 1
|
|
27
|
+
|
|
28
|
+
# 批量置满
|
|
29
|
+
qmai product fill-full --trade-marks TM001 --sale-channels 3 --sale-types 1 --dry-run
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> `sold-out` 走 `externalEmpty`,`fill-full` 走 `externalFull`。
|
|
33
|
+
|
|
34
|
+
## 做法启停
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 启用做法
|
|
38
|
+
qmai product practice-status --practice-values 少糖,去冰 --status 1
|
|
39
|
+
|
|
40
|
+
# 停用做法
|
|
41
|
+
qmai product practice-status --practice-values 热饮 --status 0
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 支持做法商品列表
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
qmai product list-with-practice \
|
|
48
|
+
--sale-channel 3 \
|
|
49
|
+
--sale-type 1 \
|
|
50
|
+
--status 10 \
|
|
51
|
+
--include-properties PRACTICE,SKU,ATTACH
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
必填项:
|
|
55
|
+
- `--sale-channel`
|
|
56
|
+
- `--sale-type`
|
|
57
|
+
- `--status`
|
|
58
|
+
|
|
59
|
+
## 门店加料列表
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
qmai product attach-list --sale-channel 3 --sale-type 1
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 门店商品实时数据
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
qmai product energy --goods-id 20001 --store-id 10001
|
|
69
|
+
|
|
70
|
+
qmai product realtime \
|
|
71
|
+
--store-id 10001 \
|
|
72
|
+
--goods-ids 20001,20002 \
|
|
73
|
+
--sale-channel 3 \
|
|
74
|
+
--sale-type 1
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> `realtime` 用的是 `storeId`,不是 `shopCode`。
|
|
78
|
+
|
|
79
|
+
## 删除任务
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# 按商品标识删除
|
|
83
|
+
qmai product delete-task --sale-channel 3 --sale-type 1 --trade-marks TM001,TM002 --dry-run
|
|
84
|
+
|
|
85
|
+
# 按规格码删除
|
|
86
|
+
qmai product delete-task --sale-channel 4 --sale-type 0 --spec-codes SKU001,SKU002
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
注意:
|
|
90
|
+
- 删除任务只会返回 `taskId`
|
|
91
|
+
- 该操作不可撤销
|
|
92
|
+
- 必须先确认渠道和售卖类型是否正确
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# 批量操作指南
|
|
2
|
+
|
|
3
|
+
## 批量导入(通过 Sync API)
|
|
4
|
+
|
|
5
|
+
### CSV 格式
|
|
6
|
+
|
|
7
|
+
首行表头,后续为数据行:
|
|
8
|
+
```csv
|
|
9
|
+
trade_name,trade_price,trade_no,class_name,stock
|
|
10
|
+
美式咖啡,28.00,P001,饮品,100
|
|
11
|
+
拿铁,32.00,P002,饮品,100
|
|
12
|
+
抹茶拿铁,35.00,P003,饮品,50
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### JSON 格式
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
[
|
|
19
|
+
{"tradeName": "美式咖啡", "tradePrice": 28.00, "tradeNo": "P001", "className": "饮品"},
|
|
20
|
+
{"tradeName": "拿铁", "tradePrice": 32.00, "tradeNo": "P002", "className": "饮品"}
|
|
21
|
+
]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
> 用户只需提供 5 个字段,`Sync()` 方法会自动补全所有 API 必填字段(pictureUrlList、categoryList、skuList、saleTime 等)
|
|
25
|
+
|
|
26
|
+
### 导入命令
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# 先预览
|
|
30
|
+
qmai product import --file products.csv --dry-run
|
|
31
|
+
|
|
32
|
+
# 确认后执行(调用 shopGoodsSync)
|
|
33
|
+
qmai product import --file products.csv
|
|
34
|
+
|
|
35
|
+
# 跳过错误行继续
|
|
36
|
+
qmai product import --file products.csv --skip-errors
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **注意**: Sync API 是异步的,导入成功后商品不会立即出现在列表中
|
|
40
|
+
|
|
41
|
+
## 批量导出
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 导出为 CSV
|
|
45
|
+
qmai product export --file backup.csv
|
|
46
|
+
|
|
47
|
+
# 导出为 JSON
|
|
48
|
+
qmai product export --file backup.json
|
|
49
|
+
|
|
50
|
+
# 按名称筛选
|
|
51
|
+
qmai product export --file drinks.csv --name 咖啡
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
导出 CSV 表头为: `id,name,price,status,inventory,category`
|
|
55
|
+
|
|
56
|
+
> 注意: 导出最多一次获取 50 条(API 分页限制)
|
|
57
|
+
|
|
58
|
+
## 批量调价
|
|
59
|
+
|
|
60
|
+
### 百分比调价
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# 全品涨价 10%(先预览)
|
|
64
|
+
qmai product batch-price --adjust +10% --dry-run
|
|
65
|
+
|
|
66
|
+
# 降价 5%
|
|
67
|
+
qmai product batch-price --adjust -5%
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 固定金额调价
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# 所有商品涨 2 元
|
|
74
|
+
qmai product batch-price --adjust +2.00
|
|
75
|
+
|
|
76
|
+
# 降 1.5 元
|
|
77
|
+
qmai product batch-price --adjust -1.50
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Dry-run 输出示例
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
[dry-run] 将要调整 5 个商品价格:
|
|
84
|
+
美式咖啡: 28.00 → 30.80
|
|
85
|
+
拿铁: 32.00 → 35.20
|
|
86
|
+
卡布奇诺: 30.00 → 33.00
|
|
87
|
+
摩卡: 35.00 → 38.50
|
|
88
|
+
冰美式: 25.00 → 27.50
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
> 批量调价内部流程:先通过 List API 查询当前价格(单位:分,/100 转为元),计算新价格后通过 Sync API 更新
|
|
92
|
+
|
|
93
|
+
## 批量上下架
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# 批量上架(调用 externalUp API)
|
|
97
|
+
qmai product batch-status --action up --trade-marks TM001,TM002 [--sale-channel 1]
|
|
98
|
+
|
|
99
|
+
# 批量下架(调用 externalDown API)
|
|
100
|
+
qmai product batch-status --action down --trade-marks TM001 --dry-run
|
|
101
|
+
|
|
102
|
+
# 预览
|
|
103
|
+
qmai product batch-status --action up --trade-marks TM001,TM002 --dry-run
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
> `--trade-marks` 的值来自商品 SKU 的 tradeMark 字段(可通过 `qmai product list --format json` 查看 goodsSkuList[].tradeMark)
|
|
107
|
+
|
|
108
|
+
## 安全建议
|
|
109
|
+
|
|
110
|
+
1. **操作前备份**: `qmai product export --file backup.json`
|
|
111
|
+
2. **先 Dry-run**: 所有批量操作先 `--dry-run` 预览
|
|
112
|
+
3. **调价不可撤回**: 价格修改后无法自动回滚,保留备份
|
|
113
|
+
4. **分步执行**: 大批量操作建议按分类分步执行
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 分类管理
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
|
|
5
|
+
开放平台的分类通过 `className` 字段在商品同步(Sync API)时自动关联,**无独立的分类 CRUD API**。
|
|
6
|
+
|
|
7
|
+
## 工作方式
|
|
8
|
+
|
|
9
|
+
1. 在创建/同步商品时通过 `--class` 参数或 CSV 的 `class_name` 列指定分类名称
|
|
10
|
+
2. `Sync()` 方法自动构建 `categoryList`,包含 `name`/`mark`/`categoryName`/`isRequired`/`isBackend`/`isFront`/`sort`/`type` 等必填字段
|
|
11
|
+
3. 平台会自动匹配已有分类或创建新分类
|
|
12
|
+
4. 分类信息可在商品列表返回结果的 `categoryNameList` 字段中查看
|
|
13
|
+
|
|
14
|
+
## Sync API 的分类结构
|
|
15
|
+
|
|
16
|
+
用户只需提供 `className`(字符串),代码自动生成完整的分类对象:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"categoryList": [{
|
|
21
|
+
"name": "饮品",
|
|
22
|
+
"categoryName": "饮品",
|
|
23
|
+
"mark": "饮品",
|
|
24
|
+
"isRequired": 0,
|
|
25
|
+
"isBackend": 0,
|
|
26
|
+
"isFront": 0,
|
|
27
|
+
"sort": 0,
|
|
28
|
+
"type": 0
|
|
29
|
+
}]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 使用示例
|
|
34
|
+
|
|
35
|
+
### 同步时指定分类
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 创建商品时指定分类
|
|
39
|
+
qmai product create --name "美式咖啡" --price 28.00 --class 饮品
|
|
40
|
+
|
|
41
|
+
# 批量导入时在 CSV 中指定
|
|
42
|
+
trade_name,trade_price,trade_no,class_name,stock
|
|
43
|
+
美式咖啡,28.00,P001,饮品,100
|
|
44
|
+
拿铁,32.00,P002,饮品,100
|
|
45
|
+
三明治,15.00,P003,小食,50
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 查看分类
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 列表中查看分类列
|
|
52
|
+
qmai product list
|
|
53
|
+
|
|
54
|
+
# JSON 输出查看分类
|
|
55
|
+
qmai product list --format json
|
|
56
|
+
|
|
57
|
+
# 分类提示命令
|
|
58
|
+
qmai product category
|
|
59
|
+
# → 提示: 通过 --class 参数在创建/同步时指定分类
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 注意事项
|
|
63
|
+
|
|
64
|
+
- `className` 为字符串,平台按名称匹配
|
|
65
|
+
- 不支持分类的独立创建、删除、排序操作
|
|
66
|
+
- 修改商品分类 = 同步时传入新的 `className`
|
|
67
|
+
- 不指定分类时,`categoryList` 传空数组 `[]`
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# 商品增删改查操作指南
|
|
2
|
+
|
|
3
|
+
## 数据结构
|
|
4
|
+
|
|
5
|
+
### 列表返回 (OpenProduct)
|
|
6
|
+
|
|
7
|
+
| 字段 | 类型 | 说明 |
|
|
8
|
+
|------|------|------|
|
|
9
|
+
| id | int64 | 商品列表 ID |
|
|
10
|
+
| goodsId | int64 | 底层商品 ID |
|
|
11
|
+
| name | string | 商品名称 |
|
|
12
|
+
| status | int | 10=上架, 20=下架 |
|
|
13
|
+
| showPriceLow | int | 最低价(**单位:分**) |
|
|
14
|
+
| showPriceHigh | int | 最高价(**单位:分**) |
|
|
15
|
+
| saleChannel | int | 销售渠道: 1=堂食, 2=外卖, 11=堂食+外卖 |
|
|
16
|
+
| categoryNameList | []string | 分类名称数组 |
|
|
17
|
+
| goodsSkuList | []GoodsSku | SKU 列表 |
|
|
18
|
+
|
|
19
|
+
### SKU (GoodsSku)
|
|
20
|
+
|
|
21
|
+
| 字段 | 类型 | 说明 |
|
|
22
|
+
|------|------|------|
|
|
23
|
+
| skuId | string | SKU ID |
|
|
24
|
+
| tradeMark | string | 商品编码(用于上下架) |
|
|
25
|
+
| salePrice | float64 | 销售价(元) |
|
|
26
|
+
| inventory | float64 | 库存(API 可能返回 int 或 float) |
|
|
27
|
+
|
|
28
|
+
### 同步输入 (ShopGoods)
|
|
29
|
+
|
|
30
|
+
用户只需填写以下 5 个字段,`Sync()` 自动补全 20+ 个 API 必填字段:
|
|
31
|
+
|
|
32
|
+
| 字段 | 类型 | 说明 |
|
|
33
|
+
|------|------|------|
|
|
34
|
+
| tradeName | string | 商品名称(必填) |
|
|
35
|
+
| tradePrice | float64 | 价格(必填,> 0) |
|
|
36
|
+
| tradeNo | string | 商户自定义编号 |
|
|
37
|
+
| className | string | 分类名称 |
|
|
38
|
+
| stock | int | 库存(默认 9999) |
|
|
39
|
+
|
|
40
|
+
## 创建商品(通过 Sync API)
|
|
41
|
+
|
|
42
|
+
### 命令行方式
|
|
43
|
+
```bash
|
|
44
|
+
qmai product create --name "美式咖啡" --price 28.00 --trade-no P001 --class 饮品
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### JSON 文件方式
|
|
48
|
+
```bash
|
|
49
|
+
qmai product create --from-json goods.json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`goods.json` 示例(只需包含用户关心的字段):
|
|
53
|
+
```json
|
|
54
|
+
[
|
|
55
|
+
{"tradeName": "美式咖啡", "tradePrice": 28.00, "tradeNo": "P001", "className": "饮品"},
|
|
56
|
+
{"tradeName": "拿铁", "tradePrice": 32.00, "tradeNo": "P002", "className": "饮品"}
|
|
57
|
+
]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Dry-run 预览
|
|
61
|
+
```bash
|
|
62
|
+
$ qmai product create --name "拿铁" --price 32.00 --dry-run
|
|
63
|
+
[dry-run] 将要同步 1 个商品:
|
|
64
|
+
拿铁 (32.00)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
> **注意**: Sync API 是异步的,创建成功后商品不会立即出现在列表中
|
|
68
|
+
|
|
69
|
+
## 查询商品
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# 全部商品(默认每页 20 条,最大 50)
|
|
73
|
+
qmai product list
|
|
74
|
+
|
|
75
|
+
# 按名称搜索
|
|
76
|
+
qmai product list --name 咖啡
|
|
77
|
+
|
|
78
|
+
# 按销售渠道
|
|
79
|
+
qmai product list --sale-channel 1
|
|
80
|
+
|
|
81
|
+
# 按类型
|
|
82
|
+
qmai product list --sale-type 1
|
|
83
|
+
|
|
84
|
+
# 分页
|
|
85
|
+
qmai product list --page 1 --page-size 50
|
|
86
|
+
|
|
87
|
+
# JSON 输出
|
|
88
|
+
qmai product list --format json
|
|
89
|
+
|
|
90
|
+
# 商品详情(按 ID 或名称)
|
|
91
|
+
qmai product get <id|name>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 列表输出示例
|
|
95
|
+
```
|
|
96
|
+
ID 名称 价格 状态 库存 分类
|
|
97
|
+
-- ------ ------ ------ ------ ------
|
|
98
|
+
1185299121892380796 桃花落拿铁 21.00 上架 9999 咖啡系列
|
|
99
|
+
1185299121892380733 春樱拿铁 21.00 上架 9999 咖啡系列
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 更新商品(通过 Sync API)
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# 改名(--name 必填)
|
|
106
|
+
qmai product update <tradeNo> --name "新品名" --price 35.00
|
|
107
|
+
|
|
108
|
+
# 改分类
|
|
109
|
+
qmai product update <tradeNo> --name "原名称" --class 饮品
|
|
110
|
+
|
|
111
|
+
# 多字段更新
|
|
112
|
+
qmai product update <tradeNo> --name "新品" --price 30.00 --class 小食
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 下架商品
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# 需要 --force 确认(通过 BatchDown API)
|
|
119
|
+
qmai product delete <tradeMark> --force --sale-channel 1
|
|
120
|
+
|
|
121
|
+
# 不带 --force 只提示
|
|
122
|
+
$ qmai product delete <tradeMark>
|
|
123
|
+
确定要下架商品 <tradeMark> 吗?使用 --force 确认
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> 下架通过 BatchDown API 实现,将商品 status 从 10 改为 20
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qmai-queue
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "排队服务:查询门店排队进度、订单排队进度和叫号列表"
|
|
5
|
+
metadata:
|
|
6
|
+
bins: [qmai]
|
|
7
|
+
help: "qmai queue --help"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
> 前置条件: 请先阅读 ../qmai-shared/SKILL.md 了解认证和配置
|
|
11
|
+
|
|
12
|
+
## 核心概念
|
|
13
|
+
|
|
14
|
+
- **shop-progress**: 批量查询门店当前排队进度
|
|
15
|
+
- **order-progress**: 查询单笔订单的排队进度
|
|
16
|
+
- **shop-queue-nos**: 查询门店叫号列表
|
|
17
|
+
|
|
18
|
+
## 命令概览
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
qmai queue shop-progress --shop-type 1 --shop-ids 1001,1002
|
|
22
|
+
qmai queue order-progress --order-no O20260407001
|
|
23
|
+
qmai queue shop-queue-nos --shop-code S001 --page 1 --size 10
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 开放平台 API 端点
|
|
27
|
+
|
|
28
|
+
| 操作 | 端点 |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| 查询门店排队进度 | POST /v3/queuing/queryShopQueueCup |
|
|
31
|
+
| 查询订单排队进度 | POST /v3/queuing/queryOrderQueueCup |
|
|
32
|
+
| 查询门店排队叫号列表 | POST /v3/queuing/queueNo/queryShopQueueNoList |
|
|
33
|
+
|
|
34
|
+
## 注意事项(Agent 必读)
|
|
35
|
+
|
|
36
|
+
- `shop-progress` 的 `shopIdList` 官方最多支持 20 个
|
|
37
|
+
- `shop-queue-nos` 的 `size` 官方限制在 1 到 20 之间
|
|
38
|
+
- 这个模块目前只有读接口,没有写操作
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# qmai-queue 查询参考
|
|
2
|
+
|
|
3
|
+
## 适用场景
|
|
4
|
+
|
|
5
|
+
- 查询门店当前排队压力
|
|
6
|
+
- 查询单笔订单还要等多久
|
|
7
|
+
- 查询门店当前叫号列表
|
|
8
|
+
|
|
9
|
+
## 推荐命令
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
qmai queue shop-progress --shop-type 1 --shop-ids 1001,1002
|
|
13
|
+
qmai queue order-progress --order-no O20260407001
|
|
14
|
+
qmai queue shop-queue-nos --shop-code S001 --page 1 --size 10
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 排查建议
|
|
18
|
+
|
|
19
|
+
- `order-progress` 中 `order-no` 和 `source-no` 至少传一个,同时传时以 `order-no` 为准
|
|
20
|
+
- `shop-queue-nos` 默认可不传 `status-list`,官方会按待制作、制作中、待取餐查询
|
|
21
|
+
- 如果要保留完整原始字段,优先使用 `--format json`
|