From 2ac29e13c3e43144b9a0796e221d6986fca624e4 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Mon, 4 Sep 2023 19:25:23 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=95=B0=E6=8D=AE=E8=8E=B7=E5=8F=96=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/common/Config.vue | 18 ++++++++++++------ src/web/request/getUserInfo.ts | 6 +++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/pages/common/Config.vue b/src/pages/common/Config.vue index 031edd9d..22d113de 100644 --- a/src/pages/common/Config.vue +++ b/src/pages/common/Config.vue @@ -50,7 +50,7 @@ 系统信息 @@ -186,7 +186,13 @@ const buildTime = computed(() => appStore.buildTime); // About OS const osPlatform = ref(""); const osVersion = ref(""); -const dbInfo = ref>([]); +const dbInfo = ref< + Array<{ + key: string; + value: string; + updated: string; + }> +>([]); // loading const loading = ref(true); @@ -295,13 +301,13 @@ async function confirmRefreshUser(): Promise { } await TGSqlite.saveAppData("cookie", JSON.stringify(ck)); const infoRes = await TGRequest.User.byCookie.getUserInfo(ck.cookie_token, ck.account_id); - if ("nickname" in infoRes) { - userStore.setBriefInfo(infoRes); - loadingTitle.value = "获取成功!正在获取用户游戏账号信息"; - } else { + if ("retcode" in infoRes) { console.error(infoRes); loadingTitle.value = "获取失败!正在获取用户游戏账号信息"; failCount++; + } else { + userStore.setBriefInfo(infoRes); + loadingTitle.value = "获取成功!正在获取用户游戏账号信息"; } const accountRes = await TGRequest.User.byCookie.getAccounts(ck.cookie_token, ck.account_id); if (Array.isArray(accountRes)) { diff --git a/src/web/request/getUserInfo.ts b/src/web/request/getUserInfo.ts index 84bb5ea2..9e6db9df 100644 --- a/src/web/request/getUserInfo.ts +++ b/src/web/request/getUserInfo.ts @@ -2,7 +2,7 @@ * @file web request getUserInfo.ts * @description 获取用户信息请求 * @author BTMuli - * @since Alpha v0.2.2 + * @since Beta v0.3.0 */ // tauri @@ -14,7 +14,7 @@ import TGUtils from "../utils/TGUtils"; /** * @description 根据 cookie 获取用户信息 - * @since Alpha v0.2.2 + * @since Beta v0.3.0 * @param {string} cookie_token cookie token * @param {string} account_id 用户 account_id * @returns {Promise} @@ -29,7 +29,7 @@ export async function getUserInfoByCookie( }; const url = TGApi.GameData.byCookie.getUserInfo; const params = { gids: "2" }; - const header = TGUtils.User.getSignHeader(cookie, "GET", {}, "common"); + const header = TGUtils.User.getHeader(cookie, "GET", {}, "common", true); return await http .fetch(url, { method: "GET",