|
|
@@ -44,8 +44,9 @@ const GandartConstKey = {
|
|
|
NewCastingLockMaxNum: 'lkGandartNewCastingLockMaxNum',
|
|
|
|
|
|
NewCastingPayWalletList: 'lkGandartNewCastingPayWalletList',
|
|
|
- NewCastingId: 'lkGandartNewCollectionCastingId',
|
|
|
- NewCastingSearchKey: 'lkGandartNewCollectionCastingSearchKey',
|
|
|
+ NewCollectionCastingId: 'lkGandartNewCollectionCastingId',
|
|
|
+ NewCollectionCastingSearchKey: 'lkGandartNewCollectionCastingSearchKey',
|
|
|
+ NewCollectionCateLst: 'lkGandartNewCollectionCateLst',
|
|
|
};
|
|
|
|
|
|
let gandartToken = lk.getVal(GandartConstKey.Token, '');
|
|
|
@@ -247,23 +248,52 @@ function checkIsInPrivWalletList(walletInfo) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+function concatNftSeriesLst(latestLst, newLst, page) {
|
|
|
+ for (let i = 0; i < newLst.length; i++) {
|
|
|
+ newLst[i].page = page;
|
|
|
+ latestLst.push(newLst[i]);
|
|
|
+ }
|
|
|
+ return latestLst;
|
|
|
+}
|
|
|
+
|
|
|
+function cacheNftSeriesLst(seriesLst) {
|
|
|
+ // 精简一下内容
|
|
|
+ let simpleLst = [];
|
|
|
+ for (let i = 0; i < seriesLst.length; i++) {
|
|
|
+ let info = seriesLst[i];
|
|
|
+ let item = {
|
|
|
+ id: info.id,
|
|
|
+ seriesName: info.seriesName,
|
|
|
+ castingCount: info.castingCount,
|
|
|
+ surplus: info.number,
|
|
|
+ startTime: info.startTime,
|
|
|
+ endTime: info.endTime,
|
|
|
+ };
|
|
|
+ simpleLst.push(item);
|
|
|
+ }
|
|
|
+ let jsonStr = JSON.stringify(simpleLst, null, 2);
|
|
|
+ lk.setVal(GandartConstKey.NewCollectionCateLst, jsonStr);
|
|
|
+}
|
|
|
+
|
|
|
async function getNewCollectionCastingData() {
|
|
|
let allNftSeriesLst = [];
|
|
|
let nftSeriesDetail = await findAllFirstNftSeries(1, 5);
|
|
|
if (nftSeriesDetail && nftSeriesDetail.success) {
|
|
|
- allNftSeriesLst = allNftSeriesLst.concat(nftSeriesDetail.obj);
|
|
|
+ allNftSeriesLst = concatNftSeriesLst(allNftSeriesLst, nftSeriesDetail.obj, 1);
|
|
|
for (let i = 2; i < nftSeriesDetail.totalPage + 1; i++) {
|
|
|
nftSeriesDetail = await findAllFirstNftSeries(i, 5);
|
|
|
if (nftSeriesDetail && nftSeriesDetail.success) {
|
|
|
- allNftSeriesLst = allNftSeriesLst.concat(nftSeriesDetail.obj);
|
|
|
+ allNftSeriesLst = concatNftSeriesLst(allNftSeriesLst, nftSeriesDetail.obj, i);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ cacheNftSeriesLst(allNftSeriesLst);
|
|
|
+
|
|
|
let tNftCollection;
|
|
|
let retNftSeriesLst = [];
|
|
|
let retFinalNftSeries;
|
|
|
if (allNftSeriesLst && allNftSeriesLst.length > 0) {
|
|
|
- let newCastingId = lk.getVal(GandartConstKey.NewCastingId, 0);
|
|
|
+ let newCastingId = lk.getVal(GandartConstKey.NewCollectionCastingId, 0);
|
|
|
newCastingId = Number(newCastingId);
|
|
|
let nowDate = new Date();
|
|
|
if (newCastingId > 0) {
|
|
|
@@ -280,7 +310,7 @@ async function getNewCollectionCastingData() {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- let castingSearchKey = lk.getVal(GandartConstKey.NewCastingSearchKey);
|
|
|
+ let castingSearchKey = lk.getVal(GandartConstKey.NewCollectionCastingSearchKey);
|
|
|
lk.log('通过产品名称关键字进行匹配');
|
|
|
if (!lk.isEmpty(castingSearchKey)) {
|
|
|
for (let i = 0; i < allNftSeriesLst.length; i++) {
|