diff --git a/backend/services/wallet-service/src/api/controllers/fiat-withdrawal.controller.ts b/backend/services/wallet-service/src/api/controllers/fiat-withdrawal.controller.ts index 85e9e4d2..0d639f4c 100644 --- a/backend/services/wallet-service/src/api/controllers/fiat-withdrawal.controller.ts +++ b/backend/services/wallet-service/src/api/controllers/fiat-withdrawal.controller.ts @@ -103,7 +103,7 @@ export class FiatWithdrawalController { async getFiatWithdrawals( @CurrentUser() user: CurrentUserPayload, ): Promise { - return this.fiatWithdrawalService.getFiatWithdrawals(user.userId); + return this.fiatWithdrawalService.getFiatWithdrawals(user.accountSequence); } /** diff --git a/backend/services/wallet-service/src/api/controllers/wallet.controller.ts b/backend/services/wallet-service/src/api/controllers/wallet.controller.ts index ff1616fa..93e75d79 100644 --- a/backend/services/wallet-service/src/api/controllers/wallet.controller.ts +++ b/backend/services/wallet-service/src/api/controllers/wallet.controller.ts @@ -132,7 +132,7 @@ export class WalletController { async getWithdrawals( @CurrentUser() user: CurrentUserPayload, ): Promise { - return this.walletService.getWithdrawals(user.userId); + return this.walletService.getWithdrawals(user.accountSequence); } @Get('pending-rewards') diff --git a/backend/services/wallet-service/src/application/services/fiat-withdrawal-application.service.ts b/backend/services/wallet-service/src/application/services/fiat-withdrawal-application.service.ts index 85ba2f45..0cc7d5a4 100644 --- a/backend/services/wallet-service/src/application/services/fiat-withdrawal-application.service.ts +++ b/backend/services/wallet-service/src/application/services/fiat-withdrawal-application.service.ts @@ -325,8 +325,9 @@ export class FiatWithdrawalApplicationService { /** * 获取用户的法币提现订单列表 */ - async getFiatWithdrawals(userId: string): Promise { - const orders = await this.fiatWithdrawalRepo.findByUserId(BigInt(userId)); + async getFiatWithdrawals(accountSequence: string): Promise { + // 使用 accountSequence 查询法币提现订单(废弃 userId 查询) + const orders = await this.fiatWithdrawalRepo.findByAccountSequence(accountSequence); return orders.map(order => this.toListItemDTO(order)); } 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 058da79f..4b542029 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 @@ -1754,7 +1754,7 @@ export class WalletApplicationService { /** * 查询用户提现订单 */ - async getWithdrawals(userId: string): Promise> { - const orders = await this.withdrawalRepo.findByUserId(BigInt(userId)); + // 使用 accountSequence 查询提现订单(废弃 userId 查询) + const orders = await this.withdrawalRepo.findByAccountSequence(accountSequence); return orders.map(order => ({ orderNo: order.orderNo, amount: order.amount.value, diff --git a/backend/services/wallet-service/src/domain/repositories/withdrawal-order.repository.interface.ts b/backend/services/wallet-service/src/domain/repositories/withdrawal-order.repository.interface.ts index fb2fe053..3839a3f7 100644 --- a/backend/services/wallet-service/src/domain/repositories/withdrawal-order.repository.interface.ts +++ b/backend/services/wallet-service/src/domain/repositories/withdrawal-order.repository.interface.ts @@ -7,6 +7,7 @@ export interface IWithdrawalOrderRepository { findById(orderId: bigint): Promise; findByOrderNo(orderNo: string): Promise; findByUserId(userId: bigint, status?: WithdrawalStatus): Promise; + findByAccountSequence(accountSequence: string, status?: WithdrawalStatus): Promise; findPendingOrders(): Promise; findFrozenOrders(): Promise; findBroadcastedOrders(): Promise; diff --git a/backend/services/wallet-service/src/infrastructure/persistence/repositories/withdrawal-order.repository.impl.ts b/backend/services/wallet-service/src/infrastructure/persistence/repositories/withdrawal-order.repository.impl.ts index b29e5245..42631015 100644 --- a/backend/services/wallet-service/src/infrastructure/persistence/repositories/withdrawal-order.repository.impl.ts +++ b/backend/services/wallet-service/src/infrastructure/persistence/repositories/withdrawal-order.repository.impl.ts @@ -74,6 +74,19 @@ export class WithdrawalOrderRepositoryImpl implements IWithdrawalOrderRepository return records.map(r => this.toDomain(r)); } + async findByAccountSequence(accountSequence: string, status?: WithdrawalStatus): Promise { + const where: Record = { accountSequence }; + if (status) { + where.status = status; + } + + const records = await this.prisma.withdrawalOrder.findMany({ + where, + orderBy: { createdAt: 'desc' }, + }); + return records.map(r => this.toDomain(r)); + } + async findPendingOrders(): Promise { const records = await this.prisma.withdrawalOrder.findMany({ where: { status: WithdrawalStatus.PENDING },