|
|
@@ -63,47 +63,50 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
Arrays.stream(new File("/Users/qiufangchao/Desktop/mugen_mu").listFiles())
|
|
|
.filter(f -> !f.getName().contains(".DS_Store"))
|
|
|
.parallel().forEach(file -> {
|
|
|
- try {
|
|
|
+ try {
|
|
|
// String name = file.getName();
|
|
|
// Pattern p = Pattern.compile("(\\d+)");
|
|
|
// Matcher matcher = p.matcher(name);
|
|
|
// matcher.find();
|
|
|
// String findname = matcher.group();
|
|
|
|
|
|
- Collection collection = JSON.parseObject(jsonStr, Collection.class);
|
|
|
- collection.setId(null);
|
|
|
- collection.setName("MUGEN无限:未央宗#" + num.getAndIncrement());
|
|
|
- collection.setStock(1);
|
|
|
- collection.setTotal(1);
|
|
|
- collection.setSale(0);
|
|
|
- collection.setMinterId(5868950L);
|
|
|
- collection.setOnShelf(false);
|
|
|
- collection.setSalable(false);
|
|
|
+ Collection collection = JSON.parseObject(jsonStr, Collection.class);
|
|
|
+ collection.setId(null);
|
|
|
+ collection.setName("MUGEN无限:未央宗#" + num.getAndIncrement());
|
|
|
+ collection.setStock(1);
|
|
|
+ collection.setTotal(1);
|
|
|
+ collection.setSale(0);
|
|
|
+ collection.setMinterId(5868950L);
|
|
|
+ collection.setOnShelf(false);
|
|
|
+ collection.setSalable(false);
|
|
|
// String thumbPath = "https://cdn.raex.vip/thumb_image/mahjongman/" + file.getName()
|
|
|
// .substring(0, file.getName().lastIndexOf(".")) + ".jpg";
|
|
|
- collection.setPic(Collections.singletonList(new FileObject("", "https://cdn.raex.vip/nft/mugen_mu/" + file.getName(), null, "image/png")));
|
|
|
-
|
|
|
- collectionRepo.save(collection);
|
|
|
- System.out.println("保存成功" + collection.getId());
|
|
|
-
|
|
|
- items.add(BlindBoxItem
|
|
|
- .builder()
|
|
|
- .collectionId(collection.getId())
|
|
|
- .total(1)
|
|
|
- .stock(1)
|
|
|
- .rare(false)
|
|
|
- .build());
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- });
|
|
|
+ collection.setPic(Collections
|
|
|
+ .singletonList(new FileObject("", "https://cdn.raex.vip/nft/mugen_mu/" + file
|
|
|
+ .getName(), null, "image/png")));
|
|
|
+
|
|
|
+ collectionRepo.save(collection);
|
|
|
+ System.out.println("保存成功" + collection.getId());
|
|
|
+
|
|
|
+ items.add(BlindBoxItem
|
|
|
+ .builder()
|
|
|
+ .collectionId(collection.getId())
|
|
|
+ .total(1)
|
|
|
+ .stock(1)
|
|
|
+ .rare(false)
|
|
|
+ .build());
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void createBlindBox() throws IOException {
|
|
|
- List<Long> arr = Arrays.asList(6862110L, 6862511L, 6862516L, 6862533L, 6862689L, 6862792L, 6862867L, 6863009L, 6863047L,
|
|
|
- 6863188L, 6863438L, 6863449L, 6863588L, 6863608L, 6863671L, 6863745L, 6863760L, 6863938L, 6863954L, 6864008L, 6864081L);
|
|
|
+ List<Long> arr = Arrays
|
|
|
+ .asList(6862110L, 6862511L, 6862516L, 6862533L, 6862689L, 6862792L, 6862867L, 6863009L, 6863047L,
|
|
|
+ 6863188L, 6863438L, 6863449L, 6863588L, 6863608L, 6863671L, 6863745L, 6863760L, 6863938L, 6863954L, 6864008L, 6864081L);
|
|
|
List<Collection> items = collectionRepo.findByNameLike("MUGEN无限:未央宗#%").stream().filter(i -> {
|
|
|
int num = Integer.parseInt(i.getName().substring("MUGEN无限:未央宗#".length()));
|
|
|
return num > 0 && num <= 2000 && !arr.contains(i.getId());
|
|
|
@@ -119,7 +122,8 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
blindBox.setNoSoldOut(true);
|
|
|
blindBox.setMaxCount(1);
|
|
|
blindBox.setName("MUGEN无限未央宗数字艺术品盲盒");
|
|
|
- blindBox.setPic(Arrays.asList(new FileObject(null, "https://cdn.raex.vip/nft/2022-04-16-19-24-54WTJLmsmR.jpg", null, "image/jpeg")));
|
|
|
+ blindBox.setPic(Arrays
|
|
|
+ .asList(new FileObject(null, "https://cdn.raex.vip/nft/2022-04-16-19-24-54WTJLmsmR.jpg", null, "image/jpeg")));
|
|
|
collectionService.createBlindBox(new CreateBlindBox(blindBox, items.stream().map(i -> {
|
|
|
BlindBoxItem item = new BlindBoxItem();
|
|
|
item.setCollectionId(i.getId());
|
|
|
@@ -168,7 +172,8 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
.forEach(file -> {
|
|
|
System.out.println(file.getName());
|
|
|
try {
|
|
|
- String url = storageService.uploadFromInputStream(new FileInputStream(file), "video/mahjongman/" + file.getName());
|
|
|
+ String url = storageService
|
|
|
+ .uploadFromInputStream(new FileInputStream(file), "video/mahjongman/" + file.getName());
|
|
|
String thumbPath = "thumb_image/mahjongman/" + file.getName()
|
|
|
.substring(0, file.getName().lastIndexOf(".")) + ".jpg";
|
|
|
|
|
|
@@ -210,4 +215,11 @@ class CollectionServiceTest extends ApplicationTests {
|
|
|
System.out.println(firstHour);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void test3() {
|
|
|
+ List<Long> oasisIds = new ArrayList<>(Arrays
|
|
|
+ .asList(1560L, 1559L, 1558L, 1459L, 1457L, 1454L, 1453L, 1456L, 1460L, 1452L));
|
|
|
+ collectionService.setOasisScancode(oasisIds);
|
|
|
+ }
|
|
|
+
|
|
|
}
|