Files
digital-psychology/.ai/architecture/go-services.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

41 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.
# Go 服务边界(冻结)
单二进制 `apps/api`;按包拆分,**禁止**跨层:Handler → Service → Repository。
详见 [../architecture.md](../architecture.md)。
---
## Packages under `internal/service/`
| Package | 职责 | P1 |
|---|---|---|
| `user` | 注册/游客升级/Session | Yes |
| `profile` | 个人档案 CRUD、切换 | Yes |
| `portrait` | 生成个人画像 → GrowthReport | Yes |
| `scale` | 探索测试定义与计分 | Yes |
| `relation` | RelationInsight | Yes **必做** |
| `report` | GrowthReport 读取 + **权益裁剪** | Yes |
| `ask` | Thread/MessageP1 规则引擎 + 额度 | YesDemo |
| `companion` | SolarTerm 读、Mood 写 | Shell |
| `membership` | 成长会员状态与额度 | Yes |
| `order` | Order + pay-mock + DeepAccess 发放 | Yes |
`internal/handler/`:每域一组 handler,只做 bind/validate/调用 service。
`internal/repository/`SQL;无 business unlock 规则(规则在 service/report + membership)。
---
## 跨域规则
- **权益判定**只在 `report` / `ask` / `membership` service,不在 handler、不在 H5。
- `portrait``relation``growth_reports`;读一律走 `report.Get`(带裁剪)。
- `ask` 强制校验 `profile` 归属当前 user。
---
## 禁止
- 新建 `decode` / `match` / `unlock` / `fortune` 包名
- Handler 直连 DB
- 在 JSON 字段名使用 `luck` / `fortune` / `ji_xiong`