xiongzhu 4 anni fa
parent
commit
9bd15f9ad6

+ 6 - 0
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -108,6 +108,12 @@ public class OrderService {
                 throw new BusinessException("很遗憾,藏品已售罄");
             }
             Collection collection = collectionRepo.findById(collectionId).orElseThrow(new BusinessException("藏品不存在"));
+            if (collection.getAssetId() != null) {
+                Asset asset = assetRepo.findById(collection.getAssetId()).orElseThrow(new BusinessException("藏品不存在"));
+                if (asset.getStatus() != AssetStatus.NORMAL) {
+                    throw new BusinessException("藏品已下架");
+                }
+            }
             User minter = userRepo.findById(collection.getMinterId()).orElseThrow(new BusinessException("铸造者不存在"));
             UserCoupon coupon = null;
             if (userCouponId != null) {