From a738f7d328e037abe189c14c94d7ef835bf8296c Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 12 九月 2024 09:27:46 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 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 7283df9..aec8295 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
@@ -190,6 +190,7 @@
         //检查当前用户积分是否够
         Long userId = tokenService.getLoginUserApplet().getUserId();
         Integer point = 0;
+        TAppUser user = appUserClient.getUserById(userId).getData();
 
         if (exchangeDto.getGoodType()==1) {
             //查询当前商品信息
@@ -200,7 +201,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("当前用户积分不足");
              }
@@ -212,6 +212,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