zhangchen 1 ヶ月 前
コミット
ab7f95f193

+ 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();