| | |
| | | throw new FebsException(MessageSourceUtils.getString("transfer_msg_001")); |
| | | } |
| | | |
| | | if (transferDto.getAmount().multiply(transferDto.getPrice()).compareTo(usdtRemain) > 0) { |
| | | throw new FebsException(MessageSourceUtils.getString("transfer_msg_002")); |
| | | } |
| | | |
| | | if (transferDto.getAmount().compareTo(saleCoinRemain) > 0) { |
| | | throw new FebsException(MessageSourceUtils.getString("transfer_msg_003")); |
| | | } |
| | | |
| | | usdtRemain = usdtRemain.subtract(transferDto.getAmount().multiply(transferDto.getPrice())); |
| | | saleCoinRemain = saleCoinRemain.subtract(transferDto.getAmount()); |
| | | |
| | | // 修改当日U剩余量 |
| | | redisUtils.set(AppContants.REDIS_KEY_USDT_OUT_LIMIT_REMAIN, usdtRemain); |
| | | // 修改用户24小时可售量 |
| | | redisUtils.set(AppContants.REDIS_KEY_COIN_REMAIN + member.getAddress(), saleCoinRemain, time); |
| | | // if (transferDto.getAmount().multiply(transferDto.getPrice()).compareTo(usdtRemain) > 0) { |
| | | // throw new FebsException(MessageSourceUtils.getString("transfer_msg_002")); |
| | | // } |
| | | // |
| | | // if (transferDto.getAmount().compareTo(saleCoinRemain) > 0) { |
| | | // throw new FebsException(MessageSourceUtils.getString("transfer_msg_003")); |
| | | // } |
| | | // |
| | | // usdtRemain = usdtRemain.subtract(transferDto.getAmount().multiply(transferDto.getPrice())); |
| | | // saleCoinRemain = saleCoinRemain.subtract(transferDto.getAmount()); |
| | | // |
| | | // // 修改当日U剩余量 |
| | | // redisUtils.set(AppContants.REDIS_KEY_USDT_OUT_LIMIT_REMAIN, usdtRemain); |
| | | // // 修改用户24小时可售量 |
| | | // redisUtils.set(AppContants.REDIS_KEY_COIN_REMAIN + member.getAddress(), saleCoinRemain, time); |
| | | } else if (DappFundFlowEntity.TYPE_BUY == transferDto.getType()) { |
| | | // 购买时,前端传来的amount是USDT,卖出amount是TFC |
| | | BigDecimal usdtAmount = transferDto.getAmount(); |