Skip to content

Commit

Permalink
🐛 获取延时,以避免 -110 报错
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Sep 10, 2023
1 parent 61287e3 commit 4e23970
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/pages/User/Gacha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,18 @@ async function confirmRefresh(): Promise<void> {
loadingTitle.value = "数据获取完成,即将刷新页面";
loadingSub.value = "";
loading.value = false;
setTimeout(() => {
window.location.reload();
}, 1000);
await new Promise((resolve) => {
setTimeout(() => {
resolve("");
}, 1000);
});
window.location.reload();
}
// 获取祈愿数据并写入数据库
async function getGachaLogs(pool: string, endId: string = "0"): Promise<void> {
const gachaRes = await TGRequest.User.getGachaLog(authkey.value, pool, endId);
console.log(pool, endId, gachaRes);
if (Array.isArray(gachaRes)) {
const uigfList: TGApp.Plugins.UIGF.GachaItem[] = [];
gachaRes.forEach((item) => {
Expand All @@ -173,8 +177,18 @@ async function getGachaLogs(pool: string, endId: string = "0"): Promise<void> {
});
await TGSqlite.mergeUIGF(account.gameUid, uigfList);
if (gachaRes.length === 20) {
await new Promise((resolve) => {
setTimeout(() => {
resolve("");
}, 1000);
});
await getGachaLogs(pool, gachaRes[gachaRes.length - 1].id);
}
} else {
showSnackbar({
color: "error",
text: `[${pool}][${gachaRes.retcode}] ${gachaRes.message}`,
});
}
}
Expand Down

0 comments on commit 4e23970

Please sign in to comment.