f0cad9dddc
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 5m28s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 7m26s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 4m41s
Project CI / AI game creator shell web tests (pull_request) Successful in 3m56s
Project CI / Backend tests (pull_request) Successful in 9m4s
Project CI / Repository checks (pull_request) Successful in 7m13s
Project CI / Native shell tests (pull_request) Successful in 10m16s
Project CI / Frontend tests (pull_request) Successful in 2m26s
- 同步 master 侧 248 个提交:会员与泥点计费(PR #588 / #603)、创作者主页与关注粉丝(PR #638)、运行页刷新真重载(PR #640)、AGC 模板 templateVersion 递增(PR #643)等;确认 master 未触碰发行网关与 `api-server/src/modules/game_distribution.rs`。 - 冲突 1(server-rs/crates/module-runtime/src/domain.rs:1157-1162)`RuntimeProfileWalletLedgerSourceType` 两侧各自在末尾追加变体:保留 master 的 `MembershipUpgradeGrant` 为索引 16(线上已落库口径),本分支 `GamePurchase` 顺延为索引 17,并保留其「每账号每游戏一次扣费」注释。 - 冲突 2(server-rs/crates/module-runtime/src/domain.rs:1184-1188)`as_str()` 同时保留 `membership_upgrade_grant` 与 `game_purchase` 两个分支。 - 冲突 3(server-rs/crates/spacetime-client/src/active/mapper/runtime_profile.rs:95-101)bindings→领域枚举映射同时保留 `MembershipUpgradeGrant` 与 `GamePurchase` 两支,按新索引顺序排列。 - 冲突 4(server-rs/crates/spacetime-client/src/module_bindings/runtime_profile_wallet_ledger_source_type_type.rs:43-47)生成枚举按模块源码顺序合并为 …`MembershipUpgradeGrant`、`GamePurchase`;随后 `npm run spacetime:generate` 复核该文件与生成结果逐字节一致。 - 冲突 5(server-rs/crates/api-server/src/admin.rs:4849-4853)sats 索引映射改为 `16 => membership_upgrade_grant` 与 `17 => game_purchase` 两条并存。 - 冲突 6(server-rs/crates/api-server/src/admin.rs:6368-6461)索引断言并入 master 的 `[16] => membership_upgrade_grant`,并把 master 的「17 尚未映射」占位断言替换为 `[17] => game_purchase`;本分支的后台消耗统计两个用例原样保留。 - 冲突 7(server-rs/crates/api-server/src/runtime_profile.rs:219-226)来源文案格式化同时保留 `MembershipUpgradeGrant` 与 `GamePurchase` 两支,注释随 `GamePurchase` 保留。 - 冲突 8(docs/project-memory/shared-memory/decision-log.md:3-24)两条决策记录并列保留:本分支 2026-10-05「播放会话前缀在三处入口清空 Cookie」在前,master 2026-10-03「每日免费发放额为 0 时前端隐藏该池」在后。 - 保住 master 侧:发行响应 ETag/304/gzip(`release_asset_response_with_cache` 五参形态与 `release_asset_etag` / `if_none_match_matches` / `accepts_gzip_encoding` / `gzip_release_asset` / `release_asset_not_modified_response`)、共享加载面 `PlatformGameLoadingSurface` 及其使用方、三池钱包与会员档位目录改造。 - 保住本分支侧:付费作品 404 守卫(`price_mud_points > 0` 且位于 `load_package` 之前)、购买与播放会话网关路由、nginx×3 / Pingora / Vite 的播放会话 Cookie 清空与 `nginx-route-parity.matrix.json` 登记、viewer 感知公开详情、后台审核价格、`PlatformGamePricingField` 共享定价组件与两端接入、AGC 项目版本只读 + 平台派发下一版本号、schema 与迁移白名单、钱包来源 `game_purchase`。 - 验证:`git merge-base --is-ancestor origin/master HEAD` 返回 0;`check:encoding`、`check:doc-index`、`check:spacetime-schema`、`check:server-rs-ddd`、`check:rustfmt`、`check:npm-workspaces`、`check:game-distribution-dto-parity`、`check:game-distribution-price-limit-parity`、`check:pingora-route-parity`、`check:nginx-spa-routes`、根/admin-web/AGC typecheck、`git diff --check` 全绿。 - 测试:`cargo test -p module-game-distribution` 30 passed,`cargo test -p api-server game_distribution` 61 passed,`cargo test -p spacetime-module game_distribution` 7 passed;定向 vitest 28 个文件 252 个用例全通过。 - `npm run spacetime:generate` 除 11 个 procedure 文件的纯空白格式差异外无任何语义改动(`git diff -w` 为空),已保留 master 的生成产物形态,提交内无 schema/绑定语义变化。
3395 lines
115 KiB
Rust
3395 lines
115 KiB
Rust
//! 运行时领域模型。
|
|
//!
|
|
//! 这里只保留运行时设置、快照、个人页状态、钱包流水、存档和浏览历史等
|
|
//! 纯领域事实与值对象;SpacetimeDB client 与 HTTP response 不进入本文件。
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::RuntimeProfileMembershipPlanRecord;
|
|
#[cfg(any())]
|
|
use serde_json::Value;
|
|
|
|
#[cfg(feature = "spacetime-types")]
|
|
use spacetimedb::SpacetimeType;
|
|
|
|
pub const DEFAULT_MUSIC_VOLUME: f32 = 0.42;
|
|
pub const DEFAULT_PLATFORM_THEME: RuntimePlatformTheme = RuntimePlatformTheme::Light;
|
|
#[cfg(any())]
|
|
pub const DEFAULT_BROWSE_HISTORY_AUTHOR_DISPLAY_NAME: &str = "玩家";
|
|
#[cfg(any())]
|
|
pub const MAX_BROWSE_HISTORY_BATCH_SIZE: usize = 100;
|
|
pub const PROFILE_WALLET_LEDGER_LIST_LIMIT: usize = 50;
|
|
pub const PROFILE_NEW_USER_INITIAL_WALLET_POINTS: u64 = 100;
|
|
pub const PROFILE_WALLET_CONFIG_GLOBAL_ID: &str = "profile_wallet";
|
|
pub const PROFILE_REFERRAL_REWARD_POINTS: u64 = 30;
|
|
pub const PROFILE_REFERRAL_DAILY_INVITER_REWARD_LIMIT: u32 = 10;
|
|
pub const PROFILE_INVITE_CODE_METADATA_DEFAULT_JSON: &str = "{}";
|
|
pub const PROFILE_INVITE_CODE_METADATA_MAX_BYTES: usize = 4096;
|
|
pub const PROFILE_RUNTIME_DAY_MICROS: i64 = 86_400_000_000;
|
|
pub const PROFILE_TASK_BEIJING_OFFSET_MICROS: i64 = 28_800_000_000;
|
|
pub const ANALYTICS_DATE_DIMENSION_MAX_SEED_DAYS: i64 = 3_660;
|
|
// 中文注释:日期维表当前只预置运营统计可接受的业务日期范围,避免裸 date_key 极值进入日历算法。
|
|
pub const ANALYTICS_DATE_DIMENSION_MIN_DATE: &str = "2000-01-01";
|
|
pub const ANALYTICS_DATE_DIMENSION_MAX_DATE: &str = "2100-12-31";
|
|
pub const PROFILE_TASK_ID_DAILY_LOGIN: &str = "daily_login";
|
|
pub const PROFILE_TASK_EVENT_KEY_DAILY_LOGIN: &str = "daily_login";
|
|
pub const PROFILE_TASK_DEFAULT_TITLE_DAILY_LOGIN: &str = "每日登录";
|
|
pub const PROFILE_TASK_DEFAULT_REWARD_POINTS: u64 = 10;
|
|
pub const PROFILE_TASK_DEFAULT_THRESHOLD: u32 = 1;
|
|
pub const PROFILE_DEFAULT_DAILY_FREE_POINTS_PER_DAY: u64 = 20;
|
|
#[cfg(any())]
|
|
pub const SAVE_SNAPSHOT_VERSION: u32 = 2;
|
|
#[cfg(any())]
|
|
pub const DEFAULT_SAVE_ARCHIVE_SUMMARY_TEXT: &str = "继续推进上一次保存的故事。";
|
|
pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_MOCK: &str = "mock";
|
|
pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_MINI_PROGRAM: &str = "wechat_mp";
|
|
pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_MINI_PROGRAM_VIRTUAL: &str = "wechat_mp_virtual";
|
|
pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_JSAPI: &str = "wechat_jsapi";
|
|
pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_H5: &str = "wechat_h5";
|
|
pub const PROFILE_RECHARGE_PAYMENT_CHANNEL_WECHAT_NATIVE: &str = "wechat_native";
|
|
pub const PROFILE_RECHARGE_ORDER_EXPIRATION_SECONDS: i64 = 5 * 60;
|
|
pub const PROFILE_FEEDBACK_DESCRIPTION_MIN_CHARS: usize = 10;
|
|
pub const PROFILE_FEEDBACK_DESCRIPTION_MAX_CHARS: usize = 200;
|
|
pub const PROFILE_FEEDBACK_CONTACT_PHONE_MAX_CHARS: usize = 40;
|
|
pub const PROFILE_FEEDBACK_EVIDENCE_MAX_COUNT: usize = 4;
|
|
pub const PROFILE_FEEDBACK_EVIDENCE_MAX_BYTES: u64 = 1_048_576;
|
|
pub const PROFILE_FEEDBACK_EVIDENCE_TOTAL_MAX_BYTES: u64 = 4_194_304;
|
|
|
|
#[cfg(any())]
|
|
pub const CREATION_ENTRY_CONFIG_GLOBAL_ID: &str = "platform_creation_center";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_START_TITLE: &str = "新建作品";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_START_DESCRIPTION: &str = "选择模板后进入对应的创作表单。";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_START_IDLE_BADGE: &str = "模板 Tab";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_START_BUSY_BADGE: &str = "正在开启";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_MODAL_TITLE: &str = "选择创作类型";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_MODAL_DESCRIPTION: &str = "先选玩法类型,再进入对应创作工作台。";
|
|
/// 创作模板分类缺省回退到推荐,不再把真实作品维度的“最近创作”种成模板页签。
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_CATEGORY_ID: &str = "recommended";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_CATEGORY_LABEL: &str = "热门推荐";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_EVENT_TITLE: &str = "主题创作赛";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_EVENT_DESCRIPTION: &str = "用温暖的色彩,捏出秋天的故事。";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_EVENT_COVER_IMAGE_SRC: &str =
|
|
"/creation-type-references/puzzle.webp";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_EVENT_PRIZE_POOL_MUD_POINTS: u64 = 58_000;
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_EVENT_STARTS_AT_TEXT: &str = "2024.10.20 10:00";
|
|
#[cfg(any())]
|
|
pub const DEFAULT_CREATION_ENTRY_EVENT_ENDS_AT_TEXT: &str = "2024.11.20 23:59";
|
|
/// 后台创作入口公告最多允许配置的轮播条数。
|
|
#[cfg(any())]
|
|
pub const CREATION_ENTRY_EVENT_BANNERS_MAX_COUNT: usize = 8;
|
|
/// 单条 HTML 公告的代码大小上限,避免后台误贴超大片段拖慢入口页。
|
|
#[cfg(any())]
|
|
pub const CREATION_ENTRY_EVENT_BANNER_HTML_CODE_MAX_BYTES: usize = 12_000;
|
|
/// 公开作品互动配置最多允许覆盖的 sourceType 数量。
|
|
#[cfg(any())]
|
|
pub const PUBLIC_WORK_INTERACTION_CONFIG_MAX_COUNT: usize = 32;
|
|
pub const FEATURE_GATE_KEY_MAX_CHARS: usize = 128;
|
|
pub const FEATURE_GATE_DESCRIPTION_MAX_CHARS: usize = 240;
|
|
pub const FEATURE_GATE_LIST_MAX_COUNT: usize = 500;
|
|
pub const FEATURE_GATE_LIST_ITEM_MAX_CHARS: usize = 128;
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct CreationEntryStartCardSnapshot {
|
|
pub title: String,
|
|
pub description: String,
|
|
pub idle_badge: String,
|
|
pub busy_badge: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct CreationEntryTypeModalSnapshot {
|
|
pub title: String,
|
|
pub description: String,
|
|
}
|
|
|
|
/// 创作入口公告快照,支持 HTML 公告渲染和旧结构化 banner 兼容。
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct CreationEntryEventBannerSnapshot {
|
|
pub title: String,
|
|
pub description: String,
|
|
pub cover_image_src: String,
|
|
pub prize_pool_mud_points: u64,
|
|
pub starts_at_text: String,
|
|
pub ends_at_text: String,
|
|
pub render_mode: String,
|
|
pub html_code: Option<String>,
|
|
}
|
|
|
|
/// 单类公开作品互动配置,控制作品详情页点赞 / 改造入口与后端动作熔断。
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct PublicWorkInteractionConfigSnapshot {
|
|
pub source_type: String,
|
|
pub like_enabled: bool,
|
|
pub remix_enabled: bool,
|
|
pub like_disabled_message: String,
|
|
pub remix_disabled_message: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct CreationEntryTypeSnapshot {
|
|
pub id: String,
|
|
pub title: String,
|
|
pub subtitle: String,
|
|
pub badge: String,
|
|
pub image_src: String,
|
|
pub visible: bool,
|
|
pub open: bool,
|
|
pub sort_order: i32,
|
|
pub category_id: String,
|
|
pub category_label: String,
|
|
pub category_sort_order: i32,
|
|
pub updated_at_micros: i64,
|
|
pub unified_creation_spec_json: Option<String>,
|
|
}
|
|
|
|
/// 创作入口全局配置快照,供前台入口页和后台配置页共同读取。
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct CreationEntryConfigSnapshot {
|
|
pub config_id: String,
|
|
pub start_card: CreationEntryStartCardSnapshot,
|
|
pub type_modal: CreationEntryTypeModalSnapshot,
|
|
pub event_banner: CreationEntryEventBannerSnapshot,
|
|
/// 底部加号创作入口页的多公告 JSON 配置;旧库为空时由应用层兜底。
|
|
pub event_banners_json: Option<String>,
|
|
pub creation_types: Vec<CreationEntryTypeSnapshot>,
|
|
pub updated_at_micros: i64,
|
|
/// 公开作品点赞 / 改造能力 JSON 配置;旧库为空时由应用层兜底。
|
|
pub public_work_interactions_json: Option<String>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct CreationEntryTypeAdminUpsertInput {
|
|
pub id: String,
|
|
pub title: String,
|
|
pub subtitle: String,
|
|
pub badge: String,
|
|
pub image_src: String,
|
|
pub visible: bool,
|
|
pub open: bool,
|
|
pub sort_order: i32,
|
|
pub category_id: String,
|
|
pub category_label: String,
|
|
pub category_sort_order: i32,
|
|
pub unified_creation_spec_json: Option<String>,
|
|
}
|
|
|
|
/// 后台保存创作入口多公告表单序列化结果的领域输入。
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct CreationEntryEventBannersAdminUpsertInput {
|
|
/// 持久化字段沿用 JSON 字符串,内容由后台表单生成。
|
|
pub event_banners_json: String,
|
|
}
|
|
|
|
/// 后台保存公开作品互动能力表单序列化结果的领域输入。
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct PublicWorkInteractionConfigAdminUpsertInput {
|
|
/// 持久化字段沿用 JSON 字符串,内容由后台表单生成。
|
|
pub public_work_interactions_json: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct CreationEntryConfigProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<CreationEntryConfigSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
/// 通用功能灰度配置,当前首个业务接入点是创作入口 `creation-entry:<id>`。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct FeatureGateConfigSnapshot {
|
|
pub gate_key: String,
|
|
pub enabled: bool,
|
|
pub rollout_percent: u32,
|
|
pub allow_user_ids: Vec<String>,
|
|
pub allow_user_tags: Vec<String>,
|
|
pub deny_user_ids: Vec<String>,
|
|
pub description: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct FeatureGateConfigAdminUpsertInput {
|
|
pub gate_key: String,
|
|
pub enabled: bool,
|
|
pub rollout_percent: u32,
|
|
pub allow_user_ids: Vec<String>,
|
|
pub allow_user_tags: Vec<String>,
|
|
pub deny_user_ids: Vec<String>,
|
|
pub description: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct FeatureGateConfigProcedureResult {
|
|
pub ok: bool,
|
|
pub records: Vec<FeatureGateConfigSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
|
pub struct FeatureGateUserContext {
|
|
pub user_id: Option<String>,
|
|
pub user_tags: Vec<String>,
|
|
}
|
|
|
|
/// 后台作品可见性列表项。
|
|
///
|
|
/// source_type/profile_id 是后台统一操作键;少数玩法的 profile_id 会映射到底层
|
|
/// session_id 或 work_id,避免后台了解每个源表的主键差异。
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AdminWorkVisibilitySnapshot {
|
|
pub source_type: String,
|
|
pub work_id: String,
|
|
pub profile_id: String,
|
|
pub source_session_id: Option<String>,
|
|
pub public_work_code: String,
|
|
pub owner_user_id: String,
|
|
pub author_display_name: String,
|
|
pub title: String,
|
|
pub subtitle: String,
|
|
pub cover_image_src: Option<String>,
|
|
pub visible: bool,
|
|
pub published_at_micros: Option<i64>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AdminWorkVisibilityListInput {
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AdminWorkVisibilityUpdateInput {
|
|
pub admin_user_id: String,
|
|
pub source_type: String,
|
|
pub profile_id: String,
|
|
pub visible: bool,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AdminWorkVisibilityListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<AdminWorkVisibilitySnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AdminWorkVisibilityProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<AdminWorkVisibilitySnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
/// 分析日期维表的纯领域快照。
|
|
///
|
|
/// date_key 沿用现有北京时间自然日桶:floor((occurred_at_micros + 8h) / 1d)。
|
|
/// calendar_date 使用该业务日对应的公历日期,格式固定为 YYYY-MM-DD。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AnalyticsDateDimensionSnapshot {
|
|
pub date_key: i64,
|
|
pub calendar_date: String,
|
|
pub weekday: u8,
|
|
pub iso_week_key: i32,
|
|
pub week_start_date_key: i64,
|
|
pub week_end_date_key: i64,
|
|
pub month_key: i32,
|
|
pub month_start_date_key: i64,
|
|
pub month_end_date_key: i64,
|
|
pub quarter_key: i32,
|
|
pub quarter_start_date_key: i64,
|
|
pub quarter_end_date_key: i64,
|
|
pub year_key: i32,
|
|
pub year_start_date_key: i64,
|
|
pub year_end_date_key: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum AnalyticsGranularity {
|
|
Day,
|
|
Week,
|
|
Month,
|
|
Quarter,
|
|
Year,
|
|
}
|
|
|
|
impl AnalyticsGranularity {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Day => "day",
|
|
Self::Week => "week",
|
|
Self::Month => "month",
|
|
Self::Quarter => "quarter",
|
|
Self::Year => "year",
|
|
}
|
|
}
|
|
|
|
pub fn from_client_str(value: &str) -> Option<Self> {
|
|
match value.trim().to_ascii_lowercase().as_str() {
|
|
"day" => Some(Self::Day),
|
|
"week" => Some(Self::Week),
|
|
"month" => Some(Self::Month),
|
|
"quarter" => Some(Self::Quarter),
|
|
"year" => Some(Self::Year),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct RuntimeAnalyticsDailyStatSnapshot {
|
|
pub event_key: String,
|
|
pub scope_kind: RuntimeTrackingScopeKind,
|
|
pub scope_id: String,
|
|
pub day_key: i64,
|
|
pub count: u32,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AnalyticsBucketMetric {
|
|
pub bucket_key: String,
|
|
pub bucket_start_date_key: i64,
|
|
pub bucket_end_date_key: i64,
|
|
pub value: u64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct AnalyticsMetricQueryRequest {
|
|
pub event_key: String,
|
|
pub scope_kind: RuntimeTrackingScopeKind,
|
|
pub scope_id: String,
|
|
pub granularity: AnalyticsGranularity,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct AnalyticsMetricQueryResponse {
|
|
pub buckets: Vec<AnalyticsBucketMetric>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct AnalyticsMetricQueryProcedureResult {
|
|
pub ok: bool,
|
|
pub buckets: Vec<AnalyticsBucketMetric>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
/// 运行时平台主题。
|
|
///
|
|
/// 当前只冻结 light/dark 两种主题,避免各层散落字符串字面量。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimePlatformTheme {
|
|
Light,
|
|
Dark,
|
|
}
|
|
|
|
impl RuntimePlatformTheme {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Light => "light",
|
|
Self::Dark => "dark",
|
|
}
|
|
}
|
|
|
|
pub fn from_client_str(value: &str) -> Self {
|
|
if value.trim().eq_ignore_ascii_case("dark") {
|
|
Self::Dark
|
|
} else {
|
|
Self::Light
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 运行时设置聚合。
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeSettings {
|
|
pub music_volume: f32,
|
|
pub platform_theme: RuntimePlatformTheme,
|
|
}
|
|
|
|
impl RuntimeSettings {
|
|
pub fn defaults() -> Self {
|
|
Self {
|
|
music_volume: DEFAULT_MUSIC_VOLUME,
|
|
platform_theme: DEFAULT_PLATFORM_THEME,
|
|
}
|
|
}
|
|
|
|
/// 与旧 Node 仓储保持一致:音量 clamp 到 0~1,主题除 dark 外统一回退到 light。
|
|
pub fn normalized(music_volume: f32, platform_theme: RuntimePlatformTheme) -> Self {
|
|
Self {
|
|
music_volume: music_volume.clamp(0.0, 1.0),
|
|
platform_theme,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSnapshot {
|
|
pub user_id: String,
|
|
pub version: u32,
|
|
pub saved_at_micros: i64,
|
|
pub bottom_tab: String,
|
|
pub game_state_json: String,
|
|
pub current_story_json: Option<String>,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSnapshotProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSnapshotGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSnapshotUpsertInput {
|
|
pub user_id: String,
|
|
pub saved_at_micros: i64,
|
|
pub bottom_tab: String,
|
|
pub game_state_json: String,
|
|
pub current_story_json: Option<String>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSnapshotDeleteInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileSaveArchiveSnapshot {
|
|
pub archive_id: String,
|
|
pub user_id: String,
|
|
pub world_key: String,
|
|
pub owner_user_id: Option<String>,
|
|
pub profile_id: Option<String>,
|
|
pub world_type: Option<String>,
|
|
pub world_name: String,
|
|
pub subtitle: String,
|
|
pub summary_text: String,
|
|
pub cover_image_src: Option<String>,
|
|
pub saved_at_micros: i64,
|
|
pub bottom_tab: String,
|
|
pub game_state_json: String,
|
|
pub current_story_json: Option<String>,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileSaveArchiveProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileSaveArchiveSnapshot>,
|
|
pub record: Option<RuntimeProfileSaveArchiveSnapshot>,
|
|
pub current_snapshot: Option<RuntimeSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileSaveArchiveListInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileSaveArchiveResumeInput {
|
|
pub user_id: String,
|
|
pub world_key: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeSaveCheckpointInput {
|
|
pub session_id: String,
|
|
pub bottom_tab: String,
|
|
pub saved_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeSaveCheckpointSnapshotUpdate {
|
|
pub saved_at_micros: i64,
|
|
pub bottom_tab: String,
|
|
pub game_state: Value,
|
|
pub current_story: Option<Value>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
/// 浏览历史沿用平台已有的六种世界主题,但独立冻结在 runtime 领域内,避免反向耦合创作域 crate。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeBrowseHistoryThemeMode {
|
|
Martial,
|
|
Arcane,
|
|
Machina,
|
|
Tide,
|
|
Rift,
|
|
Mythic,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
impl RuntimeBrowseHistoryThemeMode {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Martial => "martial",
|
|
Self::Arcane => "arcane",
|
|
Self::Machina => "machina",
|
|
Self::Tide => "tide",
|
|
Self::Rift => "rift",
|
|
Self::Mythic => "mythic",
|
|
}
|
|
}
|
|
|
|
/// 浏览历史主题沿用旧 Node 逻辑:不做严格校验,未知值统一回退到 mythic。
|
|
pub fn from_client_str(value: &str) -> Self {
|
|
match value.trim().to_ascii_lowercase().as_str() {
|
|
"martial" => Self::Martial,
|
|
"arcane" => Self::Arcane,
|
|
"machina" => Self::Machina,
|
|
"tide" => Self::Tide,
|
|
"rift" => Self::Rift,
|
|
_ => Self::Mythic,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSettingSnapshot {
|
|
pub user_id: String,
|
|
pub music_volume: f32,
|
|
pub platform_theme: RuntimePlatformTheme,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSettingProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeSettingSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSettingGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeSettingUpsertInput {
|
|
pub user_id: String,
|
|
pub music_volume: f32,
|
|
pub platform_theme: RuntimePlatformTheme,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeBrowseHistorySnapshot {
|
|
pub browse_history_id: String,
|
|
pub user_id: String,
|
|
pub owner_user_id: String,
|
|
pub profile_id: String,
|
|
pub world_name: String,
|
|
pub subtitle: String,
|
|
pub summary_text: String,
|
|
pub cover_image_src: Option<String>,
|
|
pub theme_mode: RuntimeBrowseHistoryThemeMode,
|
|
pub author_display_name: String,
|
|
pub visited_at_micros: i64,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeBrowseHistoryProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeBrowseHistorySnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeBrowseHistoryListInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeBrowseHistoryClearInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeBrowseHistoryWriteInput {
|
|
pub owner_user_id: String,
|
|
pub profile_id: String,
|
|
pub world_name: String,
|
|
pub subtitle: Option<String>,
|
|
pub summary_text: Option<String>,
|
|
pub cover_image_src: Option<String>,
|
|
pub theme_mode: Option<String>,
|
|
pub author_display_name: Option<String>,
|
|
pub visited_at: Option<String>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeBrowseHistorySyncInput {
|
|
pub user_id: String,
|
|
pub entries: Vec<RuntimeBrowseHistoryWriteInput>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileDashboardSnapshot {
|
|
pub user_id: String,
|
|
pub wallet_balance: u64,
|
|
pub total_play_time_ms: u64,
|
|
pub played_world_count: u32,
|
|
pub updated_at_micros: Option<i64>,
|
|
pub daily_free_points: RuntimeProfileDailyFreePointsSnapshot,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileDailyFreePointsSnapshot {
|
|
pub day_key: i64,
|
|
pub granted_points: u64,
|
|
pub remaining_points: u64,
|
|
pub resets_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
pub reset_points: u64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileDashboardProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileDashboardSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileDashboardGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConfigSnapshot {
|
|
pub config_id: String,
|
|
pub initial_mud_points: u64,
|
|
pub created_by: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_by: String,
|
|
pub updated_at_micros: i64,
|
|
pub daily_free_points_per_day: u64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConfigAdminGetInput {
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConfigAdminUpsertInput {
|
|
pub admin_user_id: String,
|
|
pub initial_mud_points: u64,
|
|
pub updated_at_micros: i64,
|
|
pub daily_free_points_per_day: u64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConfigAdminProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileWalletConfigSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileFeedbackStatus {
|
|
Open,
|
|
}
|
|
|
|
impl RuntimeProfileFeedbackStatus {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Open => "open",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileFeedbackEvidenceSnapshot {
|
|
pub evidence_id: String,
|
|
pub file_name: String,
|
|
pub content_type: String,
|
|
pub size_bytes: u64,
|
|
pub data_url: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileFeedbackSubmissionInput {
|
|
pub user_id: String,
|
|
pub description: String,
|
|
pub contact_phone: Option<String>,
|
|
pub evidence_items: Vec<RuntimeProfileFeedbackEvidenceSnapshot>,
|
|
pub created_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileFeedbackSubmissionSnapshot {
|
|
pub feedback_id: String,
|
|
pub user_id: String,
|
|
pub description: String,
|
|
pub contact_phone: Option<String>,
|
|
pub evidence_json: String,
|
|
pub status: RuntimeProfileFeedbackStatus,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileFeedbackSubmissionProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileFeedbackSubmissionSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct RuntimeProfileFeedbackEvidenceRecord {
|
|
pub evidence_id: String,
|
|
pub file_name: String,
|
|
pub content_type: String,
|
|
pub size_bytes: u64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct RuntimeProfileFeedbackSubmissionRecord {
|
|
pub feedback_id: String,
|
|
pub user_id: String,
|
|
pub description: String,
|
|
pub contact_phone: Option<String>,
|
|
pub evidence_items: Vec<RuntimeProfileFeedbackEvidenceRecord>,
|
|
pub status: RuntimeProfileFeedbackStatus,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeTrackingScopeKind {
|
|
Site,
|
|
Work,
|
|
Module,
|
|
User,
|
|
}
|
|
|
|
impl RuntimeTrackingScopeKind {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Site => "site",
|
|
Self::Work => "work",
|
|
Self::Module => "module",
|
|
Self::User => "user",
|
|
}
|
|
}
|
|
|
|
pub fn from_client_str(value: &str) -> Option<Self> {
|
|
match value.trim().to_ascii_lowercase().as_str() {
|
|
"site" => Some(Self::Site),
|
|
"work" => Some(Self::Work),
|
|
"module" => Some(Self::Module),
|
|
"user" => Some(Self::User),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileTaskCycle {
|
|
Daily,
|
|
}
|
|
|
|
impl RuntimeProfileTaskCycle {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Daily => "daily",
|
|
}
|
|
}
|
|
|
|
pub fn from_client_str(value: &str) -> Option<Self> {
|
|
match value.trim().to_ascii_lowercase().as_str() {
|
|
"daily" => Some(Self::Daily),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileTaskStatus {
|
|
Incomplete,
|
|
Claimable,
|
|
Claimed,
|
|
Disabled,
|
|
}
|
|
|
|
impl RuntimeProfileTaskStatus {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Incomplete => "incomplete",
|
|
Self::Claimable => "claimable",
|
|
Self::Claimed => "claimed",
|
|
Self::Disabled => "disabled",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileInviteCodeStatus {
|
|
Pending,
|
|
Active,
|
|
Expired,
|
|
}
|
|
|
|
impl RuntimeProfileInviteCodeStatus {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Pending => "pending",
|
|
Self::Active => "active",
|
|
Self::Expired => "expired",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeTrackingEventInput {
|
|
pub event_id: String,
|
|
pub event_key: String,
|
|
pub scope_kind: RuntimeTrackingScopeKind,
|
|
pub scope_id: String,
|
|
pub user_id: Option<String>,
|
|
pub owner_user_id: Option<String>,
|
|
pub profile_id: Option<String>,
|
|
pub module_key: Option<String>,
|
|
pub metadata_json: String,
|
|
pub occurred_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeTrackingEventProcedureResult {
|
|
pub ok: bool,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeTrackingEventBatchProcedureResult {
|
|
pub ok: bool,
|
|
pub accepted_count: u32,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskConfigSnapshot {
|
|
pub task_id: String,
|
|
pub title: String,
|
|
pub description: String,
|
|
pub event_key: String,
|
|
pub cycle: RuntimeProfileTaskCycle,
|
|
pub scope_kind: RuntimeTrackingScopeKind,
|
|
pub threshold: u32,
|
|
pub reward_points: u64,
|
|
pub enabled: bool,
|
|
pub sort_order: i32,
|
|
pub created_by: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_by: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskItemSnapshot {
|
|
pub task_id: String,
|
|
pub title: String,
|
|
pub description: String,
|
|
pub event_key: String,
|
|
pub cycle: RuntimeProfileTaskCycle,
|
|
pub threshold: u32,
|
|
pub progress_count: u32,
|
|
pub reward_points: u64,
|
|
pub status: RuntimeProfileTaskStatus,
|
|
pub day_key: i64,
|
|
pub claimed_at_micros: Option<i64>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskCenterSnapshot {
|
|
pub user_id: String,
|
|
pub day_key: i64,
|
|
pub wallet_balance: u64,
|
|
pub tasks: Vec<RuntimeProfileTaskItemSnapshot>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskCenterProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileTaskCenterSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskClaimSnapshot {
|
|
pub user_id: String,
|
|
pub task_id: String,
|
|
pub day_key: i64,
|
|
pub reward_points: u64,
|
|
pub wallet_balance: u64,
|
|
pub ledger_entry: RuntimeProfileWalletLedgerEntrySnapshot,
|
|
pub center: RuntimeProfileTaskCenterSnapshot,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskClaimProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileTaskClaimSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskCenterGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct AnalyticsMetricQueryInput {
|
|
pub event_key: String,
|
|
pub scope_kind: RuntimeTrackingScopeKind,
|
|
pub scope_id: String,
|
|
pub granularity: AnalyticsGranularity,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskClaimInput {
|
|
pub user_id: String,
|
|
pub task_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskConfigAdminListInput {
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskConfigAdminUpsertInput {
|
|
pub admin_user_id: String,
|
|
pub task_id: String,
|
|
pub title: String,
|
|
pub description: String,
|
|
pub event_key: String,
|
|
pub cycle: RuntimeProfileTaskCycle,
|
|
pub scope_kind: RuntimeTrackingScopeKind,
|
|
pub threshold: u32,
|
|
pub reward_points: u64,
|
|
pub enabled: bool,
|
|
pub sort_order: i32,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskConfigAdminDisableInput {
|
|
pub admin_user_id: String,
|
|
pub task_id: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskConfigAdminListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileTaskConfigSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileTaskConfigAdminProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileTaskConfigSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileWalletLedgerSourceType {
|
|
SnapshotSync,
|
|
NewUserRegistrationReward,
|
|
InviteInviterReward,
|
|
InviteInviteeReward,
|
|
PointsRecharge,
|
|
AssetOperationConsume,
|
|
AssetOperationRefund,
|
|
RedeemCodeReward,
|
|
PuzzleAuthorIncentiveClaim,
|
|
DailyTaskReward,
|
|
MembershipPeriodGrant,
|
|
MembershipPeriodReset,
|
|
DailyFreeGrant,
|
|
DailyFreeReset,
|
|
RechargeRefundRecovery,
|
|
LlmRouterConsume,
|
|
MembershipUpgradeGrant,
|
|
/// 游戏买断制购买扣费(每账号每游戏一次)。
|
|
GamePurchase,
|
|
}
|
|
|
|
impl RuntimeProfileWalletLedgerSourceType {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::SnapshotSync => "snapshot_sync",
|
|
Self::NewUserRegistrationReward => "new_user_registration_reward",
|
|
Self::InviteInviterReward => "invite_inviter_reward",
|
|
Self::InviteInviteeReward => "invite_invitee_reward",
|
|
Self::PointsRecharge => "points_recharge",
|
|
Self::MembershipPeriodGrant => "membership_period_grant",
|
|
Self::MembershipPeriodReset => "membership_period_reset",
|
|
Self::AssetOperationConsume => "asset_operation_consume",
|
|
Self::AssetOperationRefund => "asset_operation_refund",
|
|
Self::RedeemCodeReward => "redeem_code_reward",
|
|
Self::PuzzleAuthorIncentiveClaim => "puzzle_author_incentive_claim",
|
|
Self::DailyTaskReward => "daily_task_reward",
|
|
Self::DailyFreeGrant => "daily_free_grant",
|
|
Self::DailyFreeReset => "daily_free_reset",
|
|
Self::RechargeRefundRecovery => "recharge_refund_recovery",
|
|
Self::LlmRouterConsume => "llm_router_consume",
|
|
Self::MembershipUpgradeGrant => "membership_upgrade_grant",
|
|
Self::GamePurchase => "game_purchase",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileRedeemCodeMode {
|
|
Public,
|
|
Unique,
|
|
Private,
|
|
}
|
|
|
|
impl RuntimeProfileRedeemCodeMode {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Public => "public",
|
|
Self::Unique => "unique",
|
|
Self::Private => "private",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileRechargeProductKind {
|
|
Points,
|
|
Membership,
|
|
}
|
|
|
|
impl RuntimeProfileRechargeProductKind {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Points => "points",
|
|
Self::Membership => "membership",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileMembershipStatus {
|
|
Normal,
|
|
Active,
|
|
}
|
|
|
|
impl RuntimeProfileMembershipStatus {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Normal => "normal",
|
|
Self::Active => "active",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 已退役:旧会员档位身份。
|
|
///
|
|
/// 仅为兼容存量 `profile_membership.tier` 与 `profile_recharge_product_config.tier`
|
|
/// 列保留,运行时不读不写;档位身份统一由 [`RuntimeProfileMembershipPlan`] 承载。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileMembershipTier {
|
|
Normal,
|
|
Month,
|
|
Season,
|
|
Year,
|
|
Starter,
|
|
Basic,
|
|
Pro,
|
|
Ultimate,
|
|
}
|
|
|
|
/// 会员档位身份。取代旧的 `RuntimeProfileMembershipTier`,作为唯一权威档位标识。
|
|
///
|
|
/// 档位高低由目录表的 `rank` 决定(见
|
|
/// [`runtime_profile_membership_plan_rank`](crate::runtime_profile_membership_plan_rank));
|
|
/// 本枚举不实现 `PartialOrd` / `Ord`,变体声明顺序不构成排序契约(当前恰与 `rank` 一致),
|
|
/// 升级比较一律以目录 `rank` 为唯一来源。对外 wire 只用
|
|
/// [`RuntimeProfileMembershipPlan::as_str`] 产出的枚举 token。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileMembershipPlan {
|
|
Normal,
|
|
Starter,
|
|
Plus,
|
|
Pro,
|
|
Max,
|
|
}
|
|
|
|
impl RuntimeProfileMembershipPlan {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Normal => "normal",
|
|
Self::Starter => "starter",
|
|
Self::Plus => "plus",
|
|
Self::Pro => "pro",
|
|
Self::Max => "max",
|
|
}
|
|
}
|
|
|
|
/// 严格解析对外 wire token;未知 token 返回 `None`,调用方必须显式拒绝,不接受自由字符串。
|
|
pub fn parse(value: &str) -> Option<Self> {
|
|
match value {
|
|
"normal" => Some(Self::Normal),
|
|
"starter" => Some(Self::Starter),
|
|
"plus" => Some(Self::Plus),
|
|
"pro" => Some(Self::Pro),
|
|
"max" => Some(Self::Max),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
/// `Normal` 不是可售档位,其余档位可在充值中心购买。
|
|
pub fn is_purchasable(&self) -> bool {
|
|
!matches!(self, Self::Normal)
|
|
}
|
|
}
|
|
|
|
/// 会员购买周期类型。它只决定本次购买的总期数与到期日,单期窗口一律按自然月推进。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileMembershipCycleKind {
|
|
Monthly,
|
|
Yearly,
|
|
}
|
|
|
|
impl RuntimeProfileMembershipCycleKind {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Monthly => "monthly",
|
|
Self::Yearly => "yearly",
|
|
}
|
|
}
|
|
|
|
pub fn parse(value: &str) -> Option<Self> {
|
|
match value {
|
|
"monthly" => Some(Self::Monthly),
|
|
"yearly" => Some(Self::Yearly),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
/// 本次购买的总期数:月付 1 期、年付 12 期(每期仍是一个自然月)。
|
|
pub fn cycle_count(&self) -> u32 {
|
|
match self {
|
|
Self::Monthly => 1,
|
|
Self::Yearly => 12,
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 档位允许选择的模型范围。本期只落字段、只用于展示,服务端不做拦截。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileMembershipModelAccess {
|
|
Basic,
|
|
Full,
|
|
}
|
|
|
|
impl RuntimeProfileMembershipModelAccess {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Basic => "basic",
|
|
Self::Full => "full",
|
|
}
|
|
}
|
|
|
|
pub fn parse(value: &str) -> Option<Self> {
|
|
match value {
|
|
"basic" => Some(Self::Basic),
|
|
"full" => Some(Self::Full),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 会员订单产生的权益变更类型,用于订单快照区分「新购」与「补差升级」。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileMembershipChangeKind {
|
|
Purchase,
|
|
Upgrade,
|
|
}
|
|
|
|
impl RuntimeProfileMembershipChangeKind {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Purchase => "purchase",
|
|
Self::Upgrade => "upgrade",
|
|
}
|
|
}
|
|
|
|
pub fn parse(value: &str) -> Option<Self> {
|
|
match value {
|
|
"purchase" => Some(Self::Purchase),
|
|
"upgrade" => Some(Self::Upgrade),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileMembershipPlan> for shared_contracts::runtime::ProfileMembershipPlanToken {
|
|
fn from(value: RuntimeProfileMembershipPlan) -> Self {
|
|
match value {
|
|
RuntimeProfileMembershipPlan::Normal => Self::Normal,
|
|
RuntimeProfileMembershipPlan::Starter => Self::Starter,
|
|
RuntimeProfileMembershipPlan::Plus => Self::Plus,
|
|
RuntimeProfileMembershipPlan::Pro => Self::Pro,
|
|
RuntimeProfileMembershipPlan::Max => Self::Max,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<shared_contracts::runtime::ProfileMembershipPlanToken> for RuntimeProfileMembershipPlan {
|
|
fn from(value: shared_contracts::runtime::ProfileMembershipPlanToken) -> Self {
|
|
match value {
|
|
shared_contracts::runtime::ProfileMembershipPlanToken::Normal => Self::Normal,
|
|
shared_contracts::runtime::ProfileMembershipPlanToken::Starter => Self::Starter,
|
|
shared_contracts::runtime::ProfileMembershipPlanToken::Plus => Self::Plus,
|
|
shared_contracts::runtime::ProfileMembershipPlanToken::Pro => Self::Pro,
|
|
shared_contracts::runtime::ProfileMembershipPlanToken::Max => Self::Max,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileMembershipCycleKind>
|
|
for shared_contracts::runtime::ProfileMembershipCycleKindToken
|
|
{
|
|
fn from(value: RuntimeProfileMembershipCycleKind) -> Self {
|
|
match value {
|
|
RuntimeProfileMembershipCycleKind::Monthly => Self::Monthly,
|
|
RuntimeProfileMembershipCycleKind::Yearly => Self::Yearly,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<shared_contracts::runtime::ProfileMembershipCycleKindToken>
|
|
for RuntimeProfileMembershipCycleKind
|
|
{
|
|
fn from(value: shared_contracts::runtime::ProfileMembershipCycleKindToken) -> Self {
|
|
match value {
|
|
shared_contracts::runtime::ProfileMembershipCycleKindToken::Monthly => Self::Monthly,
|
|
shared_contracts::runtime::ProfileMembershipCycleKindToken::Yearly => Self::Yearly,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileMembershipStatus>
|
|
for shared_contracts::runtime::ProfileMembershipStatusToken
|
|
{
|
|
fn from(value: RuntimeProfileMembershipStatus) -> Self {
|
|
match value {
|
|
RuntimeProfileMembershipStatus::Normal => Self::Normal,
|
|
RuntimeProfileMembershipStatus::Active => Self::Active,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileMembershipModelAccess>
|
|
for shared_contracts::runtime::ProfileMembershipModelAccessToken
|
|
{
|
|
fn from(value: RuntimeProfileMembershipModelAccess) -> Self {
|
|
match value {
|
|
RuntimeProfileMembershipModelAccess::Basic => Self::Basic,
|
|
RuntimeProfileMembershipModelAccess::Full => Self::Full,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<shared_contracts::runtime::ProfileMembershipModelAccessToken>
|
|
for RuntimeProfileMembershipModelAccess
|
|
{
|
|
fn from(value: shared_contracts::runtime::ProfileMembershipModelAccessToken) -> Self {
|
|
match value {
|
|
shared_contracts::runtime::ProfileMembershipModelAccessToken::Basic => Self::Basic,
|
|
shared_contracts::runtime::ProfileMembershipModelAccessToken::Full => Self::Full,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileMembershipChangeKind>
|
|
for shared_contracts::runtime::ProfileMembershipChangeKindToken
|
|
{
|
|
fn from(value: RuntimeProfileMembershipChangeKind) -> Self {
|
|
match value {
|
|
RuntimeProfileMembershipChangeKind::Purchase => Self::Purchase,
|
|
RuntimeProfileMembershipChangeKind::Upgrade => Self::Upgrade,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<shared_contracts::runtime::ProfileMembershipChangeKindToken>
|
|
for RuntimeProfileMembershipChangeKind
|
|
{
|
|
fn from(value: shared_contracts::runtime::ProfileMembershipChangeKindToken) -> Self {
|
|
match value {
|
|
shared_contracts::runtime::ProfileMembershipChangeKindToken::Purchase => Self::Purchase,
|
|
shared_contracts::runtime::ProfileMembershipChangeKindToken::Upgrade => Self::Upgrade,
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 会员业务拒绝的机器可读错误码。
|
|
///
|
|
/// 会员链路的人读 `error_message` 会随文案调整,调用方不得再按中文字符串判断 HTTP 状态;
|
|
/// 每个拒绝点显式产出本枚举,随 procedure 结果透传到 Axum 侧。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum RuntimeProfileMembershipErrorCode {
|
|
/// 补差升级报价 / 下单被升级规则拒绝。
|
|
UpgradeRejected,
|
|
/// 当前不是会员,应直接购买套餐。
|
|
NotMember,
|
|
/// 当前套餐已生效,无需重复购买。
|
|
AlreadyActive,
|
|
/// 有效期内不支持月付 / 年付转换。
|
|
CycleKindLocked,
|
|
/// 会员已到期,需按新购价格重新下单。
|
|
MembershipExpired,
|
|
/// 下单后会员状态已变化,需要重新下单。
|
|
StateChanged,
|
|
/// 目标档位当前不可购买。
|
|
PlanNotPurchasable,
|
|
/// 代码内档位目录缺少该档位。
|
|
PlanCatalogMissing,
|
|
/// 会员商品 product_id 无法解析。
|
|
ProductIdUnparseable,
|
|
/// 会员商品已迁移到档位目录,旧商品不再可用。
|
|
MembershipProductRetired,
|
|
/// 后台会员档位改价 / 改权益配置校验失败,或读取目录时发现价格 / 每期泥点倒挂。
|
|
InvalidPlanConfig,
|
|
}
|
|
|
|
impl RuntimeProfileMembershipErrorCode {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::UpgradeRejected => "upgrade_rejected",
|
|
Self::NotMember => "not_member",
|
|
Self::AlreadyActive => "already_active",
|
|
Self::CycleKindLocked => "cycle_kind_locked",
|
|
Self::MembershipExpired => "membership_expired",
|
|
Self::StateChanged => "state_changed",
|
|
Self::PlanNotPurchasable => "plan_not_purchasable",
|
|
Self::PlanCatalogMissing => "plan_catalog_missing",
|
|
Self::ProductIdUnparseable => "product_id_unparseable",
|
|
Self::MembershipProductRetired => "membership_product_retired",
|
|
Self::InvalidPlanConfig => "invalid_plan_config",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 兑换码核销业务拒绝的机器可读错误码。
|
|
///
|
|
/// 与 [`RuntimeProfileMembershipErrorCode`] 同样的目的:核销失败的人读 `error_message`
|
|
/// 会随文案调整,调用方不得按中文字符串判断 HTTP 状态,每个拒绝点显式产出本枚举并随
|
|
/// procedure 结果透传到 Axum 侧。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum RuntimeProfileRewardCodeRedeemErrorCode {
|
|
/// 兑换码在目录里不存在。
|
|
NotFound,
|
|
/// 兑换码已被后台停用。
|
|
Disabled,
|
|
/// 兑换码尚未生效。
|
|
NotStarted,
|
|
/// 兑换码已过期。
|
|
Expired,
|
|
/// 兑换次数已用完。
|
|
UsesExhausted,
|
|
/// 私有兑换码不适用于当前账号。
|
|
NotAllowedForUser,
|
|
/// 兑换码奖励配置无效。
|
|
InvalidReward,
|
|
}
|
|
|
|
impl RuntimeProfileRewardCodeRedeemErrorCode {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::NotFound => "not_found",
|
|
Self::Disabled => "disabled",
|
|
Self::NotStarted => "not_started",
|
|
Self::Expired => "expired",
|
|
Self::UsesExhausted => "uses_exhausted",
|
|
Self::NotAllowedForUser => "not_allowed_for_user",
|
|
Self::InvalidReward => "invalid_reward",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 后台兑换码管理的机器可读拒绝码。
|
|
///
|
|
/// 与 [`RuntimeProfileRewardCodeRedeemErrorCode`] 同样的目的:后台兑换码的增改 / 停用拒绝
|
|
/// 不能靠中文文案分类 HTTP 状态,每个拒绝点显式产出本枚举并随 procedure 结果透传。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum RuntimeProfileRedeemCodeAdminErrorCode {
|
|
/// 兑换码在目录里不存在。
|
|
NotFound,
|
|
/// 兑换码管理入参不合法(缺码、奖励为 0、次数为 0、有效期倒挂等)。
|
|
InvalidField,
|
|
/// 私有兑换码没有可用于兑换的用户。
|
|
AllowedUsersRequired,
|
|
}
|
|
|
|
impl RuntimeProfileRedeemCodeAdminErrorCode {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::NotFound => "not_found",
|
|
Self::InvalidField => "invalid_field",
|
|
Self::AllowedUsersRequired => "allowed_users_required",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 后台邀请码管理的机器可读拒绝码。
|
|
///
|
|
/// 与后台兑换码管理同一约定:邀请码增改的拒绝点显式产出本枚举并随 procedure 结果透传,
|
|
/// `api-server` 据此返回 400 而不是把业务拒绝当成 502。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum RuntimeProfileInviteCodeAdminErrorCode {
|
|
/// 邀请码管理入参不合法(缺码、元数据不是对象、有效期倒挂等)。
|
|
InvalidField,
|
|
/// 邀请码已被其他用户占用,不能改绑给当前用户。
|
|
InUse,
|
|
}
|
|
|
|
impl RuntimeProfileInviteCodeAdminErrorCode {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::InvalidField => "invalid_field",
|
|
Self::InUse => "in_use",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// profile procedure 业务拒绝的统一错误码:把会员、兑换码核销、后台兑换码管理与后台邀请码管理
|
|
/// 的 typed code 收在一处。
|
|
///
|
|
/// 只在 `spacetime-client` 进程内传递,不落表、不过 wire,因此不派生 `SpacetimeType`。
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub enum RuntimeProfileProcedureRejectionCode {
|
|
Membership(RuntimeProfileMembershipErrorCode),
|
|
RewardCodeRedeem(RuntimeProfileRewardCodeRedeemErrorCode),
|
|
RedeemCodeAdmin(RuntimeProfileRedeemCodeAdminErrorCode),
|
|
InviteCodeAdmin(RuntimeProfileInviteCodeAdminErrorCode),
|
|
}
|
|
|
|
impl RuntimeProfileProcedureRejectionCode {
|
|
pub fn as_str(self) -> &'static str {
|
|
match self {
|
|
Self::Membership(code) => code.as_str(),
|
|
Self::RewardCodeRedeem(code) => code.as_str(),
|
|
Self::RedeemCodeAdmin(code) => code.as_str(),
|
|
Self::InviteCodeAdmin(code) => code.as_str(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileMembershipErrorCode> for RuntimeProfileProcedureRejectionCode {
|
|
fn from(code: RuntimeProfileMembershipErrorCode) -> Self {
|
|
Self::Membership(code)
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileRewardCodeRedeemErrorCode> for RuntimeProfileProcedureRejectionCode {
|
|
fn from(code: RuntimeProfileRewardCodeRedeemErrorCode) -> Self {
|
|
Self::RewardCodeRedeem(code)
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileRedeemCodeAdminErrorCode> for RuntimeProfileProcedureRejectionCode {
|
|
fn from(code: RuntimeProfileRedeemCodeAdminErrorCode) -> Self {
|
|
Self::RedeemCodeAdmin(code)
|
|
}
|
|
}
|
|
|
|
impl From<RuntimeProfileInviteCodeAdminErrorCode> for RuntimeProfileProcedureRejectionCode {
|
|
fn from(code: RuntimeProfileInviteCodeAdminErrorCode) -> Self {
|
|
Self::InviteCodeAdmin(code)
|
|
}
|
|
}
|
|
|
|
/// 会员领域错误:机器可读 `code` + 人读 `message`。
|
|
///
|
|
/// 只在模块内部与 procedure 结果装载之间传递,不落 SpacetimeDB 表,因此不派生 `SpacetimeType`。
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct RuntimeProfileMembershipDomainError {
|
|
pub code: RuntimeProfileMembershipErrorCode,
|
|
pub message: String,
|
|
}
|
|
|
|
impl RuntimeProfileMembershipDomainError {
|
|
pub fn new(code: RuntimeProfileMembershipErrorCode, message: impl Into<String>) -> Self {
|
|
Self {
|
|
code,
|
|
message: message.into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for RuntimeProfileMembershipDomainError {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
f.write_str(&self.message)
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for RuntimeProfileMembershipDomainError {}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileRechargeOrderStatus {
|
|
Pending,
|
|
Paid,
|
|
Failed,
|
|
Closed,
|
|
Refunded,
|
|
Expired,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileRechargeRefundStatus {
|
|
Processing,
|
|
Success,
|
|
Abnormal,
|
|
Closed,
|
|
}
|
|
|
|
impl RuntimeProfileRechargeRefundStatus {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Processing => "processing",
|
|
Self::Success => "success",
|
|
Self::Abnormal => "abnormal",
|
|
Self::Closed => "closed",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileRechargeRefundObservationSource {
|
|
ApiRequest,
|
|
Callback,
|
|
Query,
|
|
TradeBill,
|
|
}
|
|
|
|
impl RuntimeProfileRechargeRefundObservationSource {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::ApiRequest => "api_request",
|
|
Self::Callback => "callback",
|
|
Self::Query => "query",
|
|
Self::TradeBill => "trade_bill",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileRechargeRefundRecoveryStatus {
|
|
Pending,
|
|
Applied,
|
|
Shortfall,
|
|
ManualReview,
|
|
NotApplicable,
|
|
}
|
|
|
|
impl RuntimeProfileRechargeRefundRecoveryStatus {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Pending => "pending",
|
|
Self::Applied => "applied",
|
|
Self::Shortfall => "shortfall",
|
|
Self::ManualReview => "manual_review",
|
|
Self::NotApplicable => "not_applicable",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum RuntimeProfileRechargeRefundHoldStatus {
|
|
Active,
|
|
Settled,
|
|
Released,
|
|
}
|
|
|
|
impl RuntimeProfileRechargeRefundHoldStatus {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Active => "active",
|
|
Self::Settled => "settled",
|
|
Self::Released => "released",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub enum RuntimeProfileRechargeRefundStatusTransition {
|
|
Unchanged,
|
|
Advance,
|
|
Conflict,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub struct RuntimeProfileRechargeRefundSettlementPlan {
|
|
pub successful_refund_count: u32,
|
|
pub cumulative_success_refund_cents: u64,
|
|
pub order_fully_refunded: bool,
|
|
pub target_recovery_points: u64,
|
|
pub incremental_target_recovery_points: u64,
|
|
}
|
|
|
|
impl RuntimeProfileRechargeOrderStatus {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Self::Pending => "pending",
|
|
Self::Paid => "paid",
|
|
Self::Failed => "failed",
|
|
Self::Closed => "closed",
|
|
Self::Refunded => "refunded",
|
|
Self::Expired => "expired",
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeProductSnapshot {
|
|
pub product_id: String,
|
|
pub title: String,
|
|
pub price_cents: u64,
|
|
pub kind: RuntimeProfileRechargeProductKind,
|
|
pub points_amount: u64,
|
|
pub bonus_points: u64,
|
|
pub duration_days: u32,
|
|
pub badge_label: String,
|
|
pub description: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeProductConfigSnapshot {
|
|
pub product_id: String,
|
|
pub title: String,
|
|
pub price_cents: u64,
|
|
pub kind: RuntimeProfileRechargeProductKind,
|
|
pub points_amount: u64,
|
|
pub bonus_points: u64,
|
|
pub duration_days: u32,
|
|
pub badge_label: String,
|
|
pub description: String,
|
|
pub enabled: bool,
|
|
pub sort_order: i32,
|
|
pub created_by: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_by: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipSnapshot {
|
|
pub user_id: String,
|
|
pub status: RuntimeProfileMembershipStatus,
|
|
pub plan: RuntimeProfileMembershipPlan,
|
|
pub started_at_micros: Option<i64>,
|
|
pub expires_at_micros: Option<i64>,
|
|
pub updated_at_micros: Option<i64>,
|
|
pub cycle_started_at_micros: Option<i64>,
|
|
pub cycle_resets_at_micros: Option<i64>,
|
|
pub cycle_granted_points: u64,
|
|
pub cycle_remaining_points: u64,
|
|
pub cycle_index: u32,
|
|
pub cycle_count: u32,
|
|
pub cycle_kind: RuntimeProfileMembershipCycleKind,
|
|
}
|
|
|
|
/// 只读会员快照的入参;后台详情等只读入口使用。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
/// 只读会员快照 procedure 的结果:成功时 `record` 为会员投影,失败时给出 `error_message`。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipSnapshotProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileMembershipSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
/// 账号当前有效的 AGC 模型权限档。
|
|
///
|
|
/// 与写库刷新的充值中心快照不同,它只读会员账期投影与档位目录,不触发换期 / 免费点刷新,供 LLM 代理热路径使用。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileAgcModelAccessSnapshot {
|
|
pub user_id: String,
|
|
pub plan: RuntimeProfileMembershipPlan,
|
|
pub model_access: RuntimeProfileMembershipModelAccess,
|
|
}
|
|
|
|
/// 只读 AGC 模型权限 procedure 的结果:成功时 `record` 为解析后的权限档,失败时给出 `error_message`。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileAgcModelAccessProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileAgcModelAccessSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderSnapshot {
|
|
pub order_id: String,
|
|
pub user_id: String,
|
|
pub product_id: String,
|
|
pub product_title: String,
|
|
pub kind: RuntimeProfileRechargeProductKind,
|
|
pub amount_cents: u64,
|
|
pub status: RuntimeProfileRechargeOrderStatus,
|
|
pub payment_channel: String,
|
|
pub paid_at_micros: Option<i64>,
|
|
pub provider_transaction_id: Option<String>,
|
|
pub created_at_micros: i64,
|
|
pub points_delta: i64,
|
|
pub membership_expires_at_micros: Option<i64>,
|
|
pub expired_at_micros: Option<i64>,
|
|
pub expiration_checked_at_micros: Option<i64>,
|
|
pub expiration_provider_state: Option<String>,
|
|
pub expiration_last_error: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundSnapshot {
|
|
pub out_refund_no: String,
|
|
pub provider_refund_id: String,
|
|
pub order_id: String,
|
|
pub provider_transaction_id: String,
|
|
pub user_id: Option<String>,
|
|
pub provider_status: RuntimeProfileRechargeRefundStatus,
|
|
pub total_cents: u64,
|
|
pub refund_cents: u64,
|
|
pub payer_total_cents: u64,
|
|
pub payer_refund_cents: u64,
|
|
pub success_at_micros: Option<i64>,
|
|
pub first_observed_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
pub last_observation_source: RuntimeProfileRechargeRefundObservationSource,
|
|
pub last_observation_id: String,
|
|
pub order_settled_at_micros: Option<i64>,
|
|
pub target_recovery_points: u64,
|
|
pub recovered_points: u64,
|
|
pub unrecovered_points: u64,
|
|
pub recovery_status: RuntimeProfileRechargeRefundRecoveryStatus,
|
|
pub last_recovery_ledger_id: Option<String>,
|
|
pub last_error_code: Option<String>,
|
|
pub manual_review_resolved_by_admin_user_id: Option<String>,
|
|
pub manual_review_resolution_reason: Option<String>,
|
|
pub manual_review_resolved_at_micros: Option<i64>,
|
|
pub manual_review_resolved_error_code: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundObservationSnapshot {
|
|
pub observation_id: String,
|
|
pub out_refund_no: String,
|
|
pub provider_refund_id: String,
|
|
pub order_id: String,
|
|
pub provider_transaction_id: String,
|
|
pub source: RuntimeProfileRechargeRefundObservationSource,
|
|
pub provider_status: RuntimeProfileRechargeRefundStatus,
|
|
pub total_cents: u64,
|
|
pub refund_cents: u64,
|
|
pub payer_total_cents: u64,
|
|
pub payer_refund_cents: u64,
|
|
pub success_at_micros: Option<i64>,
|
|
pub notification_ref: Option<String>,
|
|
pub payload_fingerprint: String,
|
|
pub resolution_code: String,
|
|
pub observed_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderRefundSettlementSnapshot {
|
|
pub order_id: String,
|
|
pub user_id: String,
|
|
pub successful_refund_count: u32,
|
|
pub cumulative_success_refund_cents: u64,
|
|
pub target_recovery_points: u64,
|
|
pub recovered_points: u64,
|
|
pub unrecovered_points: u64,
|
|
pub recovery_status: RuntimeProfileRechargeRefundRecoveryStatus,
|
|
pub wallet_frozen: bool,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundHoldSnapshot {
|
|
pub out_refund_no: String,
|
|
pub order_id: String,
|
|
pub user_id: String,
|
|
pub refund_cents: u64,
|
|
pub held_points: u64,
|
|
pub status: RuntimeProfileRechargeRefundHoldStatus,
|
|
pub admin_user_id: String,
|
|
pub reason: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
pub settled_at_micros: Option<i64>,
|
|
pub released_at_micros: Option<i64>,
|
|
pub released_by_admin_user_id: Option<String>,
|
|
pub release_reason: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletManualRestrictionSnapshot {
|
|
pub user_id: String,
|
|
pub frozen: bool,
|
|
pub reason: String,
|
|
pub created_by_admin_user_id: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_by_admin_user_id: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileAdminWalletSnapshot {
|
|
pub user_id: String,
|
|
pub total_balance: u64,
|
|
pub spendable_balance: u64,
|
|
pub daily_free_points: u64,
|
|
pub membership_limited_points: u64,
|
|
pub permanent_points: u64,
|
|
pub held_points: u64,
|
|
pub refund_debt_points: u64,
|
|
pub manual_frozen: bool,
|
|
pub refund_debt_frozen: bool,
|
|
pub wallet_frozen: bool,
|
|
pub manual_restriction: Option<RuntimeProfileWalletManualRestrictionSnapshot>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileAdminWalletDetailRecord {
|
|
pub wallet: RuntimeProfileAdminWalletSnapshot,
|
|
pub historical_consumed_points: u64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileWalletConsumptionReconcileRecord {
|
|
pub user_id: String,
|
|
pub previous_historical_consumed_points: Option<u64>,
|
|
pub historical_consumed_points: u64,
|
|
pub changed: bool,
|
|
pub reconciled_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileWalletConsumptionProjectionInitializeRecord {
|
|
pub scanned_ledger_count: u64,
|
|
pub projected_user_count: u64,
|
|
pub inserted_projection_count: u64,
|
|
pub updated_projection_count: u64,
|
|
pub initialized_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderAdminEntrySnapshot {
|
|
pub order: RuntimeProfileRechargeOrderSnapshot,
|
|
pub settlement: Option<RuntimeProfileRechargeOrderRefundSettlementSnapshot>,
|
|
pub refunds: Vec<RuntimeProfileRechargeRefundSnapshot>,
|
|
pub active_hold: Option<RuntimeProfileRechargeRefundHoldSnapshot>,
|
|
pub wallet: RuntimeProfileAdminWalletSnapshot,
|
|
/// 会员购买 / 升级的权益变更快照;人工复核退款时据此还原变更前后的档位、周期、补点与有效期。
|
|
pub membership_change: Option<RuntimeProfileMembershipOrderChangeSnapshot>,
|
|
}
|
|
|
|
/// 会员订单的权益变更快照(只读投影,字段与 `profile_recharge_order` 的末位快照列一一对应)。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipOrderChangeSnapshot {
|
|
/// `purchase` 或 `upgrade`。
|
|
pub change_kind: RuntimeProfileMembershipChangeKind,
|
|
pub plan_before: Option<RuntimeProfileMembershipPlan>,
|
|
pub plan_after: Option<RuntimeProfileMembershipPlan>,
|
|
pub cycle_kind_before: Option<RuntimeProfileMembershipCycleKind>,
|
|
pub cycle_kind_after: Option<RuntimeProfileMembershipCycleKind>,
|
|
pub period_points_before: Option<u64>,
|
|
pub period_points_after: Option<u64>,
|
|
pub granted_points_delta: u64,
|
|
pub cycle_index: Option<u32>,
|
|
pub expires_at_before_micros: Option<i64>,
|
|
pub expires_at_after_micros: Option<i64>,
|
|
pub cycle_resets_at_before_micros: Option<i64>,
|
|
pub cycle_resets_at_after_micros: Option<i64>,
|
|
/// 订单价格拆分 JSON(目标档位价、当前档位价、实付金额),仅用于人工核对。
|
|
pub price_breakdown_json: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundBillCheckpointSnapshot {
|
|
pub checkpoint_id: String,
|
|
pub bill_date: String,
|
|
pub bill_hash: String,
|
|
pub processed_refund_count: u32,
|
|
pub completed_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeCenterSnapshot {
|
|
pub user_id: String,
|
|
pub wallet_balance: u64,
|
|
pub membership: RuntimeProfileMembershipSnapshot,
|
|
pub point_products: Vec<RuntimeProfileRechargeProductSnapshot>,
|
|
pub membership_plans: Vec<RuntimeProfileMembershipPlanRecord>,
|
|
pub latest_order: Option<RuntimeProfileRechargeOrderSnapshot>,
|
|
pub has_points_recharged: bool,
|
|
pub daily_free_points: RuntimeProfileDailyFreePointsSnapshot,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipPurchaseUpdate {
|
|
pub started_at_micros: i64,
|
|
pub expires_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeCenterProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileRechargeCenterSnapshot>,
|
|
pub order: Option<RuntimeProfileRechargeOrderSnapshot>,
|
|
pub error_message: Option<String>,
|
|
pub error_code: Option<RuntimeProfileMembershipErrorCode>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeProductAdminListInput {
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeProductAdminUpsertInput {
|
|
pub admin_user_id: String,
|
|
pub product_id: String,
|
|
pub title: String,
|
|
pub price_cents: u64,
|
|
pub kind: RuntimeProfileRechargeProductKind,
|
|
pub points_amount: u64,
|
|
pub badge_label: String,
|
|
pub description: String,
|
|
pub enabled: bool,
|
|
pub sort_order: i32,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeProductAdminListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileRechargeProductConfigSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeProductAdminProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileRechargeProductConfigSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipPlanAdminListInput {
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
/// 后台会员档位改价 / 改权益入参。
|
|
///
|
|
/// `rank` 不在入参里:升级比较基准由代码内的档位目录决定,后台不能改。
|
|
/// `title` 仍可编辑,`normal` 档位的价格与额度会被忽略(它不可购买)。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipPlanAdminUpsertInput {
|
|
pub admin_user_id: String,
|
|
pub plan: RuntimeProfileMembershipPlan,
|
|
pub title: String,
|
|
pub month_price_cents: u64,
|
|
pub year_price_cents: u64,
|
|
pub period_points: u64,
|
|
pub model_access: RuntimeProfileMembershipModelAccess,
|
|
pub concurrent_job_limit: u32,
|
|
pub enabled: bool,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipPlanAdminListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileMembershipPlanRecord>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipPlanAdminProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileMembershipPlanRecord>,
|
|
pub error_message: Option<String>,
|
|
pub error_code: Option<RuntimeProfileMembershipErrorCode>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipUpgradeQuoteGetInput {
|
|
pub user_id: String,
|
|
pub target_plan: RuntimeProfileMembershipPlan,
|
|
}
|
|
|
|
/// 补差升级报价快照(模块侧,时间戳为 micros)。报价与下单重算共用同一套规则。
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipUpgradeQuoteSnapshot {
|
|
pub current_plan: RuntimeProfileMembershipPlan,
|
|
pub target_plan: RuntimeProfileMembershipPlan,
|
|
pub cycle_kind: RuntimeProfileMembershipCycleKind,
|
|
pub cycle_index: u32,
|
|
pub cycle_count: u32,
|
|
pub amount_cents: u64,
|
|
pub granted_points_delta: u64,
|
|
pub monthly_balance_after: u64,
|
|
pub expires_at_micros: i64,
|
|
pub cycle_resets_at_micros: i64,
|
|
pub remaining_full_months: u32,
|
|
}
|
|
|
|
/// 补差升级报价的只读投影(记录侧,附 RFC3339 时间)。
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipUpgradeQuoteRecord {
|
|
pub current_plan: RuntimeProfileMembershipPlan,
|
|
pub target_plan: RuntimeProfileMembershipPlan,
|
|
pub cycle_kind: RuntimeProfileMembershipCycleKind,
|
|
pub cycle_index: u32,
|
|
pub cycle_count: u32,
|
|
pub amount_cents: u64,
|
|
pub granted_points_delta: u64,
|
|
pub monthly_balance_after: u64,
|
|
pub expires_at: String,
|
|
pub expires_at_micros: i64,
|
|
pub cycle_resets_at: String,
|
|
pub cycle_resets_at_micros: i64,
|
|
pub remaining_full_months: u32,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileMembershipUpgradeQuoteProcedureResult {
|
|
pub ok: bool,
|
|
pub quote: Option<RuntimeProfileMembershipUpgradeQuoteSnapshot>,
|
|
pub error_message: Option<String>,
|
|
pub error_code: Option<RuntimeProfileMembershipErrorCode>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeCenterGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderGetInput {
|
|
pub order_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderCreateInput {
|
|
pub user_id: String,
|
|
pub product_id: String,
|
|
pub payment_channel: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderPaidInput {
|
|
pub order_id: String,
|
|
pub paid_at_micros: i64,
|
|
pub provider_transaction_id: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundObservationInput {
|
|
pub observation_id: String,
|
|
pub source: RuntimeProfileRechargeRefundObservationSource,
|
|
pub notification_ref: Option<String>,
|
|
pub payload_fingerprint: String,
|
|
pub out_refund_no: String,
|
|
pub provider_refund_id: String,
|
|
pub order_id: String,
|
|
pub provider_transaction_id: String,
|
|
pub provider_status: RuntimeProfileRechargeRefundStatus,
|
|
pub total_cents: u64,
|
|
pub refund_cents: u64,
|
|
pub payer_total_cents: u64,
|
|
pub payer_refund_cents: u64,
|
|
pub success_at_micros: Option<i64>,
|
|
pub observed_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundGetInput {
|
|
pub out_refund_no: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundReconciliationListInput {
|
|
pub limit: u32,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderAdminListInput {
|
|
pub order_id: Option<String>,
|
|
pub user_id: Option<String>,
|
|
pub provider_transaction_id: Option<String>,
|
|
pub payment_channel: Option<String>,
|
|
pub status: Option<RuntimeProfileRechargeOrderStatus>,
|
|
pub created_after_micros: Option<i64>,
|
|
pub created_before_micros: Option<i64>,
|
|
pub limit: u32,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundHoldPreviewInput {
|
|
pub order_id: String,
|
|
pub refund_cents: u64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundHoldPrepareInput {
|
|
pub order_id: String,
|
|
pub out_refund_no: String,
|
|
pub refund_cents: u64,
|
|
pub admin_user_id: String,
|
|
pub reason: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundHoldReleaseInput {
|
|
pub out_refund_no: String,
|
|
pub admin_user_id: String,
|
|
pub release_reason: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundHoldListInput {
|
|
pub limit: u32,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundManualReviewResolveInput {
|
|
pub out_refund_no: String,
|
|
pub admin_user_id: String,
|
|
pub reason: String,
|
|
pub expected_error_code: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileAdminWalletGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConsumptionReconcileInput {
|
|
pub user_id: String,
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConsumptionProjectionInitializeInput {
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletManualRestrictionUpsertInput {
|
|
pub user_id: String,
|
|
pub frozen: bool,
|
|
pub reason: String,
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundBillCheckpointGetInput {
|
|
pub checkpoint_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundBillCheckpointAdvanceInput {
|
|
pub checkpoint_id: String,
|
|
pub bill_date: String,
|
|
pub bill_hash: String,
|
|
pub processed_refund_count: u32,
|
|
pub completed_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderCloseInput {
|
|
pub order_id: String,
|
|
pub closed_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationClaimInput {
|
|
pub worker_id: String,
|
|
pub now_micros: i64,
|
|
pub lease_expires_at_micros: i64,
|
|
pub limit: u32,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationCompleteInput {
|
|
pub order_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationCheckListInput {
|
|
pub limit: u32,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationCheckInput {
|
|
pub order_id: String,
|
|
pub checked_at_micros: Option<i64>,
|
|
pub provider_state: Option<String>,
|
|
pub last_error: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationScheduleSnapshot {
|
|
pub order_id: String,
|
|
pub user_id: String,
|
|
pub scheduled_at_micros: i64,
|
|
pub lease_owner: Option<String>,
|
|
pub lease_expires_at_micros: Option<i64>,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationClaimProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileRechargeOrderExpirationScheduleSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationCompleteProcedureResult {
|
|
pub ok: bool,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationCheckListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileRechargeOrderSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderExpirationCheckProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileRechargeOrderSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileRechargeRefundSnapshot>,
|
|
pub settlement: Option<RuntimeProfileRechargeOrderRefundSettlementSnapshot>,
|
|
pub duplicate: bool,
|
|
pub resolution_code: String,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileRechargeRefundSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeOrderAdminListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileRechargeOrderAdminEntrySnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundHoldProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileRechargeRefundHoldSnapshot>,
|
|
pub order: Option<RuntimeProfileRechargeOrderSnapshot>,
|
|
pub settlement: Option<RuntimeProfileRechargeOrderRefundSettlementSnapshot>,
|
|
pub wallet: Option<RuntimeProfileAdminWalletSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundHoldListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileRechargeRefundHoldSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileAdminWalletProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileAdminWalletSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileAdminWalletDetailProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileAdminWalletSnapshot>,
|
|
pub historical_consumed_points: u64,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConsumptionReconcileSnapshot {
|
|
pub user_id: String,
|
|
pub previous_historical_consumed_points: Option<u64>,
|
|
pub historical_consumed_points: u64,
|
|
pub changed: bool,
|
|
pub reconciled_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConsumptionReconcileProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileWalletConsumptionReconcileSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConsumptionProjectionInitializeSnapshot {
|
|
pub scanned_ledger_count: u64,
|
|
pub projected_user_count: u64,
|
|
pub inserted_projection_count: u64,
|
|
pub updated_projection_count: u64,
|
|
pub initialized_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletConsumptionProjectionInitializeProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileWalletConsumptionProjectionInitializeSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRechargeRefundBillCheckpointProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileRechargeRefundBillCheckpointSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletLedgerEntrySnapshot {
|
|
pub wallet_ledger_id: String,
|
|
pub user_id: String,
|
|
pub amount_delta: i64,
|
|
pub balance_after: u64,
|
|
pub source_type: RuntimeProfileWalletLedgerSourceType,
|
|
pub created_at_micros: i64,
|
|
pub metadata_json: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletLedgerProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileWalletLedgerEntrySnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletAdjustmentProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileDashboardSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletRefundOutboxEnqueueInput {
|
|
pub owner_user_id: String,
|
|
pub amount: u64,
|
|
pub refund_ledger_id: String,
|
|
pub created_at_micros: i64,
|
|
pub asset_kind: String,
|
|
pub asset_id: String,
|
|
pub settlement_reason: String,
|
|
pub external_generation_job_id: Option<String>,
|
|
pub external_generation_claim_attempt: Option<u32>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletRefundOutboxProcessInput {
|
|
pub worker_id: String,
|
|
pub limit: u32,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletRefundOutboxProcedureResult {
|
|
pub ok: bool,
|
|
pub enqueued_count: u32,
|
|
pub processed_count: u32,
|
|
pub retry_count: u32,
|
|
pub failed_count: u32,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletLedgerListInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileWalletAdjustmentInput {
|
|
pub user_id: String,
|
|
pub amount: u64,
|
|
pub ledger_id: String,
|
|
pub created_at_micros: i64,
|
|
pub metadata_json: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRewardCodeRedeemInput {
|
|
pub user_id: String,
|
|
pub code: String,
|
|
pub redeemed_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRewardCodeRedeemSnapshot {
|
|
pub wallet_balance: u64,
|
|
pub amount_granted: u64,
|
|
pub ledger_entry: RuntimeProfileWalletLedgerEntrySnapshot,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRewardCodeRedeemProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileRewardCodeRedeemSnapshot>,
|
|
pub error_message: Option<String>,
|
|
/// 核销业务拒绝的机器可读错误码;非业务错误(入参、钱包等)为 `None`。
|
|
pub error_code: Option<RuntimeProfileRewardCodeRedeemErrorCode>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRedeemCodeAdminUpsertInput {
|
|
pub admin_user_id: String,
|
|
pub code: String,
|
|
pub mode: RuntimeProfileRedeemCodeMode,
|
|
pub reward_points: u64,
|
|
pub max_uses: u32,
|
|
pub enabled: bool,
|
|
pub allowed_user_ids: Vec<String>,
|
|
pub allowed_public_user_codes: Vec<String>,
|
|
pub starts_at_micros: Option<i64>,
|
|
pub expires_at_micros: Option<i64>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRedeemCodeAdminDisableInput {
|
|
pub admin_user_id: String,
|
|
pub code: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRedeemCodeAdminListInput {
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRedeemCodeSnapshot {
|
|
pub code: String,
|
|
pub mode: RuntimeProfileRedeemCodeMode,
|
|
pub reward_points: u64,
|
|
pub max_uses: u32,
|
|
pub global_used_count: u32,
|
|
pub enabled: bool,
|
|
pub allowed_user_ids: Vec<String>,
|
|
pub created_by: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
pub starts_at_micros: Option<i64>,
|
|
pub expires_at_micros: Option<i64>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileCodeOperationSnapshot {
|
|
pub operation_id: String,
|
|
pub code_kind: String,
|
|
pub code: String,
|
|
pub action: String,
|
|
pub operator_user_id: String,
|
|
pub created_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRedeemCodeAdminProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileRedeemCodeSnapshot>,
|
|
pub error_message: Option<String>,
|
|
/// 后台管理业务拒绝的机器可读错误码;非业务错误(入参、系统等)为 `None`。
|
|
pub error_code: Option<RuntimeProfileRedeemCodeAdminErrorCode>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileRedeemCodeAdminListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileRedeemCodeSnapshot>,
|
|
pub operations: Vec<RuntimeProfileCodeOperationSnapshot>,
|
|
pub error_message: Option<String>,
|
|
/// 后台管理业务拒绝的机器可读错误码;非业务错误(入参、系统等)为 `None`。
|
|
pub error_code: Option<RuntimeProfileRedeemCodeAdminErrorCode>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileInviteCodeAdminUpsertInput {
|
|
pub admin_user_id: String,
|
|
pub invite_code: String,
|
|
pub metadata_json: String,
|
|
pub starts_at_micros: Option<i64>,
|
|
pub expires_at_micros: Option<i64>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileInviteCodeAdminListInput {
|
|
pub admin_user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileInviteCodeSnapshot {
|
|
pub user_id: String,
|
|
pub invite_code: String,
|
|
pub metadata_json: String,
|
|
pub starts_at_micros: Option<i64>,
|
|
pub expires_at_micros: Option<i64>,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileInviteCodeAdminProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfileInviteCodeSnapshot>,
|
|
pub error_message: Option<String>,
|
|
/// 业务拒绝的机器可读码;入参 / 系统错误为 `None`,由 `api-server` 落 502。
|
|
pub error_code: Option<RuntimeProfileInviteCodeAdminErrorCode>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfileInviteCodeAdminListProcedureResult {
|
|
pub ok: bool,
|
|
pub entries: Vec<RuntimeProfileInviteCodeSnapshot>,
|
|
pub operations: Vec<RuntimeProfileCodeOperationSnapshot>,
|
|
pub error_message: Option<String>,
|
|
/// 业务拒绝的机器可读码;入参 / 系统错误为 `None`,由 `api-server` 落 502。
|
|
pub error_code: Option<RuntimeProfileInviteCodeAdminErrorCode>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeReferralInvitedUserSnapshot {
|
|
pub user_id: String,
|
|
pub display_name: String,
|
|
pub avatar_url: Option<String>,
|
|
pub bound_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeReferralInviteCenterSnapshot {
|
|
pub user_id: String,
|
|
pub invite_code: String,
|
|
pub invite_link_path: String,
|
|
pub invited_count: u32,
|
|
pub rewarded_invite_count: u32,
|
|
pub today_inviter_reward_count: u32,
|
|
pub today_inviter_reward_remaining: u32,
|
|
pub reward_points: u64,
|
|
pub invited_users: Vec<RuntimeReferralInvitedUserSnapshot>,
|
|
pub has_redeemed_code: bool,
|
|
pub bound_inviter_user_id: Option<String>,
|
|
pub bound_at_micros: Option<i64>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeReferralInviteCenterProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeReferralInviteCenterSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeReferralInviteCenterGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeReferralRedeemInput {
|
|
pub user_id: String,
|
|
pub invite_code: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeReferralRedeemSnapshot {
|
|
pub center: RuntimeReferralInviteCenterSnapshot,
|
|
pub invitee_reward_granted: bool,
|
|
pub inviter_reward_granted: bool,
|
|
pub invitee_balance_after: u64,
|
|
pub inviter_balance_after: u64,
|
|
}
|
|
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeReferralRedeemProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeReferralRedeemSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfilePlayedWorldSnapshot {
|
|
pub played_world_id: String,
|
|
pub user_id: String,
|
|
pub world_key: String,
|
|
pub owner_user_id: Option<String>,
|
|
pub profile_id: Option<String>,
|
|
pub world_type: Option<String>,
|
|
pub world_title: String,
|
|
pub world_subtitle: String,
|
|
pub first_played_at_micros: i64,
|
|
pub last_played_at_micros: i64,
|
|
pub last_observed_play_time_ms: u64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfilePlayStatsSnapshot {
|
|
pub user_id: String,
|
|
pub total_play_time_ms: u64,
|
|
pub played_works: Vec<RuntimeProfilePlayedWorldSnapshot>,
|
|
pub updated_at_micros: Option<i64>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfilePlayStatsProcedureResult {
|
|
pub ok: bool,
|
|
pub record: Option<RuntimeProfilePlayStatsSnapshot>,
|
|
pub error_message: Option<String>,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct RuntimeProfilePlayStatsGetInput {
|
|
pub user_id: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeBrowseHistoryPreparedEntry {
|
|
pub browse_history_id: String,
|
|
pub user_id: String,
|
|
pub owner_user_id: String,
|
|
pub profile_id: String,
|
|
pub world_name: String,
|
|
pub subtitle: String,
|
|
pub summary_text: String,
|
|
pub cover_image_src: Option<String>,
|
|
pub theme_mode: RuntimeBrowseHistoryThemeMode,
|
|
pub author_display_name: String,
|
|
pub visited_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeBrowseHistoryRecord {
|
|
pub browse_history_id: String,
|
|
pub user_id: String,
|
|
pub owner_user_id: String,
|
|
pub profile_id: String,
|
|
pub world_name: String,
|
|
pub subtitle: String,
|
|
pub summary_text: String,
|
|
pub cover_image_src: Option<String>,
|
|
pub theme_mode: RuntimeBrowseHistoryThemeMode,
|
|
pub author_display_name: String,
|
|
pub visited_at: String,
|
|
pub visited_at_micros: i64,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeSettingsRecord {
|
|
pub user_id: String,
|
|
pub music_volume: f32,
|
|
pub platform_theme: RuntimePlatformTheme,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileDashboardRecord {
|
|
pub user_id: String,
|
|
pub wallet_balance: u64,
|
|
pub total_play_time_ms: u64,
|
|
pub played_world_count: u32,
|
|
pub updated_at: Option<String>,
|
|
pub updated_at_micros: Option<i64>,
|
|
pub daily_free_points: RuntimeProfileDailyFreePointsRecord,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileDailyFreePointsRecord {
|
|
pub day_key: i64,
|
|
pub granted_points: u64,
|
|
pub remaining_points: u64,
|
|
pub resets_at: String,
|
|
pub resets_at_micros: i64,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
pub reset_points: u64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileWalletLedgerEntryRecord {
|
|
pub wallet_ledger_id: String,
|
|
pub user_id: String,
|
|
pub amount_delta: i64,
|
|
pub balance_after: u64,
|
|
pub source_type: RuntimeProfileWalletLedgerSourceType,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
pub metadata_json: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfilePlayedWorldRecord {
|
|
pub played_world_id: String,
|
|
pub user_id: String,
|
|
pub world_key: String,
|
|
pub owner_user_id: Option<String>,
|
|
pub profile_id: Option<String>,
|
|
pub world_type: Option<String>,
|
|
pub world_title: String,
|
|
pub world_subtitle: String,
|
|
pub first_played_at: String,
|
|
pub first_played_at_micros: i64,
|
|
pub last_played_at: String,
|
|
pub last_played_at_micros: i64,
|
|
pub last_observed_play_time_ms: u64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfilePlayStatsRecord {
|
|
pub user_id: String,
|
|
pub total_play_time_ms: u64,
|
|
pub played_works: Vec<RuntimeProfilePlayedWorldRecord>,
|
|
pub updated_at: Option<String>,
|
|
pub updated_at_micros: Option<i64>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileRechargeProductRecord {
|
|
pub product_id: String,
|
|
pub title: String,
|
|
pub price_cents: u64,
|
|
pub kind: RuntimeProfileRechargeProductKind,
|
|
pub points_amount: u64,
|
|
pub bonus_points: u64,
|
|
pub duration_days: u32,
|
|
pub badge_label: String,
|
|
pub description: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileRechargeProductConfigRecord {
|
|
pub product_id: String,
|
|
pub title: String,
|
|
pub price_cents: u64,
|
|
pub kind: RuntimeProfileRechargeProductKind,
|
|
pub points_amount: u64,
|
|
pub bonus_points: u64,
|
|
pub duration_days: u32,
|
|
pub badge_label: String,
|
|
pub description: String,
|
|
pub enabled: bool,
|
|
pub sort_order: i32,
|
|
pub created_by: String,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_by: String,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileWalletConfigRecord {
|
|
pub config_id: String,
|
|
pub initial_mud_points: u64,
|
|
pub created_by: String,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_by: String,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
pub daily_free_points_per_day: u64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileMembershipRecord {
|
|
pub user_id: String,
|
|
pub status: RuntimeProfileMembershipStatus,
|
|
pub plan: RuntimeProfileMembershipPlan,
|
|
pub started_at: Option<String>,
|
|
pub started_at_micros: Option<i64>,
|
|
pub expires_at: Option<String>,
|
|
pub expires_at_micros: Option<i64>,
|
|
pub updated_at: Option<String>,
|
|
pub updated_at_micros: Option<i64>,
|
|
pub cycle_started_at: Option<String>,
|
|
pub cycle_started_at_micros: Option<i64>,
|
|
pub cycle_resets_at: Option<String>,
|
|
pub cycle_resets_at_micros: Option<i64>,
|
|
pub cycle_granted_points: u64,
|
|
pub cycle_remaining_points: u64,
|
|
pub cycle_index: u32,
|
|
pub cycle_count: u32,
|
|
pub cycle_kind: RuntimeProfileMembershipCycleKind,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileRechargeOrderRecord {
|
|
pub order_id: String,
|
|
pub user_id: String,
|
|
pub product_id: String,
|
|
pub product_title: String,
|
|
pub kind: RuntimeProfileRechargeProductKind,
|
|
pub amount_cents: u64,
|
|
pub status: RuntimeProfileRechargeOrderStatus,
|
|
pub payment_channel: String,
|
|
pub paid_at: Option<String>,
|
|
pub paid_at_micros: Option<i64>,
|
|
pub provider_transaction_id: Option<String>,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
pub points_delta: i64,
|
|
pub membership_expires_at: Option<String>,
|
|
pub membership_expires_at_micros: Option<i64>,
|
|
pub expired_at: Option<String>,
|
|
pub expired_at_micros: Option<i64>,
|
|
pub expiration_checked_at: Option<String>,
|
|
pub expiration_checked_at_micros: Option<i64>,
|
|
pub expiration_provider_state: Option<String>,
|
|
pub expiration_last_error: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileRechargeCenterRecord {
|
|
pub user_id: String,
|
|
pub wallet_balance: u64,
|
|
pub membership: RuntimeProfileMembershipRecord,
|
|
pub point_products: Vec<RuntimeProfileRechargeProductRecord>,
|
|
pub membership_plans: Vec<RuntimeProfileMembershipPlanRecord>,
|
|
pub latest_order: Option<RuntimeProfileRechargeOrderRecord>,
|
|
pub has_points_recharged: bool,
|
|
pub daily_free_points: RuntimeProfileDailyFreePointsRecord,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileRewardCodeRedeemRecord {
|
|
pub wallet_balance: u64,
|
|
pub amount_granted: u64,
|
|
pub ledger_entry: RuntimeProfileWalletLedgerEntryRecord,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileTaskConfigRecord {
|
|
pub task_id: String,
|
|
pub title: String,
|
|
pub description: String,
|
|
pub event_key: String,
|
|
pub cycle: RuntimeProfileTaskCycle,
|
|
pub scope_kind: RuntimeTrackingScopeKind,
|
|
pub threshold: u32,
|
|
pub reward_points: u64,
|
|
pub enabled: bool,
|
|
pub sort_order: i32,
|
|
pub created_by: String,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_by: String,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileTaskItemRecord {
|
|
pub task_id: String,
|
|
pub title: String,
|
|
pub description: String,
|
|
pub event_key: String,
|
|
pub cycle: RuntimeProfileTaskCycle,
|
|
pub threshold: u32,
|
|
pub progress_count: u32,
|
|
pub reward_points: u64,
|
|
pub status: RuntimeProfileTaskStatus,
|
|
pub day_key: i64,
|
|
pub claimed_at: Option<String>,
|
|
pub claimed_at_micros: Option<i64>,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileTaskCenterRecord {
|
|
pub user_id: String,
|
|
pub day_key: i64,
|
|
pub wallet_balance: u64,
|
|
pub tasks: Vec<RuntimeProfileTaskItemRecord>,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileTaskClaimRecord {
|
|
pub user_id: String,
|
|
pub task_id: String,
|
|
pub day_key: i64,
|
|
pub reward_points: u64,
|
|
pub wallet_balance: u64,
|
|
pub ledger_entry: RuntimeProfileWalletLedgerEntryRecord,
|
|
pub center: RuntimeProfileTaskCenterRecord,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileRedeemCodeRecord {
|
|
pub code: String,
|
|
pub mode: RuntimeProfileRedeemCodeMode,
|
|
pub reward_points: u64,
|
|
pub max_uses: u32,
|
|
pub global_used_count: u32,
|
|
pub enabled: bool,
|
|
pub allowed_user_ids: Vec<String>,
|
|
pub created_by: String,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
pub starts_at: Option<String>,
|
|
pub starts_at_micros: Option<i64>,
|
|
pub expires_at: Option<String>,
|
|
pub expires_at_micros: Option<i64>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileCodeOperationRecord {
|
|
pub operation_id: String,
|
|
pub code_kind: String,
|
|
pub code: String,
|
|
pub action: String,
|
|
pub operator_user_id: String,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileRedeemCodeAdminListRecord {
|
|
pub entries: Vec<RuntimeProfileRedeemCodeRecord>,
|
|
pub operations: Vec<RuntimeProfileCodeOperationRecord>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileInviteCodeAdminListRecord {
|
|
pub entries: Vec<RuntimeProfileInviteCodeRecord>,
|
|
pub operations: Vec<RuntimeProfileCodeOperationRecord>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileInviteCodeRecord {
|
|
pub user_id: String,
|
|
pub invite_code: String,
|
|
pub metadata_json: String,
|
|
pub starts_at: Option<String>,
|
|
pub starts_at_micros: Option<i64>,
|
|
pub expires_at: Option<String>,
|
|
pub expires_at_micros: Option<i64>,
|
|
pub status: RuntimeProfileInviteCodeStatus,
|
|
pub created_at: String,
|
|
pub created_at_micros: i64,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeReferralInvitedUserRecord {
|
|
pub user_id: String,
|
|
pub display_name: String,
|
|
pub avatar_url: Option<String>,
|
|
pub bound_at: String,
|
|
pub bound_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeReferralInviteCenterRecord {
|
|
pub user_id: String,
|
|
pub invite_code: String,
|
|
pub invite_link_path: String,
|
|
pub invited_count: u32,
|
|
pub rewarded_invite_count: u32,
|
|
pub today_inviter_reward_count: u32,
|
|
pub today_inviter_reward_remaining: u32,
|
|
pub reward_points: u64,
|
|
pub invited_users: Vec<RuntimeReferralInvitedUserRecord>,
|
|
pub has_redeemed_code: bool,
|
|
pub bound_inviter_user_id: Option<String>,
|
|
pub bound_at: Option<String>,
|
|
pub bound_at_micros: Option<i64>,
|
|
pub updated_at: String,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeReferralRedeemRecord {
|
|
pub center: RuntimeReferralInviteCenterRecord,
|
|
pub invitee_reward_granted: bool,
|
|
pub inviter_reward_granted: bool,
|
|
pub invitee_balance_after: u64,
|
|
pub inviter_balance_after: u64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeSnapshotRecord {
|
|
pub user_id: String,
|
|
pub version: u32,
|
|
pub saved_at: String,
|
|
pub saved_at_micros: i64,
|
|
pub bottom_tab: String,
|
|
pub game_state: Value,
|
|
pub current_story: Option<Value>,
|
|
pub game_state_json: String,
|
|
pub current_story_json: Option<String>,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileSaveArchiveRecord {
|
|
pub archive_id: String,
|
|
pub user_id: String,
|
|
pub world_key: String,
|
|
pub owner_user_id: Option<String>,
|
|
pub profile_id: Option<String>,
|
|
pub world_type: Option<String>,
|
|
pub world_name: String,
|
|
pub subtitle: String,
|
|
pub summary_text: String,
|
|
pub cover_image_src: Option<String>,
|
|
pub saved_at: String,
|
|
pub saved_at_micros: i64,
|
|
pub bottom_tab: String,
|
|
pub game_state: Value,
|
|
pub current_story: Option<Value>,
|
|
pub game_state_json: String,
|
|
pub current_story_json: Option<String>,
|
|
pub created_at_micros: i64,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileWorldSnapshotMeta {
|
|
pub world_key: String,
|
|
pub owner_user_id: Option<String>,
|
|
pub profile_id: Option<String>,
|
|
pub world_type: Option<String>,
|
|
pub world_title: String,
|
|
pub world_subtitle: String,
|
|
}
|
|
|
|
#[cfg(any())]
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct RuntimeProfileSaveArchiveMeta {
|
|
pub world_key: String,
|
|
pub owner_user_id: Option<String>,
|
|
pub profile_id: Option<String>,
|
|
pub world_type: Option<String>,
|
|
pub world_name: String,
|
|
pub subtitle: String,
|
|
pub summary_text: String,
|
|
pub cover_image_src: Option<String>,
|
|
}
|