diff --git a/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx b/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx index 2c3369106..c734e3ff7 100644 --- a/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx +++ b/packages/shared/src/components/PlatformProfileWalletLedgerModal/index.test.tsx @@ -103,6 +103,9 @@ test('builds wallet ledger presentation with stable source fallbacks', () => { ); expect(getWalletLedgerSourceLabel('future_source')).toBe('future_source'); expect(getWalletLedgerSourceLabel('llm_router_consume')).toBe('LLM 调用消耗'); + expect(getWalletLedgerSourceLabel('membership_upgrade_grant')).toBe( + '会员升级补点', + ); expect(getWalletLedgerSourceLabel('')).toBe('未知来源'); expect(formatWalletLedgerDate('not-a-date')).toBe('not-a-date'); diff --git a/packages/shared/src/components/PlatformProfileWalletLedgerModal/model.ts b/packages/shared/src/components/PlatformProfileWalletLedgerModal/model.ts index a18adce79..dd81ffc83 100644 --- a/packages/shared/src/components/PlatformProfileWalletLedgerModal/model.ts +++ b/packages/shared/src/components/PlatformProfileWalletLedgerModal/model.ts @@ -11,6 +11,7 @@ const PROFILE_WALLET_LEDGER_SOURCE_LABELS = { snapshot_sync: '账户同步', membership_period_grant: '会员周期发放', membership_period_reset: '会员周期重置', + membership_upgrade_grant: '会员升级补点', daily_free_grant: '每日免费发放', daily_free_reset: '每日免费重置', asset_operation_consume: '资产操作消耗', diff --git a/packages/shared/src/contracts/runtime.ts b/packages/shared/src/contracts/runtime.ts index eee7978ed..2d30cc81d 100644 --- a/packages/shared/src/contracts/runtime.ts +++ b/packages/shared/src/contracts/runtime.ts @@ -74,6 +74,7 @@ export type ProfileWalletLedgerEntry = { | 'points_recharge' | 'membership_period_grant' | 'membership_period_reset' + | 'membership_upgrade_grant' | 'daily_free_grant' | 'daily_free_reset' | 'asset_operation_consume' diff --git a/server-rs/crates/api-server/src/admin.rs b/server-rs/crates/api-server/src/admin.rs index eb4b766ac..5b3e3afc5 100644 --- a/server-rs/crates/api-server/src/admin.rs +++ b/server-rs/crates/api-server/src/admin.rs @@ -4766,6 +4766,7 @@ fn wallet_ledger_source_type_to_string(value: &Value) -> Option { 13 => "daily_free_reset", 14 => "recharge_refund_recovery", 15 => "llm_router_consume", + 16 => "membership_upgrade_grant", _ => return Some(Value::Array(items.to_vec()).to_string()), } .to_string(), @@ -6277,6 +6278,14 @@ mod tests { wallet_ledger_source_type_to_string(&json!([15, []])).as_deref(), Some("llm_router_consume") ); + assert_eq!( + wallet_ledger_source_type_to_string(&json!([16, []])).as_deref(), + Some("membership_upgrade_grant") + ); + assert_eq!( + wallet_ledger_source_type_to_string(&json!([17, []])).as_deref(), + Some("[17,[]]") + ); } #[test] diff --git a/server-rs/crates/api-server/src/runtime_profile.rs b/server-rs/crates/api-server/src/runtime_profile.rs index db27bb20f..d92ae2454 100644 --- a/server-rs/crates/api-server/src/runtime_profile.rs +++ b/server-rs/crates/api-server/src/runtime_profile.rs @@ -55,6 +55,7 @@ use shared_contracts::runtime::{ PROFILE_WALLET_LEDGER_SOURCE_TYPE_INVITE_INVITER_REWARD, PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_PERIOD_GRANT, PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_PERIOD_RESET, + PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_UPGRADE_GRANT, PROFILE_WALLET_LEDGER_SOURCE_TYPE_NEW_USER_REGISTRATION_REWARD, PROFILE_WALLET_LEDGER_SOURCE_TYPE_POINTS_RECHARGE, PROFILE_WALLET_LEDGER_SOURCE_TYPE_PUZZLE_AUTHOR_INCENTIVE_CLAIM, @@ -214,6 +215,9 @@ fn format_profile_wallet_ledger_source_type( RuntimeProfileWalletLedgerSourceType::RechargeRefundRecovery => { PROFILE_WALLET_LEDGER_SOURCE_TYPE_RECHARGE_REFUND_RECOVERY } + RuntimeProfileWalletLedgerSourceType::MembershipUpgradeGrant => { + PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_UPGRADE_GRANT + } } } @@ -2649,6 +2653,12 @@ mod tests { ), shared_contracts::runtime::PROFILE_WALLET_LEDGER_SOURCE_TYPE_DAILY_FREE_RESET ); + assert_eq!( + format_profile_wallet_ledger_source_type( + RuntimeProfileWalletLedgerSourceType::MembershipUpgradeGrant + ), + shared_contracts::runtime::PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_UPGRADE_GRANT + ); } #[test] diff --git a/server-rs/crates/module-runtime/src/domain.rs b/server-rs/crates/module-runtime/src/domain.rs index 9d60e5cef..be3856223 100644 --- a/server-rs/crates/module-runtime/src/domain.rs +++ b/server-rs/crates/module-runtime/src/domain.rs @@ -1152,6 +1152,7 @@ pub enum RuntimeProfileWalletLedgerSourceType { DailyFreeReset, RechargeRefundRecovery, LlmRouterConsume, + MembershipUpgradeGrant, } impl RuntimeProfileWalletLedgerSourceType { @@ -1173,6 +1174,7 @@ impl RuntimeProfileWalletLedgerSourceType { Self::DailyFreeReset => "daily_free_reset", Self::RechargeRefundRecovery => "recharge_refund_recovery", Self::LlmRouterConsume => "llm_router_consume", + Self::MembershipUpgradeGrant => "membership_upgrade_grant", } } } diff --git a/server-rs/crates/module-runtime/src/lib.rs b/server-rs/crates/module-runtime/src/lib.rs index bcec66d2e..8c0ddb80a 100644 --- a/server-rs/crates/module-runtime/src/lib.rs +++ b/server-rs/crates/module-runtime/src/lib.rs @@ -939,6 +939,10 @@ mod tests { RuntimeProfileWalletLedgerSourceType::LlmRouterConsume.as_str(), "llm_router_consume" ); + assert_eq!( + RuntimeProfileWalletLedgerSourceType::MembershipUpgradeGrant.as_str(), + "membership_upgrade_grant" + ); } #[test] diff --git a/server-rs/crates/shared-contracts/src/runtime.rs b/server-rs/crates/shared-contracts/src/runtime.rs index 704a5d444..ac339f8ac 100644 --- a/server-rs/crates/shared-contracts/src/runtime.rs +++ b/server-rs/crates/shared-contracts/src/runtime.rs @@ -26,6 +26,8 @@ pub const PROFILE_WALLET_LEDGER_SOURCE_TYPE_REDEEM_CODE_REWARD: &str = "redeem_c pub const PROFILE_WALLET_LEDGER_SOURCE_TYPE_PUZZLE_AUTHOR_INCENTIVE_CLAIM: &str = "puzzle_author_incentive_claim"; pub const PROFILE_WALLET_LEDGER_SOURCE_TYPE_DAILY_TASK_REWARD: &str = "daily_task_reward"; +pub const PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_UPGRADE_GRANT: &str = + "membership_upgrade_grant"; pub const PROFILE_TASK_CYCLE_DAILY: &str = "daily"; pub const PROFILE_TASK_STATUS_INCOMPLETE: &str = "incomplete"; pub const PROFILE_TASK_STATUS_CLAIMABLE: &str = "claimable"; diff --git a/server-rs/crates/spacetime-client/src/active/mapper/runtime_profile.rs b/server-rs/crates/spacetime-client/src/active/mapper/runtime_profile.rs index cc73d695d..b92650e66 100644 --- a/server-rs/crates/spacetime-client/src/active/mapper/runtime_profile.rs +++ b/server-rs/crates/spacetime-client/src/active/mapper/runtime_profile.rs @@ -70,6 +70,9 @@ pub(crate) fn map_runtime_profile_wallet_ledger_source_type_back( crate::module_bindings::RuntimeProfileWalletLedgerSourceType::RechargeRefundRecovery => { module_runtime::RuntimeProfileWalletLedgerSourceType::RechargeRefundRecovery } + crate::module_bindings::RuntimeProfileWalletLedgerSourceType::MembershipUpgradeGrant => { + module_runtime::RuntimeProfileWalletLedgerSourceType::MembershipUpgradeGrant + } } } diff --git a/server-rs/crates/spacetime-client/src/module_bindings/runtime_profile_wallet_ledger_source_type_type.rs b/server-rs/crates/spacetime-client/src/module_bindings/runtime_profile_wallet_ledger_source_type_type.rs index ad94b2707..ad3437f63 100644 --- a/server-rs/crates/spacetime-client/src/module_bindings/runtime_profile_wallet_ledger_source_type_type.rs +++ b/server-rs/crates/spacetime-client/src/module_bindings/runtime_profile_wallet_ledger_source_type_type.rs @@ -39,6 +39,8 @@ pub enum RuntimeProfileWalletLedgerSourceType { RechargeRefundRecovery, LlmRouterConsume, + + MembershipUpgradeGrant, } impl __sdk::InModule for RuntimeProfileWalletLedgerSourceType { diff --git a/src/components/platform-entry/platformProfileFundsModel.ts b/src/components/platform-entry/platformProfileFundsModel.ts index 2875aa7af..e2d92f761 100644 --- a/src/components/platform-entry/platformProfileFundsModel.ts +++ b/src/components/platform-entry/platformProfileFundsModel.ts @@ -11,6 +11,7 @@ const PLATFORM_WALLET_LEDGER_SOURCE_LABELS = { snapshot_sync: '账户同步', membership_period_grant: '会员周期发放', membership_period_reset: '会员周期重置', + membership_upgrade_grant: '会员升级补点', daily_free_grant: '每日免费发放', daily_free_reset: '每日免费重置', asset_operation_consume: '资产操作消耗',