From c5462d60b99823adb10d9e9eda671920118538f7 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期四, 12 九月 2024 09:06:35 +0800
Subject: [PATCH] 9.12

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
index 6c6629d..a7cad6f 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
@@ -185,6 +185,7 @@
         //检查当前用户积分是否够
         Long userId = tokenService.getLoginUserApplet().getUserId();
         Integer point = 0;
+        TAppUser user = appUserClient.getUserById(userId).getData();
 
         if (exchangeDto.getGoodType()==1) {
             //查询当前商品信息
@@ -195,7 +196,6 @@
             if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) {
                 return AjaxResult.error("当前用户已兑换"+count+"张");
             }
-        TAppUser user = appUserClient.getUserById(userId).getData();
         if (user.getPoints()<good.getRedeemPoints()){
             return AjaxResult.error("当前用户积分不足");
              }
@@ -207,6 +207,9 @@
             if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) {
                 return AjaxResult.error("当前用户已到达兑换"+coupon+"次");
             }
+            if (user.getPoints()<point){
+                return AjaxResult.error("当前用户积分不足");
+            }
         }
         exchangeDto.setPoint(point);
         exchangeDto.setUserId(userId);

--
Gitblit v1.7.1