feat(ECR-015): RedemptionCode 兑换码并 Closed

批次生成/作废、C 端兑码延长会员;admin-h5 /codes。
Loop continuous。Next:ECR-016 UserIntelligence。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-07 18:16:13 +08:00
co-authored by Cursor
parent 0e26aabef8
commit 1eeb0b00e7
33 changed files with 1073 additions and 36 deletions
@@ -0,0 +1,17 @@
# Backend Design: ECR-015 RedemptionCode
| ID | BD-2026-015 |
| Status | Approved |
| Coding | Loop authorized |
| Level | L2 |
## Boundary
```text
Domain: RedemptionBatch, RedemptionCode
App: admin + membership.Redeem
API: /admin/redemption-* , POST /membership/redeem
Migration: YES 000018
```
Rollback: down migration
+1
View File
@@ -2,6 +2,7 @@
## 2026-08-07
- **ECR-015 Closed**RedemptionCode(批次生成 · C端兑码 · 作废 · 审计)
- **ECR-014 Closed**MembershipPlan(套餐表 · admin 配置 · Grant/CreateOrder 读表)
- **LOOP continuous**`docs/WAVE0/LOOP_AUTHORIZATION.md` — Human 授权免逐闸确认
- **ECR-013B Closed**AccountLifecycle Reviewer Approve
+14
View File
@@ -0,0 +1,14 @@
# CODE_REVIEW — ECR-015
**Verdict:** Approve → Closed
Date: 2026-08-07 · Loop continuous
- [x] Migration 000018 · Spec AC · 无真支付/UGC
- [x] Admin batches/codes · C端 /membership/redeem
- [x] TEST_REPORT PASS
```text
Decision: Approve → Closed
Next: ECR-016 UserIntelligence 薄切片(只读用户洞察看板)或停
```
+28
View File
@@ -0,0 +1,28 @@
ecr: ECR-015
capability: CommerceEntitlement
bounded_context: Membership_Orders
parent: WAVE0-FROZEN
predecessor: ECR-014
change:
type: additive
breaking_change: false
migration_required: true
compatibility_notes: >
New redemption_batches / redemption_codes.
C-end POST /membership/redeem extends membership without payment.
Additive RBAC admin.membership.codes.read/write.
entities:
- name: RedemptionBatch
before: null
after: { fields: [id, label, plan_code, quantity, created_by, created_at] }
- name: RedemptionCode
before: null
after: { fields: [id, batch_id, code, plan_code, status, redeemed_by, redeemed_at] }
apis:
- { method: POST, path: /api/v1/admin/redemption-batches, change: added }
- { method: GET, path: /api/v1/admin/redemption-batches, change: added }
- { method: GET, path: /api/v1/admin/redemption-batches/{id}/codes, change: added }
- { method: POST, path: /api/v1/admin/redemption-codes/{id}/disable, change: added }
- { method: POST, path: /api/v1/membership/redeem, change: added }
+19
View File
@@ -0,0 +1,19 @@
# ECR-015
**Title:** RedemptionCode(兑换码薄切片)
**Status:** **Closed**
**Closed:** 2026-08-07Loop continuous
**Parent:** WAVE0-FROZEN · **Predecessor:** ECR-014 Closed
**Change Level:** L2
## Change
批次生成兑换码 → C 端兑码延长 MembershipPlan 对应时长 · 可作废 · 审计
## Forbidden
真支付 · UGC · ask_pack 兑换 · soft-delete
## Linked
Spec `ops-redemption-code.md` · BD-2026-015 · CONTRACT_DIFF/ECR-015.yaml
@@ -0,0 +1,8 @@
# ENGINEERING_SPEC — ECR-015
Approved · codingLoop
1. Migration batches+codes + RBAC permissions
2. Admin generate/list/disable · membership Redeem
3. OpenAPI · admin-h5 最小页
4. Integration AC · Closed
@@ -0,0 +1,4 @@
# HANDOFF — ECR-015 Architect → Engineer
Loop continuous · Approved + Coding authorized.
Do Spec order. Forbidden: 真支付 · UGC · ask_pack redeem.
@@ -0,0 +1,3 @@
# HANDOFF — ECR-015 Engineer → Reviewer
Done · Loop continuous Closed.
@@ -0,0 +1,4 @@
# PRODUCT_SPEC — ECR-015
对齐 Spec ops-redemption-code.md · Approved · Loop continuous
Capability CommerceEntitlement · BC Membership_Orders · L2
+2 -2
View File
@@ -46,9 +46,9 @@
## Active anchors
- ECR: **ECR-014 Closed**Next **ECR-015** RedemptionCodeLoop continuous);013A/B Closed**ECR-013A Closed****WAVE0-FROZEN** @ 27f27a1
- ECR: **ECR-015 Closed**Next **ECR-016** UserIntelligenceLoop);013A/B/014 Closed**ECR-013A Closed****WAVE0-FROZEN** @ 27f27a1
- EXP: (无)
- STATE: `docs/STATE/ECR-014.md`Closed)· next ECR-015 · Loop: `docs/WAVE0/LOOP_AUTHORIZATION.md`
- STATE: `docs/STATE/ECR-015.md`Closed)· next ECR-016 · Loop: `docs/WAVE0/LOOP_AUTHORIZATION.md`
- Ops foundation: `docs/WAVE0/` · `.ai/domain/boundary-rules.md` · `glossary.yaml`
- TRACEABILITY: `docs/TRACEABILITY.md`
- ADR: `.ai/adr/0007-ess-ai-dual-track.md`
+9
View File
@@ -0,0 +1,9 @@
# STATE — ECR-015
| Field | Value |
|-------|-------|
| Status | **Closed** |
| Phase | closed |
| Test | TEST_REPORT/ECR-015.md |
| Review | CODE_REVIEW Approve → Closed |
| Updated | 2026-08-07 |
+11
View File
@@ -0,0 +1,11 @@
id: TASK-015-ECR015
ecr: ECR-015
title: RedemptionCode Closed
role: reviewer
status: closed
change_level: L2
parent: WAVE0-FROZEN
predecessor: ECR-014
acceptance:
- Spec AC mapped
- No true payment / UGC
+22
View File
@@ -0,0 +1,22 @@
# TEST_REPORT — ECR-015 RedemptionCode
Date: 2026-08-07 · Loop continuous
## Results
| Check | Result |
|-------|--------|
| TestRedemptionCodes | PASS |
| build:admin | PASS |
## AC
| ID | Evidence |
|----|----------|
| AC-F-01 | POST batch qty=3 → 3 codes |
| AC-F-02 | redeem → 200 |
| AC-F-03 | re-redeem → 400 |
| AC-F-04 | disable → redeem 400 |
| AC-S-01/02 | 无 token batch 401;未注册 membership 401 |
| AC-P-01 | list batches &lt; 500ms |
| AC-O-01 | AuditLog redemption.batch.create |
+1 -1
View File
@@ -17,4 +17,4 @@
| ECR-012 | 星座对齐收口(星盘 · outlook · 合盘) | **Implemented** | Spec star-profile · BD-2026-012 · TEST_REPORT · HANDOFF review |
| WAVE-0 | Ops Contract-First Foundation | **FROZEN** (`WAVE0-FROZEN` @ 27f27a1) | `docs/WAVE0/` · HUMAN_REVIEW FREEZE · boundary-rules · glossary · contract template |
| ECR-013A | Admin RBAC | **Closed** | Spec ops-rbac · BD-2026-013A · migration 000015 · TEST_REPORT · CODE_REVIEW Approve · Parent WAVE0-FROZEN |
| ECR-014 | MembershipPlan | **Closed** | Spec ops-membership-plan · BD-2026-014 · migration 000017 · TEST_REPORT · CODE_REVIEW · Loop continuous |
| ECR-015 | RedemptionCode | **Closed** | Spec ops-redemption-code · migration 000018 · TEST_REPORT · Loop continuous |