Browse Source

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

ouyang 3 years ago
parent
commit
aca42c637b
1 changed files with 5 additions and 6 deletions
  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)
                 .build());
         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,
@@ -121,18 +120,17 @@ public class AssetService {
                 .price(price)
                 .build());
         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("无记录"));
         if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
             throw new BusinessException("此藏品不属于你");
         }
         if (asset.isPublicShow()) {
-            return;
+            return asset;
         }
         if (asset.getStatus() != AssetStatus.NORMAL) {
             throw new BusinessException("当前状态不可展示");
@@ -167,6 +165,7 @@ public class AssetService {
         asset.setPublicShow(true);
         asset.setPublicCollectionId(collection.getId());
         assetRepo.save(asset);
+        return asset;
     }
 
     public synchronized void consignment(Long id, BigDecimal price) {