From 8d97ed2720c4652ab30e4c1a1a5d9d5900e471c4 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 4 Jan 2026 07:46:46 -0800 Subject: [PATCH] fix(wallet-service): convert BigInt to string for JSON serialization in getUnprocessedSettlements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The entry.id field is BigInt type from Prisma which cannot be JSON serialized directly. Convert to string for API response and back to BigInt when storing to database. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../src/application/services/wallet-application.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/services/wallet-service/src/application/services/wallet-application.service.ts b/backend/services/wallet-service/src/application/services/wallet-application.service.ts index 6949a303..3f200b87 100644 --- a/backend/services/wallet-service/src/application/services/wallet-application.service.ts +++ b/backend/services/wallet-service/src/application/services/wallet-application.service.ts @@ -2498,7 +2498,7 @@ export class WalletApplicationService { */ async getUnprocessedSettlements(accountSequence: string): Promise<{ entries: Array<{ - id: bigint; + id: string; // BigInt 转换为 string 以支持 JSON 序列化 amount: number; createdAt: Date; memo: string | null; @@ -2538,7 +2538,7 @@ export class WalletApplicationService { const payloadJson = entry.payloadJson as Record | null; const allocationType = payloadJson?.allocationType as string | null; return { - id: entry.id, + id: entry.id.toString(), // BigInt 需要转为 string 才能 JSON 序列化 amount, createdAt: entry.createdAt, memo: entry.memo, @@ -2708,7 +2708,7 @@ export class WalletApplicationService { data: { accountSequence: command.accountSequence, userId: walletRecord.userId, - originalLedgerEntryId: entry.id, + originalLedgerEntryId: BigInt(entry.id), // 转回 BigInt 用于数据库存储 originalAmount: entry.amount, deductedAmount: actualDeduct, deductionLedgerEntryId: ledgerEntry.id,