From 64bb637143020ceef85ae724ac6ce70b28d455af Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 02 七月 2024 14:25:02 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/DolphinEnglish --- ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/TGoodsServiceImpl.java | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/TGoodsServiceImpl.java b/ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/TGoodsServiceImpl.java index e967318..8c1ef8e 100644 --- a/ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/TGoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/TGoodsServiceImpl.java @@ -176,12 +176,14 @@ .stream().mapToInt(Integer::intValue).sum(); } Integer userCount = good.getUserCount(); - if (good.getUserCount() > totalNumber) { + if (userCount > totalNumber) { int i = userCount - totalNumber; if (number > i) { return R.exchangeError("兑换失败,当前兑换数量已超过最大兑换数量,剩余兑换数量为: " + i + "!"); } + } else { + return R.exchangeError("兑换失败,当前兑换数量已超过最大兑换数量!"); } } boolean result = exchangeGood(goodExchange, recipient, number, goodId, needIntegral); @@ -320,6 +322,8 @@ return R.exchangeError("兑换失败,当前兑换数量已超过最大兑换数量,剩余兑换数量为: " + i + "!"); } + } else { + return R.exchangeError("兑换失败,当前兑换数量已超过最大兑换数量!"); } } boolean result = exchangeGoodParent(goodExchange, recipient, number, goodId, needIntegral); -- Gitblit v1.7.1