Files
shaguabijia-app-server/docs/api/meituan-top-sales.md
T
chenshuobo db9742f132 美团 feed 三 tab 降级兜底:加 status(ok/empty/degraded),空库/上游失败均返 200 不再 5xx
- FeedResponse/CouponListResponse 加 status 字段(默认 ok,向后兼容)
- rec 改为不被 MT 凭证开关拦截(纯库查询);distance 的 from_raw 逐条容错
- /coupons 美团失败由 502 软化为 200+degraded,避免前端弹错
- 同步 API 文档(feed/coupons/top-sales/README)
2026-06-10 17:21:41 +08:00

24 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# POST /api/v1/meituan/top-sales — 销量最高(离线库)
> 所属:美团 CPS 组(前缀 `/api/v1/meituan`,**全部无鉴权**) | 鉴权:无 | [← 返回 API 索引](./README.md)
>
> 数据来自离线库 [database/meituan_coupon](../database/meituan_coupon.md);**不实时打美团**(美团搜索对销量排序支持差、且有 402 限流)。
## 入参
| 字段 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
| `page` | int | ❌ | 1 | ≥1 |
| `page_size` | int | ❌ | 20 | 150 |
| `platform` | int \| null | ❌ | null | 1 只外卖 / 2 只到店 / 不填=全部(全城销量) |
## 出参
响应 `200`:`{ items: CouponCard[], has_next: bool, search_id: null, status: "ok"|"empty"|"degraded" }``CouponCard` 见 [API 索引](./README.md#复用数据结构);`status` 语义见 [feed 接口](./meituan-feed.md#status-字段前端据此显示占位)。
## 说明
-`meituan_coupon``sale_volume_num` 非空的券,`DISTINCT ON(dedup_key)` 跨源去重(每个「品牌|名|价」只留销量最高一条,同销量再按佣金),按销量降序分页;每页只对当前 ~20 条做 `from_raw` 解析(翻页快,不全表拉取)。
- **不依赖 MT 凭证**(纯库查询)。库为空(prod 刚部署 / ETL 未跑完)→ `status=empty`;库查询异常 → `status=degraded`。均返 `200`、不抛 5xx。
- **仅 PostgreSQL**(`DISTINCT ON` 为 PG 专用)。
## 错误码
无业务级错误码:库空 / 异常都返 `200` + 空 `items` + 对应 `status`