This commit is contained in:
2026-05-01 20:29:09 +08:00
parent 8718472dbd
commit 87fbf41fab
137 changed files with 2922 additions and 989 deletions

View File

@@ -63,7 +63,7 @@ SELECT * FROM auth_store_snapshot WHERE snapshot_id = 'default';
### `user_account`
- 作用:用户账号主表,保存用户名、公开陶泥号、手机号掩码、登录方式、密码登录开关和 token 版本。
- 作用:用户账号主表,保存用户名、公开百梦号、手机号掩码、登录方式、密码登录开关和 token 版本。
- 结构:`user_id PK: String`, `public_user_code: String`, `username: String`, `display_name: String`, `avatar_url: Option<String>`, `phone_number_masked: Option<String>`, `phone_number_e164: Option<String>`, `login_method: String`, `binding_status: String`, `wechat_bound: bool`, `password_hash: Option<String>`, `password_login_enabled: bool`, `token_version: u64`
- 索引:`username`, `public_user_code`
@@ -134,6 +134,7 @@ SELECT * FROM user_browse_history WHERE user_id = '<user_id>' AND owner_user_id
- 作用:个人主页聚合状态,保存钱包余额和总游玩时长。
- 结构:`user_id PK: String`, `wallet_balance: u64`, `total_play_time_ms: u64`, `created_at: Timestamp`, `updated_at: Timestamp`
- 索引:主键 `user_id`
- 新用户注册成功后默认写入 `10` 个光点,余额仍以后端钱包 projection 为准。
```sql
SELECT * FROM profile_dashboard_state WHERE user_id = '<user_id>';
@@ -144,6 +145,7 @@ SELECT * FROM profile_dashboard_state WHERE user_id = '<user_id>';
- 作用:钱包流水账,记录金币/货币变更来源与变更后的余额。
- 结构:`wallet_ledger_id PK: String`, `user_id: String`, `amount_delta: i64`, `balance_after: u64`, `source_type: RuntimeProfileWalletLedgerSourceType`, `created_at: Timestamp`
- 索引:`user_id`, `(user_id, created_at)`
- 注册赠送流水来源为 `new_user_registration_reward`,流水 ID 固定为 `new-user-registration:{user_id}`,用于保证重复调用不重复发放。
```sql
SELECT * FROM profile_wallet_ledger WHERE user_id = '<user_id>';
@@ -152,7 +154,7 @@ SELECT * FROM profile_wallet_ledger WHERE user_id = '<user_id>' ORDER BY created
### `profile_redeem_code`
- 作用:运营发放的陶泥币兑换码,支持公共码、唯一码和私有码。
- 作用:运营发放的光点兑换码,支持公共码、唯一码和私有码。
- 结构:`code PK: String`, `mode: RuntimeProfileRedeemCodeMode`, `reward_points: u64`, `max_uses: u32`, `global_used_count: u32`, `enabled: bool`, `allowed_user_ids: Vec<String>`, `created_by: String`, `created_at: Timestamp`, `updated_at: Timestamp`
- 索引:主键 `code`