Add last pull

pull/1/head
Made Baruna 2021-04-13 04:49:37 +08:00
parent a61fa8ac10
commit a7aa338aa1
2 changed files with 14 additions and 2 deletions

View File

@ -73,6 +73,11 @@
let currentBanner = ''; let currentBanner = '';
let currentPage = 1; let currentPage = 1;
let lastPull = {
id: '0',
time: 0,
}
function cancel() { function cancel() {
fetchController.abort(); fetchController.abort();
cancelled = true; cancelled = true;
@ -222,6 +227,11 @@
const name = row.name; const name = row.name;
const type = row.item_type.replace(/ /g, ''); const type = row.item_type.replace(/ /g, '');
if (row.id > lastPull.id) {
lastPull.id = row.id;
lastPull.time = time.format();
}
if (time.unix() <= newestPullTime) { if (time.unix() <= newestPullTime) {
return; return;
} }
@ -257,6 +267,7 @@
} catch (err) { } catch (err) {
processingLog = false; processingLog = false;
pushToast($t('wish.import.invalidData'), 'error'); pushToast($t('wish.import.invalidData'), 'error');
console.error(err);
throw 'invalid data'; throw 'invalid data';
} }
} while (result.length > 0 && lastTime > newestPullTime); } while (result.length > 0 && lastTime > newestPullTime);
@ -391,7 +402,7 @@
pushToast($t('wish.import.success')); pushToast($t('wish.import.success'));
if (wishTallyChecked) { if (wishTallyChecked) {
submitWishTally(); submitWishTally(lastPull);
} }
closeModal(); closeModal();

View File

@ -14,7 +14,7 @@ async function sendWish(data) {
} }
} }
export async function submitWishTally() { export async function submitWishTally(lastPull) {
let prefixId = 0; let prefixId = 0;
for (const id of bannerCategories) { for (const id of bannerCategories) {
prefixId += 100000; prefixId += 100000;
@ -64,6 +64,7 @@ export async function submitWishTally() {
total, total,
legendary: legendaryCount, legendary: legendaryCount,
rare: rareCount, rare: rareCount,
lastPull,
}); });
} }
} }