Skip to content

Commit

Permalink
♻️ 完善报错,默认刷新两期 #48
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Oct 5, 2023
1 parent e974f30 commit fe1f165
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/pages/User/Abyss.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,31 @@ async function getAbyssData(): Promise<void> {
ltoken: abyssCookie.ltoken,
ltuid: abyssCookie.ltuid,
};
if (localAbyssID.value.length < 2) {
loadingTitle.value = "正在获取上期深渊数据";
const resP = await TGRequest.User.byCookie.getAbyss(cookie, "2", user.value);
if (!("retcode" in resP)) {
loadingTitle.value = "正在保存上期深渊数据";
await TGSqlite.saveAbyss(user.value.gameUid, resP);
}
loadingTitle.value = "正在获取上期深渊数据";
const resP = await TGRequest.User.byCookie.getAbyss(cookie, "2", user.value);
if (!("retcode" in resP)) {
loadingTitle.value = "正在保存上期深渊数据";
await TGSqlite.saveAbyss(user.value.gameUid, resP);
} else {
showSnackbar({
text: `[${resP.retcode}]${resP.message}`,
color: "error",
});
loading.value = false;
return;
}
loadingTitle.value = "正在获取本期深渊数据";
const res = await TGRequest.User.byCookie.getAbyss(cookie, "1", user.value);
if (!("retcode" in res)) {
loadingTitle.value = "正在保存本期深渊数据";
await TGSqlite.saveAbyss(user.value.gameUid, res);
} else {
showSnackbar({
text: `[${res.retcode}]${res.message}`,
color: "error",
});
loading.value = false;
return;
}
loadingTitle.value = "正在加载深渊数据";
await initAbyssData();
Expand Down

0 comments on commit fe1f165

Please sign in to comment.