Add last pull

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

View file

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