diff --git a/backend/services/wallet-service/src/api/controllers/system-withdrawal.controller.ts b/backend/services/wallet-service/src/api/controllers/system-withdrawal.controller.ts index 809957f3..86281cb6 100644 --- a/backend/services/wallet-service/src/api/controllers/system-withdrawal.controller.ts +++ b/backend/services/wallet-service/src/api/controllers/system-withdrawal.controller.ts @@ -28,7 +28,7 @@ import { SystemWithdrawalApplicationService } from '@/application/services'; class SystemWithdrawalRequestDTO { fromAccountSequence: string; toAccountSequence: string; - amount: number; + amount: number | string; // 支持字符串或数字 memo?: string; operatorId: string; operatorName?: string; @@ -106,7 +106,10 @@ export class SystemWithdrawalController { if (!dto.toAccountSequence) { throw new BadRequestException('接收账户不能为空'); } - if (!dto.amount || dto.amount <= 0) { + + // 将 amount 转换为数字(前端可能传入字符串) + const amount = typeof dto.amount === 'string' ? parseFloat(dto.amount) : dto.amount; + if (!amount || isNaN(amount) || amount <= 0) { throw new BadRequestException('转出金额必须大于0'); } if (!dto.operatorId) { @@ -116,7 +119,7 @@ export class SystemWithdrawalController { const result = await this.systemWithdrawalService.requestSystemWithdrawal({ fromAccountSequence: dto.fromAccountSequence, toAccountSequence: dto.toAccountSequence, - amount: dto.amount, + amount: amount, memo: dto.memo, operatorId: dto.operatorId, operatorName: dto.operatorName, diff --git a/frontend/admin-web/src/app/(dashboard)/system-transfer/page.tsx b/frontend/admin-web/src/app/(dashboard)/system-transfer/page.tsx index ce498cdb..070e6ea3 100644 --- a/frontend/admin-web/src/app/(dashboard)/system-transfer/page.tsx +++ b/frontend/admin-web/src/app/(dashboard)/system-transfer/page.tsx @@ -117,8 +117,11 @@ export default function SystemTransferPage() { setFormErrors({}); // 切换到订单列表查看 setActiveTab('orders'); - } catch (err) { - toast.error((err as Error).message || '划转失败'); + } catch (err: unknown) { + // 从 Axios 错误中提取消息 + const axiosError = err as { response?: { data?: { message?: string } }; message?: string }; + const errorMessage = axiosError.response?.data?.message || axiosError.message || '划转失败'; + toast.error(errorMessage); } };