Files
shaguabijia-app-server/docs/api/other/trace-finalize.md
T
guke b23335d5fb @
docs: reorganize api docs into categorized subdirectories and fill missing docs

- Categorize 77 existing api docs into 16 business-domain subdirectories
  (auth/ad/wallet/coupon/compare/savings/signin/tasks/invite/user/
   device/platform/intent/meituan/other) plus admin/ and internal/
- Split admin/ into 7 sub-resource subdirectories (auth/users/wallet/
  withdraws/feedbacks/admins/ad) with 4 single-file docs at root
- Create 21 new docs covering 28 previously undocumented endpoints:
  ad/watch-report, wallet/transfer-auth (3 endpoints), coupon/session+
  stats+completed-today+prompt (7), invite/me+invitees+bind+landing-track,
  user/onboarding (2), platform/flags+ad-config+app-version,
  intent/step+precoupon/step, analytics/events, order/report,
  report/submit+records, feedback/config+records, trace/finalize
- Add mock request/response JSON examples to all new docs
- Create docs/README.md with full category index for LLM navigation
- Update docs/api/README.md: fix all links, add new endpoint rows,
  replace "no doc" markers with actual links
- Fix back-navigation links (./README.md -> ../README.md or
  ../../README.md) in all moved files
@
2026-07-03 14:56:50 +08:00

46 lines
1.4 KiB
Markdown

# POST /api/v1/trace/finalize — 比价 trace 收尾上云
> 所属:透传端点(前缀 `/api/v1`,外卖比价) | 鉴权:无(MVP 阶段不鉴权) | [← 返回 API 索引](../README.md)
透传到 pricebot-backend。用户终止 / Phase 1 未识别没走到 done 帧时,pricebot 没上云也没回传 `trace_url`。客户端收尾时打这个,pricebot 按 `trace_id` 一致性 hash 落到处理这条 trace 的同一进程(dir_cache 在那才能算对 trace 目录),打包上云返回 `{trace_url}`
## 入参
透传 pricebot,客户端按 pricebot 协议组装。关键字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| `device_id` | string | 设备 ID |
| `trace_id` | string | 比价 trace 标识 |
| *(透传)* | | 其余字段由 pricebot 定义,本端点不做校验 |
Mock 入参:
```json
{
"device_id": "android_abc123def456",
"trace_id": "tr_20260703_m3n4o5p6",
"reason": "user_cancelled"
}
```
## 出参
透传 pricebot 原始响应,通常包含 `trace_url`
Mock 出参:
```json
{
"trace_url": "https://trace.shaguabijia.com/tr_20260703_m3n4o5p6",
"ok": true
}
```
## 错误码
- `502` pricebot 不可达或返回 5xx
- `400` 请求体不是合法 JSON
## 说明
- 一致性 hash 按 `trace_id` 路由到同一 pricebot 实例(确保 dir_cache 命中)
- MVP 阶段不鉴权
-`/intent/recognize``/price/step` 等同属外卖比价透传族