Przeglądaj źródła

修复只定义异常未抛出异常问题

codingliang 7 miesięcy temu
rodzic
commit
1f8a29cd90

+ 1 - 1
src/main/java/com/sqx/modules/member/service/impl/SpecialFavorStudentServiceImpl.java

@@ -116,7 +116,7 @@ public class SpecialFavorStudentServiceImpl extends ServiceImpl<SpecialFavorStud
 
         UserEntity user = userService.getById(userId);
         if(ObjectUtil.isNotNull(user.getIsVip()) && user.getIsVip() == 1 && VipExpirationUtil.isVipValid(user.getVipExpirationTime())) {
-            new SqxException("已经是会员,不能重复购买!");
+            throw new SqxException("已经是会员,不能重复购买!");
         }
 
         // 更新认证状态

+ 3 - 3
src/main/java/com/sqx/modules/member/service/impl/VipServiceImpl.java

@@ -136,12 +136,12 @@ public class VipServiceImpl implements VipService {
 
     private void beforePay(UserEntity user, String promoCode) {
         if(ObjectUtil.isNotNull(user.getIsVip()) && user.getIsVip() == 1 && VipExpirationUtil.isVipValid(user.getVipExpirationTime())) {
-            new SqxException("已经是会员,不能重复购买!");
+            throw new SqxException("已经是会员,不能重复购买!");
         }
 
         VipPromoCode vipPromoCode = vipPromoCodeService.getByCode(promoCode);
         if (ObjectUtil.isNull(vipPromoCode)) {
-            new SqxException("无效的推广码!");
+            throw new SqxException("无效的推广码!");
         }
     }
 
@@ -149,7 +149,7 @@ public class VipServiceImpl implements VipService {
     public VipReduceVO getVipReduceInfo(Long userId, Long shopId) {
         GoodsShop goodsShop = goodsShopService.getById(shopId);
         if (ObjectUtil.isNull(goodsShop)) {
-            new SqxException("无效的店铺id!");
+            throw new SqxException("无效的店铺id!");
         }
 
         String goodsShopVipPromotion = goodsShop.getVipPromotion();