Files
2025-11-09 18:41:07 +08:00

42 lines
2.2 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.
# 每日运势指南产品规格DailyFortuneGuide
## 1. 目标
- 依据用户的出生日期、时间、城市生成基础命盘,结合当日天干地支与天象输出六维度运势、吉祥元素、最佳行动时机。
- 指南内容在小程序内结构化展示,并保留最多 20 条本地历史记录。
- 每日最多计算 10 次,观看激励广告后才允许触发计算。
## 2. 页面与职责
| 页面 | 路径 | 职责 |
| --- | --- | --- |
| 首页 | `pages/home/index` | 输入表单、校验、广告流程、触发生成、提示每日一次更准 |
| 结果页 | `pages/result/index` | 展示六维度评分、吉祥元素、命盘摘要与 AI 解读,可跳转历史 |
| 历史列表 | `pages/history/index` | 展示本地最多 20 条记录、支持查看详情 |
| 历史详情 | `pages/history-detail/index` | 还原指定记录的运势内容 |
## 3. 数据模型
- `FortuneForm`: `{ birthDate, birthTime, birthCity }`
- `FortuneResult`: 后端 `DailyFortuneResponse`
- `HistoryItem`: `{ id, createdAt, formSnapshot, fortune }`
- 本地存储键:
- `fortune:quota:YYYYMMDD`
- `fortune:history`
## 4. 交互规则
- 必填项缺失或城市长度 \< 2 时阻止提交。
- 每次生成前必须成功播放激励视频广告;未完整观看给出提示。
- 每日调用次数达到 `config.maxDailyQuota`(默认 10后禁止继续生成。
- 成功生成后强制写入历史,超出 20 条旧记录被淘汰。
- 历史记录详情可脱网查看,上一次生成的结果缓存在 `store.currentFortune` 供结果页使用。
## 5. 接口
- `POST /api/daily-fortune/analyze`
- 请求:`{ birthDate, birthTime?, birthCity, birthProvince? }`
- 响应:`DailyFortuneResponse`命盘、六维运势、吉祥元素、AI narrative
- 错误码:`CONTENT_RISK``BIRTHDATE_INVALID``GENERATION_FAILED`
## 6. 技术实现
- 统一在 `store/fortuneStore.js` 管理表单、当前结果、配额和历史列表,遵循单一职责。
- `services/fortuneService.js` 封装请求;`utils/adService.js` 复用激励广告逻辑;`utils/storage.js` 包装 `tt` 存储 API。
- 所有提示文案集中在 `constants/messages.js`
- 页面样式遵循示例图的卡片化布局,移动端友好、对比度清晰。