const axios = require("axios"); const qs = require("qs"); const encryptUtil = require("./encryptUtil"); const fs = require("fs"); const queue = require("queue"); const config = require("./config.json"); axios.defaults.baseURL = config.baseUrl; axios.interceptors.request.use( function (config) { config.metadata = { startTime: new Date() }; return config; }, function (error) { return Promise.reject(error); } ); axios.interceptors.response.use( function (response) { response.config.metadata.endTime = new Date(); response.duration = response.config.metadata.endTime - response.config.metadata.startTime; return response; }, function (error) { error.config.metadata.endTime = new Date(); error.duration = error.config.metadata.endTime - error.config.metadata.startTime; return Promise.reject(error); } ); axios .post("/auth/login", qs.stringify(config.admin)) .then((res) => { axios.defaults.headers["Authorization"] = "Bearer " + res.data; let d1 = { onShelf: false, salable: true, properties: [], type: "DEFAULT", source: "OFFICIAL", pic: [ { name: "test.jpeg", url: "https://raex-meta.oss-cn-shenzhen.aliyuncs.com/nft/2022-02-17-16-24-20TavTRVFG.jpg", thumb: null, type: "image/jpeg", }, ], scheduleSale: false, sort: 0, privileges: [], maxCount: 0, countId: null, canResale: true, scanCode: false, noSoldOut: true, assignment: 0, coupoPayment: false, price: 1, originalPrice: 1, royalties: 1, serviceCharge: 1, total: 1000, name: "test", minterId: "7150", minter: "RAEX绿洲数字藏品中心", minterAvatar: "https://raex-meta.oss-cn-shenzhen.aliyuncs.com/image/2021-12-17-19-03-38BNAlEhlJ.png", category: "勋章", detail: "
1
", couponPayment: false, }; Promise.all([ axios.post("/collection/create", d1).then((res) => { return Promise.resolve(res.data.id); }), axios.post("/collection/create", d1).then((res) => { return Promise.resolve(res.data.id); }), axios.post("/collection/create", d1).then((res) => { return Promise.resolve(res.data.id); }), axios.post("/collection/create", d1).then((res) => { return Promise.resolve(res.data.id); }), ]).then((res) => { console.log(res); let d2 = { blindBox: { onShelf: true, salable: true, properties: [], type: "BLIND_BOX", source: "OFFICIAL", pic: [ { name: "test.jpeg", url: "https://raex-meta.oss-cn-shenzhen.aliyuncs.com/nft/2022-02-17-16-26-52yiLHxKRQ.jpg", thumb: null, type: "image/jpeg", }, ], scheduleSale: false, privileges: [], sort: 0, maxCount: 0, countId: null, scanCode: false, noSoldOut: true, assignment: 0, couponPayment: false, price: 0.01, total: 200, name: "盲盒", minterId: "7150", minter: "RAEX绿洲数字藏品中心", minterAvatar: "https://raex-meta.oss-cn-shenzhen.aliyuncs.com/image/2021-12-17-19-03-38BNAlEhlJ.png", category: "勋章", detail: "1
", }, items: res.map((i, index) => { return { rare: false, total: 100 * (index + 3), collectionId: i, }; }), }; axios.post("/collection/createBlindBox", d2).then((res) => { console.log(res.data.id); }); }); }) .catch((e) => { console.log(e.response); });