|
|
@@ -1,4 +1,4 @@
|
|
|
-import { Injectable, InternalServerErrorException, Logger } from '@nestjs/common'
|
|
|
+import { BadRequestException, Injectable, InternalServerErrorException, Logger } from '@nestjs/common'
|
|
|
import { InjectRepository } from '@nestjs/typeorm'
|
|
|
import { UserBalance } from './entities/user-balance.entity'
|
|
|
import { Repository } from 'typeorm'
|
|
|
@@ -31,7 +31,7 @@ export class UserBalanceService {
|
|
|
const userBalance = await this.getBalance(userId)
|
|
|
const balance = userBalance.balance.plus(amount)
|
|
|
if (balance.comparedTo(new BigNumber(0)) < 0) {
|
|
|
- throw new Error('余额不足')
|
|
|
+ throw new BadRequestException('余额不足')
|
|
|
}
|
|
|
Logger.log(userBalance.balance.plus(amount), '余额')
|
|
|
await this.balanceRecordRepository.save(
|