Files
digital-psychology/.ai/product/feature-spec/portrait.md
T
jackyu66gitandCursor bd22d9dddd feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 11:37:53 +08:00

198 lines
5.8 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.
# Feature Spec: 个人画像
> Status: `Active` · Map: `2.1 / 2.3 个人画像 [P1]` · Phase: `P1`
> 规范:[../feature-design.md](../feature-design.md)
---
## 1. 功能定义
| 字段 | 内容 |
|---|---|
| Name | 个人画像(成长画像) |
| Purpose | 帮助用户了解自己的性格特点、沟通/关系/事业/情绪/生活节奏与成长方向 |
| Business Goal | 首次体验转化;驱动深度版购买与成长会员;为问答提供档案语境 |
| In | Out |
|---|---|
| 基于生日确定性生成基础 + 深度内容 | 运势/吉凶/算命叙事 |
| 多维报告结构(性格·沟通·关系·事业·情绪·生活) | 星盘/塔罗主路径 |
| DeepAccess / 会员解锁 detail | 医疗诊断或疗效承诺 |
---
## 2. 用户价值
1. **为何需要:** 完成建档后希望快速得到「我是什么样的人」的结构化总结。
2. **完成后获得:** 免费基础画像(标题、概述、关键词、六维速览、生活建议);付费后完整分维分析、优势盲区、成长路径、对话示例、FAQ。
3. **为何付费:** 深度内容可执行、可分享前更完整,降低「只有一句话标签」的空洞感。
---
## 3. 用户角色
| Actor | 说明 | 本功能能力 |
|---|---|---|
| Visitor | 设备身份自动签发 JWT | 可建 Self Profile、生成画像、看 summary |
| User | 同上(P1 以 Visitor 为主) | 同左 |
| DeepAccess | 该 `growth_report` 已购深度版 | 可见 `detail` |
| VIP | `memberships` active | 可见 `detail`(与 DeepAccess 或关系) |
---
## 4. 用户流程
```text
首页填写生日 / 已有 Self 档案
POST 创建画像报告
展示基础结果(summaryoverview、dimensions、keywords…)
点击深度版?
├─ 否 → 分享 / 去关系理解 / 去问答
└─ 是 → 创建 order(deep_access) → pay-mock
Server 写入 DeepAccess
GET report → detail 完整展示
```
无档案:引导首页/档案创建(Empty)。
---
## 5. 页面设计
| 路由 | 页面 | 说明 |
|---|---|---|
| `/portrait` | PortraitPage | query: `y,m,d``report_id` |
| `/reports/:id` | ReportPage | 同报告详情渲染 |
```text
/portrait
├── Loading
├── Empty(缺生日/档案)
├── Error
├── Normal(基础结果 + 多维速览)
└── Locked(无权益时的深度墙)
```
---
## 6. 页面状态规范
| 状态 | UI |
|---|---|
| Loading | 「正在生成…」 |
| Empty | 「请从首页填写生日」+ 链到 `/` |
| Error | 文案 + 重试 |
| Normal | 标题、one_liner、ReportRich 基础层 |
| Locked | 深度版说明 + 「查看深度版(模拟支付)」 |
---
## 7. Business Rules
| ID | Rule |
|---|---|
| R1 | 必须有归属用户的 Profile(通常 `relation=self`)才能生成 |
| R2 | `summary` 对报告所有者始终可返回;含多维 teaser,不含完整 depth 长文 |
| R3 | `detail` 仅当 Membership active **或** 该报告 DeepAccess 存在时返回 |
| R4 | 权益**仅 Server** 判断;客户端 `has_deep_access` 为只读投影 |
| R5 | 内容确定性:同生日同名 → 同 pattern;禁用词:运势/吉凶/算命/合盘等 |
| R6 | 深度内容须含分维 sections、strengths、blind_spots、growth_plan、scripts(结构要求) |
| R7 | 免责:自我探索与生活方式参考,非医疗/占卜 |
---
## 8. 数据模型影响
| 表 | 变更 | 备注 |
|---|---|---|
| `profiles` | 读 | birth_date 必填 |
| `growth_reports` | 写 type=`portrait` | summary/detail jsonb |
| `deep_access` / `orders` | 解锁时 | 见 membership Spec |
详见 [../../domain/erd.md](../../domain/erd.md)。
---
## 9. API 需求
| Method | Path | 意图 |
|---|---|---|
| POST | `/api/v1/reports/portrait` | body: `profile_id` → 创建/返回报告 |
| GET | `/api/v1/reports/{id}` | 按权益剥离 detail |
| POST | `/api/v1/orders` | `kind=deep_access`, `report_id` |
| POST | `/api/v1/orders/{id}/pay-mock` | mock 支付生效 |
OpenAPI`proto/openapi.yaml`
---
## 10. 权限设计
| 能力 | Visitor | DeepAccess | VIP |
|---|---|---|---|
| 生成画像 | ✓(己方档案) | ✓ | ✓ |
| 看 summary | ✓ | ✓ | ✓ |
| 看 detail | ✗ | ✓ | ✓ |
---
## 11. 埋点
| Event | 触发 |
|---|---|
| `portrait_started` | 进入生成 |
| `portrait_completed` | 基础结果展示 |
| `deep_access_clicked` | 点深度版 CTA |
| `purchase_completed` | pay-mock 成功且 detail 可见 |
| `portrait_share_clicked` | 打开分享 |
---
## 12. 测试验收标准
**Given** 用户已填生日
**When** 进入画像并生成
**Then** 显示 headline、overview/多维速览、生活建议;无 detail 长文墙内完整 sections
**Given** 无会员且无 DeepAccess
**When** 点击深度版并 mock 支付
**Then** `has_deep_access=true` 且分维分析/成长路径可见
**Given** 篡改前端假装已解锁
**When** GET report
**Then** 无权益时 detail 仍不可得
---
## 13. AI 开发前检查
- [x] Spec 齐全
- [x] feature-map 已挂树
- [x] lexicon 已核对
- [x] OpenAPI 已有 portrait/reports
- [x] §12 可测
---
## 14. Implementation Notes
| 项 | 内容 |
|---|---|
| Packages | `internal/portrait` · `service/report` · `PortraitPage` · `ReportRich` |
| Migrations | `growth_reports` 等已有 |
| Gaps | 埋点 SDK 未接(事件名已定义);真实支付 P 后 |
| Tests | `portrait` L1;集成 deep_accessH5 PortraitPage.spec |
| Process Review | 2026-08-02 [P1-PROCESS-REVIEW](P1-PROCESS-REVIEW.md) · 设计闭合 · 实现 PASS · 测试 PASS |
---
## 附录:报告结构
免费:title, style_label, headline, keywords, one_liner, overview, life_tip, dimensions[6], strengths_preview
深度:sections[6+], strengths, blind_spots, growth_plan, conversation_scripts, daily_suggestions, faq