Files
digital-psychology/docs/ENGINEERING_SPEC/ECR-007-ops-analytics.md
T
jackyu66gitandCursor 7ab9add5dd
ci / h5 (push) Canceled after 0s
ci / api (push) Canceled after 0s
ci / ess-docs (push) Canceled after 0s
feat(ops): ECR-007 行为分析与 ECR-008 内容运营后台
落地埋点 ingest/数据看板、首页宫格 CMS 与测评上下架;含账号引导、问答流式与免责声明去重,以及 review P1 审计同事务修复。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 02:26:16 +08:00

31 lines
1.4 KiB
Markdown
Raw 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.
# ENGINEERING_SPEC — ECR-007 运营行为分析 Ops-B
权威设计:`docs/BACKEND_DESIGN/ECR-007-ops-analytics.md`
产品:`.ai/product/feature-spec/ops-analytics.md` · `docs/PRODUCT_SPEC/ECR-007-ops-analytics.md`
## Implement order
1. Migration `000013_analytics_ops`sessions / events;可选 daily_page+ ERD 同步
2. `repository/analytics_repo.go`ingest + 聚合查询)
3. `service/analytics`(校验、截断 props、限流语义)
4. `handler``POST /analytics/events`**既有 DeviceAuth gated group**
5. `service/admin` + handler`GET /admin/analytics/{overview,pages,exits,clicks,funnel}`
6. OpenAPI 增补
7. `user-h5``lib/analytics.ts` 队列 / session / dwell / click / beacon;关键控件 `data-track`
8. `admin-h5`:路由「数据」+ Dashboard 筛选与图表/表
9. 测试:repo/service 或 integration 上报→聚合;H5 analytics 单测
10. TRACEABILITY · STATE · CHANGELOG · feature-map §7
## Constraints
- 函数 ≤50 行 · 文件 ≤400 行(超标先拆)
- UI → sdk 或既有 thin client → Handler → Service → Repository(禁止 Handler SQL
- Admin 聚合不得走 DeviceAuth
- props 白名单键;禁止 PII
- 不提交 `config.local.yaml` / 密钥
- 不引入新中间件栈(无 Kafka)
## Done when
ECR Acceptance 勾完 + `.ai/definition-of-done.md` Review Report + `ess-validate`Approved 后门禁)