Files
digital-psychology/.ai/product/feature-spec/cece-frontend-re/08-systems.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

9.7 KiB
Raw Blame History

08 · 横切系统逆向(STEP 5–18)

支撑前端全功能的数据 / API / 后台 / 运营 / 安全推导
标记:无公开 UI 的条目多为 🟡/🔵,但禁止省略整类


STEP 5 — 数据模型(核心对象)

对象 关键字段(类型) 可空 默认 来源 缓存 索引 证据
User id UUID PK · phone · wx_openid · status · created_at 部分 active 注册 Redis session phone unique E1
Profile id · user_id · relation(self/other) · display_name · birth_date · birth_time · birth_place · geo_* · tags JSON time/place 可空 建档 本地+服务端 user_id E1
BirthInfo 可内嵌 Profile tz=CST+8 🟡 🟡
AstrologyChart profile_id · jd · planets JSON · houses JSON · system · version 计算服务 按 profile+ver profile_id 🔵
SynastryReport id · profile_a · profile_b · indices JSON · charts JSON · as_of 合盘 报告缓存 (a,b) E3
TestDefinition slug · title · questions JSON · scoring published CMS CDN slug E1 MBTI
TestRecord user_id · test_id · answers · result · share_code 提交 user_id E2
AIConversation id · user_id · profile_ctx_id · mode · messages 热数据 user_id E1
AIQuota user_id · remaining · period 免费额 会员 Redis user_id E1
Expert id · domains[] · price_text · price_voice · score · online 达人平台 列表缓存 domain E1
ConsultOrder id · user_id · expert_id · mode · amount · status created 下单 status E1
Membership user_id · plan · status · expires_at · auto_renew 订阅 expires E1
Order id · kind(membership/unlock/consult/shop) · amount_cents · status 支付 user_id E1
Notification id · user_id · channel · type · payload · read_at 推送/站内 user_id,read E4
PlazaApp id · creator_id · title · heat · status pending UGC 热榜 heat E1
Favorite user_id · target_type · target_id 收藏 uniq 🟡
Coupon id · rules JSON 运营 🔵
OperationLog actor · action · meta 后台 冷存 time 🔵
ABAssignment user_id · exp_key · bucket 配置 Redis 🔵

STEP 6 — 数据库设计(表清单)

必表(前端可感知数据):

users · device_identities · profiles · growth_reports / synastry_reports · test_definitions · test_records · ai_conversations · ai_messages · ai_quotas · experts · consult_orders · memberships · orders · payments · notifications · plaza_apps · favorites · banners · feature_flags · audit_logs

每表要求:PK UUID · created_at/updated_at · 软删 deleted_at · 外键 ON DELETE 策略明确 🔵

合盘邀请示例:synastry_invites(token unique, host_profile_id, expires_at, report_id) 🔵(愈心谷已落地相近结构)。


STEP 7 — API Reverse Engineering(可开发级草案)

Path 为 🔵 工程命名;真实测测 Path【待抓包】

Method Path 权限 Request Response 要点 错误码
POST /auth/login 公网 phone/wx token · user 401
GET /profiles 登录 items[]
POST /profiles 登录 birth_* · relation profile 400
PATCH /profiles/:id 所有者 patch profile 404
POST /tests/:slug/submit 登录 answers record_teaser · record_id 429
GET /reports/:id 所有者 summary · detail? 403 detail
POST /astrology/natal 登录 profile_id chart 400
POST /astrology/synastry 登录 a · b · as_of report 400
GET /astrology/nearby 登录+geo lat,lng,r items 403
POST /ai/chat 登录+额度 message · profile_ctx · deep stream SSE 402 额度
GET /ai/conversations 登录 cursor list
GET /experts 登录 filter list
POST /consult/orders 登录 expert · mode order 402
POST /consult/orders/:id/pay 登录 channel pay_params 409
GET /membership/me 登录 plan · expires
POST /orders 登录 kind · plan/report order_id
GET /messages 登录 cursor items · unread
POST /messages/:id/read 登录 ok
GET /plaza/apps 登录 sort=heat apps
POST /plaza/apps/:id/run 登录 input result 403 审核

RateLimit:AI/支付严格限流;图表计算按用户 QPS 🔵
Cache:星盘按 profile+ephemeris_ver;广场热榜 Redis ZSETBanner CDN。
Retry:幂等键用于支付与咨询下单。


STEP 8 — 后台运营系统

模块 能力 证据
Banner/运营位 首页头图、弹窗、闪屏 🔵
推荐位 达人/测试/文章排序 🟡
内容审核 广场 UGC、社区帖、达人资质 🔵
用户管理 封禁、注销、投诉 🔵
订单/退款 咨询与会员 E1 商业
会员配置 价格、权益、首月优惠 E1
活动配置 裂变、优惠券 🟡
推送 模板、人群包 🔵
统计看板 DAU、转化漏斗、AI 次数 🔵
AB / 配置中心 引导问题文案、价格实验 🔵
达人运营 入驻审核、分佣、培训 E1 达人版

STEP 9 — 权限矩阵

角色 不能
游客 浏览部分首页、部分测评 AI 深度、咨询、发帖
登录用户 档案、基础 AI 次数、下单 未购深度 detail
VIP/会员 扩容 AI、完整报告、专属内容 后台
SVIP 🟡 若存在更高等级
达人 接单、达人工具 改平台分佣
运营 CMS、活动、推荐 直接改支付流水
审核员 通过/驳回 UGC/达人 财务
客服 工单、补发权益 删库
管理员 配置与账号
超管 全量

前端:LoginRequired · VIPLocked · PermissionDenied


STEP 10 — 支付系统

状态:Created → Paying → Paid / Failed / Cancelled →(退款)Refunding → Refunded
场景:重复支付防重 · 补单对账 · 咨询未接单自动退 · 风控限额 · 发票 🔵
渠道:IAP / 微信 / 支付宝 🟡【待真机】
前端:收银台 · 结果页 · 订单详情入口(我的)。


STEP 11 — 消息系统

通道 用途
Push 达人回复、会员到期
站内信 消息 Tab
短信 登录验证码
邮件 可选账单 🔵
角标 Tab 未读聚合

策略:免打扰时段 · 营销推送开关 · AI 主动触达(公开称尚未强做) E1。


STEP 12 — 埋点

事件 触发
page_view 各 Tab/工具
home_grid_click 宫格
test_start / test_complete / test_share 测评
ask_send / ask_deep_toggle / ask_switch_profile
ask_switch_human 转真人
synastry_complete / chart_tab_switch 合盘
expert_view / consult_pay 在线
membership_pay 会员
plaza_app_open 广场
error_api 异常

漏斗:曝光 → 建档 → AI → 会员 → 咨询。停留时长、次日留存 🔵


STEP 13 — 配置系统

后台可配 写死 远程/灰度/AB
宫格顺序/显隐 灰度
AI 引导问题 按来源 AB E1 建议
会员价格 AB
星历版本 逻辑 远程 flag
审核词库
功能开关(沙盘) 灰度

STEP 14 — 缓存策略

内容
本地 档案草稿、会话草稿、最近报告摘要
Redis Session、AI 额度、热榜、限流
CDN 图片、静态运营配置
计算缓存 同档案星盘 TTL
分页 信息流 cursor

STEP 15 — 异常处理(前端必达)

断网 · 弱网 · 超时 · 重复点击(按钮 loading)· Token 失效 · 本地数据损坏清缓存 · 强制升级 · 审核失败文案 · 404 资源 · 支付结果未知查单 · SSE 中断续传 🔵


STEP 16 — 日志

用户行为(隐私脱敏)· 前端错误 JS · API access · 支付 · 审核 · 运营操作 · 安全(登录失败/风控)🔵
保留与销毁策略合规 🔵


STEP 17 — 安全

要求
权限 服务端强制 detail 剥离(不仅藏 UI)
注入/XSS 内容安全渲染
CSRF/重放 支付与关键写接口
验证码 登录/敏感操作
风控 刷单、恶意咨询
设备 device_key / 绑定
隐私 geo 默认不可见;档案分享最小化
心理边界 危机话术与转介

遵守应用商店与网信/心理相关合规 🔵


STEP 18 — 可扩展性

方向 策略
新盘型 charts 插件注册,API 加 mode
新测评 TestDefinition 配置化
新 AI 子场景 Ask 内 slot,避免新 Tab
多端 同一 BFF;小程序裁剪 Marketplace
API 兼容 summary schema version 字段
模块解耦 计算服务与业务 API 分离
硬件(巴布) 独立产品线,账号体系统一 E1

Completeness 自检(STEP 518

  • 数据模型 / 库表 / API 草案
  • 后台 / 权限 / 支付 / 消息 / 埋点
  • 配置 / 缓存 / 异常 / 日志 / 安全 / 扩展
  • 真实抓包字段级对齐【待补证】