Files
digital-psychology/.ai/architecture/go-services.md
T
jackyu66gitandCursor dd94e57277 docs: freeze YuXinGu lexicon, journey, and P1 engineering sources
Establish product language contract, user journey with dual growth engines,
ERD/OpenAPI/Go boundaries, and H5 routes (/profile, /portrait, /relation,
/membership) before P1 implementation.

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

1.4 KiB
Raw Blame History

Go 服务边界(冻结)

单二进制 apps/api;按包拆分,禁止跨层:Handler → Service → Repository。
详见 ../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/Message;规则或薄 LLM Skeleton
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。
  • portraitrelationgrowth_reports;读一律走 report.Get(带裁剪)。
  • ask 强制校验 profile 归属当前 user。

禁止

  • 新建 decode / match / unlock / fortune 包名
  • Handler 直连 DB
  • 在 JSON 字段名使用 luck / fortune / ji_xiong