新增 affiliate_dash 统一领取页流程(阶段 4)

- 后端:claim 详情分流 affiliate_dash 分支 + 详情轮询刷新 bind-result
- 输 UID 触发 bind(拿 bindUuid/二维码, task→waiting_binding)
- 新增 POST /claim/:token/affiliate-dash/submit(submit→redeeming + 事件)
- 前端:ClaimAffiliateDashSteps(二维码/绑定状态/mismatch警告/提交发货)
- claim-snapshot/claim-poll 按 flowType 分流(step2 绑定中/step3 已绑定待提交/step4 结果)
- 前后端 typecheck + 后端 212 测试通过
This commit is contained in:
yml2213
2026-08-05 15:56:51 +08:00
parent 3284fed7a1
commit 5ef1ed6018
11 changed files with 614 additions and 9 deletions
@@ -493,3 +493,33 @@ order_site 处理要求:
- 未命中映射的商品 → 不选 affiliate_dash,回退 ✅
**验证**:前后端 typecheck 通过;后端全量 212 测试通过。
---
## 18. 阶段 4 落地记录(v2.4 · 已完成)
产出文件:
**后端(`apps/backend/src/`**
| 文件 | 内容 |
| --- | --- |
| `services/claim/kuaishou-cloud-claim-context.ts` | `buildClaimDetailPayload``affiliate_dash` 分支 + `buildAffiliateDashClaimDetailPayload`flowType/affiliateDash 块/product/task/order/orderItem/result |
| `services/claim/kuaishou-cloud-claim-service.ts` | `getKuaishouCloudClaimDetail` affiliate_dash 分支:`syncAffiliateDashTaskStatus` + `refreshAffiliateDashBindState`(有 bindUuid 时拉 bind-result 实时刷新 bound/账号/mismatch,可重入);`submitClaimUid` affiliate_dash 分支 → `bindAffiliateDashClaimForTask`bind 拿 bindUuid/二维码,task → WAITING_BINDING);新增 `submitAffiliateDashClaim`submit → REDEEMING + task event |
| `services/fulfillment/affiliate-dash/index.ts` | `AffiliateDashFlow``bound/boundAccount/gameChannel` 字段(bind-result 状态) |
| `routes/claims.ts` | 新增 `POST /:token/affiliate-dash/submit`claimWriteRateLimit |
**前端(`apps/frontend/src/`**
| 文件 | 内容 |
| --- | --- |
| `types/claim.ts` | `ClaimAffiliateDashFlowInfo` + `ClaimDetailData.affiliateDash` |
| `services/claim.ts` | `submitAffiliateDashClaim(token, {gameAccount, bindUuid})` |
| `pages/claim/claim-snapshot.ts` | `isAffiliateDashFlow`、hasRedeemResult/currentStep/progressText/resultTitle/resultDescription 的 affiliate_dash 分支(step: 无UID=1/绑定中=2/已绑定待提交=3/结果=4) |
| `pages/claim/claim-poll.ts` | affiliate_dash 轮询(未绑定用 BINDING_PREPARE_POLL_MS,已绑定用 FEIFEI_POLL_MS |
| `pages/claim/ClaimAffiliateDashSteps.tsx`(新) | `AffiliateDashClaimPanel`(二维码/绑定链接、bound 状态、mismatch 警告、提交发货按钮)+ `AffiliateDashResultStep` |
| `pages/claim/ClaimPage.tsx` | 分发分支 + `handleSubmitAffiliateDash` + `openBindUrl`/二维码生成支持 affiliateDash.bindUrl |
**验证**:前后端 typecheck 通过;后端全量 212 测试通过;claim 详情分流脚本验证(flowType=affiliate_dash、affiliateDash 块完整、product 正确、其他 flow 为 null)。
**领取闭环状态迁移(与 §8 状态机一致)**:输 UID → submitClaimUidbind 触发,task `link_generated → waiting_binding`)→ 轮询详情(bind-result 刷新 bound)→ 提交发货(submitAffiliateDashClaimtask `waiting_binding → redeeming`)→ 回调 delivered → redeemed + 核销。