zhangchen преди 1 месец
родител
ревизия
ab7f95f193
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 4 0
      alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponServiceImpl.java

+ 4 - 0
alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponServiceImpl.java

@@ -1128,6 +1128,10 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
     @Override
     public boolean issuePlatformCoupon(List<Integer> userIds, Integer couponId) {
         LifeDiscountCoupon lifeDiscountCoupon = this.getById(couponId);
+        if(lifeDiscountCoupon == null){
+            //如果优惠券为空,则返回失败
+            return false;
+        }
         List<LifeDiscountCouponUser> lifeDiscountCouponUsers = new ArrayList<>();
         for (Integer userId : userIds) {
             LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();