mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
🐛 修复用户数据获取异常
This commit is contained in:
@@ -186,7 +186,13 @@ const buildTime = computed(() => appStore.buildTime);
|
||||
// About OS
|
||||
const osPlatform = ref<string>("");
|
||||
const osVersion = ref<string>("");
|
||||
const dbInfo = ref<Array<{ key: string; value: string; updated: string }>>([]);
|
||||
const dbInfo = ref<
|
||||
Array<{
|
||||
key: string;
|
||||
value: string;
|
||||
updated: string;
|
||||
}>
|
||||
>([]);
|
||||
|
||||
// loading
|
||||
const loading = ref<boolean>(true);
|
||||
@@ -295,13 +301,13 @@ async function confirmRefreshUser(): Promise<void> {
|
||||
}
|
||||
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)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @file web request getUserInfo.ts
|
||||
* @description 获取用户信息请求
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @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<TGApp.App.Account.BriefInfo | TGApp.BBS.Response.Base>}
|
||||
@@ -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<TGApp.Plugins.Mys.User.HomeResponse>(url, {
|
||||
method: "GET",
|
||||
|
||||
Reference in New Issue
Block a user