Răsfoiți Sursa

修改展厅藏品默认公开展示

ouyang 3 ani în urmă
părinte
comite
aca42c637b
1 a modificat fișierele cu 5 adăugiri și 6 ștergeri
  1. 5 6
      src/main/java/com/izouma/nineth/service/AssetService.java

+ 5 - 6
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -96,8 +96,7 @@ public class AssetService {
                 .price(price)
                 .price(price)
                 .build());
                 .build());
         rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
         rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
-        publicShow(asset.getId());
-        return asset;
+        return publicShow(asset.getId());
     }
     }
 
 
     public Asset createAsset(BlindBoxItem winItem, User user, Long orderId, BigDecimal price, String type,
     public Asset createAsset(BlindBoxItem winItem, User user, Long orderId, BigDecimal price, String type,
@@ -121,18 +120,17 @@ public class AssetService {
                 .price(price)
                 .price(price)
                 .build());
                 .build());
         rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
         rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
-        publicShow(asset.getId());
-        return asset;
+        return publicShow(asset.getId());
     }
     }
 
 
 
 
-    public void publicShow(Long id) {
+    public Asset publicShow(Long id) {
         Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
         Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
         if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
         if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
             throw new BusinessException("此藏品不属于你");
             throw new BusinessException("此藏品不属于你");
         }
         }
         if (asset.isPublicShow()) {
         if (asset.isPublicShow()) {
-            return;
+            return asset;
         }
         }
         if (asset.getStatus() != AssetStatus.NORMAL) {
         if (asset.getStatus() != AssetStatus.NORMAL) {
             throw new BusinessException("当前状态不可展示");
             throw new BusinessException("当前状态不可展示");
@@ -167,6 +165,7 @@ public class AssetService {
         asset.setPublicShow(true);
         asset.setPublicShow(true);
         asset.setPublicCollectionId(collection.getId());
         asset.setPublicCollectionId(collection.getId());
         assetRepo.save(asset);
         assetRepo.save(asset);
+        return asset;
     }
     }
 
 
     public synchronized void consignment(Long id, BigDecimal price) {
     public synchronized void consignment(Long id, BigDecimal price) {