From b09097dd3c5682daf535e5efa2d867df82f480e7 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Tue, 14 Apr 2026 21:46:52 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=E8=BF=81=E7=A7=BBrecordRe?= =?UTF-8?q?q?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pageHome/ph-comp-daily-note.vue | 51 ++++---- src/components/userGacha/ug-his-card.vue | 4 +- src/pages/User/Abyss.vue | 103 ++++++++++----- src/pages/User/Challenge.vue | 49 +++++--- src/pages/User/Characters.vue | 66 ++++++---- src/pages/User/Combat.vue | 80 ++++++++---- src/request/recordReq.ts | 117 ++++++++---------- 7 files changed, 285 insertions(+), 185 deletions(-) diff --git a/src/components/pageHome/ph-comp-daily-note.vue b/src/components/pageHome/ph-comp-daily-note.vue index d45aebc2..7a615195 100644 --- a/src/components/pageHome/ph-comp-daily-note.vue +++ b/src/components/pageHome/ph-comp-daily-note.vue @@ -36,6 +36,7 @@ import recordReq from "@req/recordReq.js"; import TSUserAccount from "@Sqlm/userAccount.js"; import useAppStore from "@store/app.js"; import useUserStore from "@store/user.js"; +import TGHttps from "@utils/TGHttps.js"; import TGLogger from "@utils/TGLogger.js"; import { storeToRefs } from "pinia"; import { computed, onMounted, ref, watch } from "vue"; @@ -108,18 +109,20 @@ async function loadData(): Promise { loadingText.value = `正在加载 ${account.gameBiz} - ${account.regionName} - ${account.gameUid}...`; loadingProgress.value = (i / genshinAccounts.length) * 100; let data: TGApp.Game.DailyNote.DnRes | undefined; + let dataResp: TGApp.Game.DailyNote.DnResp | undefined; try { - const dataResp = await recordReq.daily(cookie.value, account); - console.debug("dailyResp", account, dataResp); + dataResp = await recordReq.daily(cookie.value, account); if (dataResp.retcode !== 0) { - await TGLogger.Error( - `[Daily Note Card] Failed to get daily note for ${account.gameBiz}: ${dataResp.message}`, + await TGLogger.Warn( + `[Daily Note Card] ${account.gameBiz}: [${dataResp.retcode}] ${dataResp.message}`, ); - } else data = dataResp.data; - } catch (error) { - await TGLogger.Error( - `[Daily Note Card] Error loading data for ${account.gameBiz}: ${error}`, - ); + } else { + data = dataResp.data; + } + } catch (e) { + const errMsg = TGHttps.getErrMsg(e); + await TGLogger.Error(`[Daily Note Card] ${account.gameBiz}: ${errMsg}`); + await TGLogger.Error(`[Daily Note Card] ${e}`); } dailyNoteAccounts.value.push({ account, data }); } @@ -140,24 +143,28 @@ async function handleUserSwitch(newUid: string): Promise { } async function handleRefresh(account: TGApp.Sqlite.Account.Game): Promise { + let dataResp: TGApp.Game.DailyNote.DnResp | undefined; try { - const dataResp = await recordReq.daily(cookie.value!, account); + dataResp = await recordReq.daily(cookie.value!, account); if (dataResp.retcode !== 0) { - await TGLogger.Error(`[Daily Note Card] Refresh failed: ${dataResp.message}`); - showSnackbar.error("刷新失败"); + await TGLogger.Warn(`[Daily Note Card] [${dataResp.retcode}] ${dataResp.message}`); + showSnackbar.error(`刷新失败:[${dataResp.retcode}] ${dataResp.message}`); return; } - const item = dailyNoteAccounts.value.find( - (i) => i.account.gameUid === account.gameUid && i.account.gameBiz === account.gameBiz, - ); - if (item) { - item.data = dataResp.data; - } - showSnackbar.success("刷新成功"); - } catch (error) { - await TGLogger.Error(`[Daily Note Card] Refresh error: ${error}`); - showSnackbar.error("刷新失败"); + } catch (e) { + const errMsg = TGHttps.getErrMsg(e); + await TGLogger.Error(`[Daily Note Card] 刷新失败:${errMsg}`); + await TGLogger.Error(`[Daily Note Card] ${e}`); + showSnackbar.error(`刷新失败:${errMsg}`); + return; } + const item = dailyNoteAccounts.value.find( + (i) => i.account.gameUid === account.gameUid && i.account.gameBiz === account.gameBiz, + ); + if (item) { + item.data = dataResp.data; + } + showSnackbar.success("刷新成功"); }