fix(wallet-service): 修复提现订单查询使用 userId 的问题
将提现订单查询从 userId 改为使用 accountSequence: - getWithdrawals: 使用 findByAccountSequence 替代 findByUserId - getFiatWithdrawals: 使用 findByAccountSequence 替代 findByUserId - 新增 withdrawal-order.repository 的 findByAccountSequence 方法 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
217be89c43
commit
641612a5d0
|
|
@ -103,7 +103,7 @@ export class FiatWithdrawalController {
|
|||
async getFiatWithdrawals(
|
||||
@CurrentUser() user: CurrentUserPayload,
|
||||
): Promise<FiatWithdrawalListItemDTO[]> {
|
||||
return this.fiatWithdrawalService.getFiatWithdrawals(user.userId);
|
||||
return this.fiatWithdrawalService.getFiatWithdrawals(user.accountSequence);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export class WalletController {
|
|||
async getWithdrawals(
|
||||
@CurrentUser() user: CurrentUserPayload,
|
||||
): Promise<WithdrawalListItemDTO[]> {
|
||||
return this.walletService.getWithdrawals(user.userId);
|
||||
return this.walletService.getWithdrawals(user.accountSequence);
|
||||
}
|
||||
|
||||
@Get('pending-rewards')
|
||||
|
|
|
|||
|
|
@ -325,8 +325,9 @@ export class FiatWithdrawalApplicationService {
|
|||
/**
|
||||
* 获取用户的法币提现订单列表
|
||||
*/
|
||||
async getFiatWithdrawals(userId: string): Promise<FiatWithdrawalListItemDTO[]> {
|
||||
const orders = await this.fiatWithdrawalRepo.findByUserId(BigInt(userId));
|
||||
async getFiatWithdrawals(accountSequence: string): Promise<FiatWithdrawalListItemDTO[]> {
|
||||
// 使用 accountSequence 查询法币提现订单(废弃 userId 查询)
|
||||
const orders = await this.fiatWithdrawalRepo.findByAccountSequence(accountSequence);
|
||||
return orders.map(order => this.toListItemDTO(order));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1754,7 +1754,7 @@ export class WalletApplicationService {
|
|||
/**
|
||||
* 查询用户提现订单
|
||||
*/
|
||||
async getWithdrawals(userId: string): Promise<Array<{
|
||||
async getWithdrawals(accountSequence: string): Promise<Array<{
|
||||
orderNo: string;
|
||||
amount: number;
|
||||
fee: number;
|
||||
|
|
@ -1765,7 +1765,8 @@ export class WalletApplicationService {
|
|||
status: string;
|
||||
createdAt: string;
|
||||
}>> {
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ export interface IWithdrawalOrderRepository {
|
|||
findById(orderId: bigint): Promise<WithdrawalOrder | null>;
|
||||
findByOrderNo(orderNo: string): Promise<WithdrawalOrder | null>;
|
||||
findByUserId(userId: bigint, status?: WithdrawalStatus): Promise<WithdrawalOrder[]>;
|
||||
findByAccountSequence(accountSequence: string, status?: WithdrawalStatus): Promise<WithdrawalOrder[]>;
|
||||
findPendingOrders(): Promise<WithdrawalOrder[]>;
|
||||
findFrozenOrders(): Promise<WithdrawalOrder[]>;
|
||||
findBroadcastedOrders(): Promise<WithdrawalOrder[]>;
|
||||
|
|
|
|||
|
|
@ -74,6 +74,19 @@ export class WithdrawalOrderRepositoryImpl implements IWithdrawalOrderRepository
|
|||
return records.map(r => this.toDomain(r));
|
||||
}
|
||||
|
||||
async findByAccountSequence(accountSequence: string, status?: WithdrawalStatus): Promise<WithdrawalOrder[]> {
|
||||
const where: Record<string, unknown> = { 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<WithdrawalOrder[]> {
|
||||
const records = await this.prisma.withdrawalOrder.findMany({
|
||||
where: { status: WithdrawalStatus.PENDING },
|
||||
|
|
|
|||
Loading…
Reference in New Issue