feat(泥点): 账本来源追加会员升级补点

- module-runtime:RuntimeProfileWalletLedgerSourceType 末尾追加 MembershipUpgradeGrant,保持枚举只追加
- shared-contracts:新增 PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_UPGRADE_GRANT 常量
- api-server:后台枚举索引映射与来源格式化支持新来源,并补单测断言
- spacetime-client:手写 mapper 与生成绑定同步新增变体
- packages/shared 与主站前端:钱包流水来源标签新增「会员升级补点」

Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
2026-10-02 14:33:16 +08:00
parent ba22d178d3
commit 26e1ea9e27
11 changed files with 38 additions and 0 deletions
@@ -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');
@@ -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: '资产操作消耗',
+1
View File
@@ -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'
+9
View File
@@ -4766,6 +4766,7 @@ fn wallet_ledger_source_type_to_string(value: &Value) -> Option<String> {
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]
@@ -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]
@@ -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",
}
}
}
@@ -939,6 +939,10 @@ mod tests {
RuntimeProfileWalletLedgerSourceType::LlmRouterConsume.as_str(),
"llm_router_consume"
);
assert_eq!(
RuntimeProfileWalletLedgerSourceType::MembershipUpgradeGrant.as_str(),
"membership_upgrade_grant"
);
}
#[test]
@@ -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";
@@ -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
}
}
}
@@ -39,6 +39,8 @@ pub enum RuntimeProfileWalletLedgerSourceType {
RechargeRefundRecovery,
LlmRouterConsume,
MembershipUpgradeGrant,
}
impl __sdk::InModule for RuntimeProfileWalletLedgerSourceType {
@@ -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: '资产操作消耗',