feat: 支持充值商品配置和档位首充
This commit is contained in:
@@ -24,7 +24,7 @@ spacetime sql <db> "SELECT * FROM custom_world_gallery_entry"
|
||||
| --- | --- |
|
||||
| 运维迁移 | `database_migration_operator`, `database_migration_import_chunk` |
|
||||
| 认证 | `auth_store_snapshot`, `auth_store_projection_meta`, `user_account`, `auth_identity`, `refresh_session` |
|
||||
| 运行时档案 | `runtime_setting`, `runtime_snapshot`, `user_browse_history`, `profile_dashboard_state`, `profile_wallet_ledger`, `analytics_date_dimension`, `tracking_event`, `tracking_daily_stat`, `profile_task_config`, `profile_task_progress`, `profile_task_reward_claim`, `profile_redeem_code`, `profile_redeem_code_usage`, `profile_invite_code`, `profile_referral_relation`, `profile_played_world`, `profile_membership`, `profile_recharge_order`, `profile_feedback_submission`, `profile_save_archive` |
|
||||
| 运行时档案 | `runtime_setting`, `runtime_snapshot`, `user_browse_history`, `profile_dashboard_state`, `profile_wallet_ledger`, `analytics_date_dimension`, `tracking_event`, `tracking_daily_stat`, `profile_task_config`, `profile_task_progress`, `profile_task_reward_claim`, `profile_redeem_code`, `profile_redeem_code_usage`, `profile_invite_code`, `profile_referral_relation`, `profile_played_world`, `profile_membership`, `profile_recharge_product_config`, `profile_recharge_order`, `profile_feedback_submission`, `profile_save_archive` |
|
||||
| RPG 运行时 | `story_session`, `story_event`, `npc_state`, `inventory_slot`, `battle_state`, `treasure_record`, `quest_record`, `quest_log`, `player_progression`, `chapter_progression` |
|
||||
| 世界创作 | `custom_world_profile`, `custom_world_session`, `custom_world_agent_session`, `custom_world_agent_message`, `custom_world_agent_operation`, `custom_world_draft_card`, `custom_world_gallery_entry` |
|
||||
| 拼图 | `puzzle_agent_session`, `puzzle_agent_message`, `puzzle_work_profile`, `puzzle_event`, `puzzle_runtime_run`, `puzzle_leaderboard_entry` |
|
||||
@@ -336,11 +336,23 @@ SELECT * FROM public_work_like WHERE user_id = '<user_id>';
|
||||
SELECT * FROM profile_membership WHERE user_id = '<user_id>';
|
||||
```
|
||||
|
||||
### `profile_recharge_product_config`
|
||||
|
||||
- 作用:充值商品配置表,是泥点和会员充值商品的运行时真相源;默认商品只在空库时作为种子写入,后台“充值商品”页后续维护该表。
|
||||
- 结构:`product_id PK: String`, `title: String`, `price_cents: u64`, `kind: RuntimeProfileRechargeProductKind`, `points_amount: u64`, `bonus_points: u64`, `duration_days: u32`, `badge_label: String`, `description: String`, `tier: RuntimeProfileMembershipTier`, `enabled: bool`, `sort_order: i32`, `created_by: String`, `created_at: Timestamp`, `updated_by: String`, `updated_at: Timestamp`。
|
||||
- 索引:主键 `product_id`。
|
||||
- 充值口径:下单只允许读取 `enabled = true` 的商品;支付确认允许按订单 `product_id` 读取已存在商品完成历史 pending 订单。泥点首充按 `user_id + product_id` 独立判断,只清空已购买档位的 `bonus_points`、`badge_label` 和首充说明。
|
||||
|
||||
```sql
|
||||
SELECT * FROM profile_recharge_product_config ORDER BY sort_order;
|
||||
SELECT * FROM profile_recharge_product_config WHERE product_id = '<product_id>';
|
||||
```
|
||||
|
||||
### `profile_recharge_order`
|
||||
|
||||
- 作用:充值订单表,记录用户购买泥点或会员的订单、支付渠道、支付时间、积分变更和会员到期时间。
|
||||
- 结构:`order_id PK: String`, `user_id: String`, `product_id: String`, `product_title: String`, `kind: RuntimeProfileRechargeProductKind`, `amount_cents: u64`, `status: RuntimeProfileRechargeOrderStatus`, `payment_channel: String`, `paid_at: Option<Timestamp>`, `provider_transaction_id: Option<String>`, `created_at: Timestamp`, `points_delta: i64`, `membership_expires_at: Option<Timestamp>`。
|
||||
- 支付口径:`mock` 渠道创建后立即 `paid` 并入账;微信小程序 `wechat_mp` 渠道创建时为 `pending`,微信支付通知确认后改为 `paid`,`provider_transaction_id` 保存微信支付平台订单号。
|
||||
- 支付口径:`mock` 渠道创建后立即 `paid` 并入账;微信小程序 `wechat_mp` 渠道创建时为 `pending`,微信支付通知确认后改为 `paid`,`provider_transaction_id` 保存微信支付平台订单号。订单商品信息来自 `profile_recharge_product_config`,泥点首充赠送按同一用户的同一 `product_id` 历史 `paid` 订单独立计算。
|
||||
- 索引:`user_id`, `(user_id, created_at)`。
|
||||
|
||||
```sql
|
||||
|
||||
Reference in New Issue
Block a user