Files
jackyu66gitandCursor 9707b72808 feat(ECR-041): OpsCMS Banner 薄写面(Write-Wave 首刀)
Admin POST/PUT + admin.cms.write/审计;C 端 GET /home/banners;首页投影回退静态 homeFeeds;migration 000051;不碰 FeedSlot/支付/UGC。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 19:55:27 +08:00

93 lines
2.7 KiB
Markdown
Raw Permalink 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.
# Feature Spec: 运营内容配置(Ops-C
> Status: `Active` · Map: `§7 运营后台` · Phase: `Ops-C`
> ESS`docs/ECR/ECR-008-ops-content.md`**Closed** · L2)· BD-2026-008 Approved
> 关联:[ops-admin.md](ops-admin.md) · [ops-analytics.md](ops-analytics.md) · [home.md](home.md) · [explore-test.md](explore-test.md)
---
## ESS 门禁
1. Change Level = **L2** → ECR Approved + Feature Spec Active + BACKEND_DESIGN Approved — **已满足(2026-08-07**
2. 实现顺序以 `docs/ENGINEERING_SPEC/ECR-008-ops-content.md` 为准
3. 完成后:TEST_REPORT · CODE_REVIEW · `ess-validate --phase review`
---
## 1. 目标
让运营在后台配置:
1. **首页宫格工具**:增删改排序、显隐、角标(替代写死 `homeCatalog.ts`
2. **测评上下架**`scales.status` = `published` / `draft`C 端列表只见已发布
---
## 2. In / Out
| In | Out |
|---|---|
| 首页宫格 CRUD(最多约 24 项;默认 12) | 首页 Feeds/推荐区运营:ECR-008 后置;**Banner 写面见 ECR-041**;完整 FeedSlot 写另 ECR |
| 工具 path / icon 白名单校验 | 任意外链、自定义 SVG 上传 |
| scales 列表 + 上架/下架 + 审计 | 新建量表题目编辑器 · 探索目录全量 CMS |
| Admin「内容」页 | RBAC / 封禁 / 推送(Ops-E |
---
## 3. 数据模型
```text
home_tools
id, row_index (1|2), sort_order, path, icon, label,
badge?, badge_tone? (hot|new|null), enabled, updated_at
scales(已有)
status: published | draft
```
种子:与当前 `homeGridRow1/2` 一致。
---
## 4. API
| Method | Path | 意图 |
|---|---|---|
| GET | `/api/v1/home/tools` | C 端宫格(仅 enabledDeviceAuth |
| GET | `/api/v1/admin/home/tools` | 管理端全量 |
| PUT | `/api/v1/admin/home/tools` | 整表替换保存(排序+字段)+ 审计 |
| GET | `/api/v1/admin/scales` | 全部量表(含 draft |
| PATCH | `/api/v1/admin/scales/:id` | `{ status }` + 审计 |
C 端既有 `GET /scales` 继续只返回 published。
---
## 5. 管理端「内容」页
侧栏:概览 · 数据 · **内容** · 用户 · 订单 · 审计
- Tab「首页宫格」:两行列表、拖拽/上下移、编辑 label/path/icon/badge、启用开关、保存
- Tab「测评」:列表 · 上架/下架
---
## 6. C 端行为
- `useHomePage` 优先拉 `GET /home/tools`;失败回退静态 `homeCatalog`
- 下架 scale:列表不可见;直链 slug 返回 404/不可用(与现 Get 行为对齐)
---
## 7. 验收
**Given** Admin 将某宫格 disabled 并保存
**When** H5 刷新首页
**Then** 该项不出现
**Given** Admin 将 `mbti-lite` 置 draft
**When** GET `/scales`
**Then** 列表不含该 slug
---