소스 검색

代码优化

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