feat(ECR-009): Ops-D order filters, plan display prices, refund status

LOOP-RUN-002 sample: admin order multi-filter, membership display
price catalog, read-only refund_status. No real payment or RBAC.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-07 02:45:32 +08:00
co-authored by Cursor
parent 7ab9add5dd
commit ca3b13554c
37 changed files with 2169 additions and 25 deletions
@@ -0,0 +1,32 @@
# BD-2026-009 — Ops-D Commerce
Status: Approved
**ECR:** ECR-009
**Date:** 2026-08-07
## Backend Change Boundary
### In
- `orders.refund_status` TEXT NOT NULL DEFAULT `none``none|pending|refunded|rejected`
-`membership_plan_prices(plan PRIMARY KEY, display_cents INT, updated_at)`
- `AdminRepo.ListOrders` 增加 Filter 结构
- `AdminRepo` Get/Upsert plan prices + audit `plan_price.upsert`
- Handler query 绑定;OpenAPI
### Out
- 支付渠道 · 退款出账 · Handler 直连 DB
### Ownership
| Layer | Owner |
|-------|--------|
| Repository | AdminRepo |
| Service | admin.Service |
| Handler | AdminHandler |
| UI | admin-h5 Orders / Pricing |
## Architecture Evidence
仍:Handler → Service → Repository;无新外部依赖。
+2
View File
@@ -2,6 +2,8 @@
## 2026-08-07
- **ECR-009 Implementing**Ops-D 订单筛选 · 展示价 · 退款只读(LOOP-RUN-002
Spec `ops-commerce.md` · BD-2026-009 · migration `000015`
- **ECR-008 P1 修复**:审计同事务 · 宫格 move 保留 row_index · Analytics nil 守卫
- **ECR-008 Implemented**Ops-C 首页宫格 CMS + 测评上下架
migration `000014` · `/home/tools` · admin「内容」· TEST_REPORT/CODE_REVIEW
+15
View File
@@ -0,0 +1,15 @@
# CODE_REVIEW — ECR-009
**Decision:** PASS
**Scope:** Matches plan.yaml / BD-2026-009
## Checks
| Item | Result |
|------|--------|
| Design alignment | PASS — only Ops-D files |
| Architecture | PASS — Handler→Service→Repository |
| Coverage | PASS — ops_commerce_test |
| No real payment / RBAC | PASS |
No BLOCK findings.
+49
View File
@@ -0,0 +1,49 @@
# ECR-009
**Title:** 运营商业加深 Ops-D(订单筛选 · 展示价 · 退款只读)
**Status:** Approved
**Date:** 2026-08-07
**Approved:** 2026-08-07Human Goal → LOOP-RUN-002 supervised
**Change Level:** L2
## Change
1. Active Spec`.ai/product/feature-spec/ops-commerce.md`
2. migration `000015_ops_commerce``orders.refund_status` + `membership_plan_prices`
3. `GET /api/v1/admin/orders` 增加 query 筛选
4. `GET|PUT /api/v1/admin/membership/plan-prices`
5. admin-h5Orders 筛选 + Pricing 页
6. OpenAPI · TRACEABILITY · TEST_REPORT · CODE_REVIEW
## Motivation
Ops-A 订单列表无筛选;展示价写死;无退款状态可见性。
## Scope
### Allowed
- 上列 Spec / migration / admin API / admin-h5
- 审计(改价写 audit
### Forbidden
- 真支付 · 退款执行 API · RBAC · UGC · 改 ESS
## Risk
| Risk | Mitigation |
|------|------------|
| 误改历史订单金额 | 只改展示价表,不 UPDATE orders.amount |
| 筛选扫全表 | 限 limit≤100;索引 created_at/status |
## Acceptance Criteria
- [ ] 筛选与 refund_status
- [ ] 展示价 GET/PUT
- [ ] integration + build
- [ ] Loop artifacts + Gate
## Trace
Spec `ops-commerce` · BD-2026-009 · LOOP-RUN-002
@@ -0,0 +1,6 @@
# ENGINEERING_SPEC — ECR-009
- StackGo gin · Vue3 admin-h5 · PostgreSQL migration 000015
- LayersHandler → Service → Repository
- BDBD-2026-009 Approved
- Non-goals:真支付 / RBAC / UGC
@@ -0,0 +1,9 @@
# HANDOFF — ECR-009 Architect → Engineer
**From:** Architect
**To:** Engineer
**ECR:** ECR-009
**BD:** BD-2026-009 Approved
**Spec:** ops-commerce Active
Implement plan.yaml scope only. Do not wait for re-confirmation of plan.
@@ -0,0 +1,6 @@
# HANDOFF — ECR-009 Engineer → Reviewer
**From:** Engineer
**To:** Reviewer
**Result:** Implementation complete for Ops-D scope
**Tests:** TestOpsCommercePhaseD PASS · admin-h5 build PASS
@@ -0,0 +1,4 @@
# PRODUCT_SPEC — ECR-009 Ops-D
行为以 `.ai/product/feature-spec/ops-commerce.md` 为准。
本文件仅作 ESS 过程索引。
+3
View File
@@ -3,6 +3,9 @@
> Agent **第一次**读这个文件。不要重新猜技术栈;偏离见 Forbidden + ADR。
> 产品/领域/完成标准权威仍在 `.ai/`;本文件只锁定栈与 ESS 流程入口。
## Profile Version
`2026.08`
## Type
`saas-web` + AI Agent(心理洞察 / 画像 / 关系 / 问答陪伴)
+13
View File
@@ -0,0 +1,13 @@
# STATE — ECR-009
| Field | Value |
|-------|-------|
| ECR | ECR-009 |
| Title | Ops-D 商业加深 |
| Status | Implementing |
| Phase | build |
| Owner | engineer |
| Spec | Active |
| Backend Design | BD-2026-009 Approved |
| Loop | LOOP-RUN-002 |
| Updated | 2026-08-07 |
+9
View File
@@ -0,0 +1,9 @@
ecr: ECR-009
title: Ops-D commerce deepen
status: ready
owner: engineer
change_level: L2
artifacts:
- docs/ECR/ECR-009-ops-commerce.md
- docs/BACKEND_DESIGN/BD-2026-009-ops-commerce.md
- .ai/product/feature-spec/ops-commerce.md
+19
View File
@@ -0,0 +1,19 @@
# TEST_REPORT — ECR-009
**Date:** 2026-08-07
**Result:** PASS
## Commands
```bash
cd apps/api && go test ./internal/integration/ -run TestOpsCommercePhaseD -count=1
cd apps/admin-h5 && npm run build
```
## Result
- TestOpsCommercePhaseD: PASS
- admin-h5 build: PASS
- go build ./...: PASS
commit: (pending human approval)
+1
View File
@@ -14,3 +14,4 @@
| ECR-006 | 运营后台 Phase Aadmin API + admin-h5 | **Closed** | Spec ops-admin · BD-2026-006 · TEST_REPORT · CODE_REVIEW |
| ECR-007 | 运营行为分析 Ops-B(埋点 + 数据看板) | **Implemented** | Spec Active · BD-2026-007 · TEST_REPORT · CODE_REVIEW · HANDOFF review |
| ECR-008 | 运营内容 Ops-C(首页宫格 + 测评上下架) | **Implemented** | Spec Active · BD-2026-008 · TEST_REPORT · CODE_REVIEW |
| ECR-009 | 运营商业加深 Ops-D(订单筛选 · 展示价 · 退款只读) | **Implementing** | Spec ops-commerce · BD-2026-009 · LOOP-RUN-002 |