Merge remote-tracking branch 'origin/master' into feat/game-agent-canvas-resource-workbench-v2

This commit is contained in:
2026-09-08 14:58:58 +08:00
8 changed files with 173 additions and 17 deletions
@@ -131,4 +131,45 @@ test('builds wallet ledger presentation with stable source fallbacks', () => {
},
],
});
for (const reason of [
'生成美术素材',
'编辑美术素材',
'提取美术素材',
'生成角色动画',
'生成视频素材',
'生成音效素材',
'生成背景音乐',
]) {
expect(
buildWalletLedgerPresentation(
{
entries: [
buildLedgerEntry({
amountDelta: -12,
sourceType: 'asset_operation_consume',
reason,
}),
],
},
12,
).entries[0]?.sourceLabel,
`unexpected source label for ${reason}`,
).toBe(reason);
}
expect(
buildWalletLedgerPresentation(
{
entries: [
buildLedgerEntry({
amountDelta: -12,
sourceType: 'asset_operation_consume',
reason: ' ',
}),
],
},
12,
).entries[0]?.sourceLabel,
).toBe('资产操作消耗');
});
@@ -103,7 +103,8 @@ export function buildWalletLedgerPresentation(
createdAtLabel: formatWalletLedgerDate(entry.createdAt),
id: entry.id,
isIncome: entry.amountDelta > 0,
sourceLabel: getWalletLedgerSourceLabel(entry.sourceType),
sourceLabel:
entry.reason?.trim() || getWalletLedgerSourceLabel(entry.sourceType),
})),
};
}
+1
View File
@@ -84,6 +84,7 @@ export type ProfileWalletLedgerEntry = {
| 'puzzle_author_incentive_claim'
| 'daily_task_reward';
createdAt: string;
reason?: string;
};
export type ProfileWalletLedgerResponse = {