Browse Source

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

xuqiang 4 years ago
parent
commit
a9bf5d7949

+ 3 - 0
src/main/java/com/izouma/nineth/repo/AssetRepo.java

@@ -8,6 +8,7 @@ import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
+import java.time.LocalDateTime;
 import java.util.List;
 
 public interface AssetRepo extends JpaRepository<Asset, Long>, JpaSpecificationExecutor<Asset> {
@@ -21,4 +22,6 @@ public interface AssetRepo extends JpaRepository<Asset, Long>, JpaSpecificationE
     List<Asset> findByCollectionId(Long collectionId);
 
     List<Asset> findByCollectionIdAndStatusIn(Long collectionId, Iterable<AssetStatus> statuses);
+
+    List<Asset> findByCreatedAtBefore(LocalDateTime localDateTime);
 }

+ 24 - 0
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -287,4 +287,28 @@ public class AssetService {
         Thread.sleep(1000);
         log.info("" + i);
     }
+
+    public void setHistory() {
+        List<Asset> assets = assetRepo.findByCreatedAtBefore(LocalDateTime.of(2021, 11, 22, 23, 59, 59));
+        assets.parallelStream().forEach(asset -> {
+            try {
+                User owner = userRepo.findById(asset.getUserId()).orElseThrow(new BusinessException(""));
+                Order order = orderRepo.findById(asset.getOrderId()).orElseThrow(new BusinessException(""));
+                TokenHistory t = TokenHistory.builder()
+                        .tokenId(asset.getTokenId())
+                        .fromUser(asset.getMinter())
+                        .fromUserId(asset.getMinterId())
+                        .fromAvatar(asset.getMinterAvatar())
+                        .toUser(owner.getNickname())
+                        .toUserId(owner.getId())
+                        .toAvatar(owner.getAvatar())
+                        .operation("出售")
+                        .price(order.getPrice())
+                        .build();
+                t.setCreatedAt(asset.getCreatedAt());
+                tokenHistoryRepo.save(t);
+            } catch (Exception e) {
+            }
+        });
+    }
 }

+ 2 - 2
src/main/nine-space/src/components/product/HashCode.vue

@@ -8,7 +8,7 @@
                 <span class="text1">Hash地址:</span>
                 <span class="flex1"></span>
                 <img @click="copy(info.txHash)" src="../../assets/svgs/copy_icon.svg" alt="" />
-                <span class="van-ellipsis">{{ info.txHash }}</span>
+                <span class="van-ellipsis" style="direction: rtl; text-align: left">{{ info.txHash }}</span>
             </div>
             <div class="text-info">
                 <span class="text1">区块高度: </span>
@@ -19,7 +19,7 @@
                 <span class="text1">令牌ID: </span>
                 <span class="flex1"></span>
                 <img @click="copy(info.tokenId)" src="../../assets/svgs/copy_icon.svg" alt="" />
-                <span class="van-ellipsis">{{ info.tokenId }}</span>
+                <span class="van-ellipsis" style="direction: rtl; text-align: left">{{ info.tokenId }}</span>
             </div>
         </div>
         <div v-else class="textName">铸造者未设置</div>

+ 1 - 1
src/main/nine-space/src/views/asset/Detail.vue

@@ -255,7 +255,7 @@
                             </div>
                             <div class="text2" v-else>{{ item.operation }}</div>
                             <div class="text3 van-ellipsis">{{ item.toUser || '保密' }}</div>
-                            <div class="text4">{{ item.createdAt }}</div>
+                            <div class="text4">{{ item.createdAt.substr(0, 16) }}</div>
                         </div>
                     </div>
                     <div v-else style="display: flex; justify-content: center;">暂无购买记录</div>

+ 11 - 8
src/main/nine-space/src/views/product/Detail.vue

@@ -228,7 +228,7 @@
                                 </div>
                                 <div class="text2" v-else>{{ item.operation }}</div>
                                 <div class="text3 van-ellipsis">{{ item.toUser || '保密' }}</div>
-                                <div class="text4">{{ item.createdAt }}</div>
+                                <div class="text4">{{ item.createdAt.substr(0, 16) }}</div>
                             </div>
                         </div>
                     </div>
@@ -1205,19 +1205,22 @@ export default {
     height: 42px;
     .text1 {
         color: @prim;
-        width: 48px;
-        flex-shrink: 0;
-        margin-right: 20px;
+        width: 64px;
+        margin-right: 10px;
+        flex-basis: 0;
+        flex-grow: 1;
     }
     .text2 {
         color: @text3;
-        flex-grow: 1;
+        width: 95px;
+        min-width: 95px;
     }
     .text3 {
         color: #fff;
-        width: 48px;
-        flex-shrink: 0;
-        margin-right: 20px;
+        width: 64px;
+        margin-right: 10px;
+        flex-basis: 0;
+        flex-grow: 1;
     }
     .text4 {
         color: @text3;

+ 1 - 1
src/main/vue/src/views/RecommendEdit.vue

@@ -35,7 +35,7 @@
                     </el-form-item>
                     <el-form-item label="图片" prop="pic">
                         <single-upload v-model="formData.pic"></single-upload>
-                        <div class="tip">推荐分辨率765x420</div>
+                        <div class="tip">推荐分辨率:列表1000x1000,轮播765x420</div>
                     </el-form-item>
                     <el-form-item class="form-submit">
                         <el-button @click="onSave" :loading="saving" type="primary"> 保存 </el-button>

+ 5 - 0
src/test/java/com/izouma/nineth/service/AssetServiceTest.java

@@ -60,4 +60,9 @@ class AssetServiceTest extends ApplicationTests {
         Asset asset = assetRepo.findById(4622L).get();
         assetMintService.mint(asset, 1L);
     }
+
+    @Test
+    public void setHistory() {
+        assetService.setHistory();
+    }
 }