mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
✏️ 继续修正 import
This commit is contained in:
@@ -4,25 +4,25 @@
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey";
|
||||
import { getAbyss } from "./getAbyss";
|
||||
import { getActionTicketBySToken } from "./getActionTicket";
|
||||
import { getAnnoContent, getAnnoList } from "./getAnno";
|
||||
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken";
|
||||
import { getDeviceFp } from "./getDeviceFp";
|
||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey.js";
|
||||
import { getAbyss } from "./getAbyss.js";
|
||||
import { getActionTicketBySToken } from "./getActionTicket.js";
|
||||
import { getAnnoContent, getAnnoList } from "./getAnno.js";
|
||||
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken.js";
|
||||
import { getDeviceFp } from "./getDeviceFp.js";
|
||||
// import * from "./getEnkaData.ts";
|
||||
import { getGachaLog } from "./getGachaLog";
|
||||
import { getGameAccountsByCookie, getGameAccountsBySToken } from "./getGameAccounts";
|
||||
import { getGameRecord } from "./getGameRecord";
|
||||
import { getLTokenBySToken } from "./getLToken";
|
||||
import { getGameRoleListByLToken } from "./getRoleList";
|
||||
import { getStokenByGameToken, getTokenBySToken } from "./getStoken";
|
||||
import getSyncAvatarDetail from "./getSyncAvatarDetail";
|
||||
import getSyncAvatarListAll from "./getSyncAvatarListAll";
|
||||
import { getTokensByLoginTicket } from "./getTokens";
|
||||
import { getUserCollect } from "./getUserCollect";
|
||||
import { getUserInfoByCookie } from "./getUserInfo";
|
||||
import { verifyLToken } from "./verifyLToken";
|
||||
import { getGachaLog } from "./getGachaLog.js";
|
||||
import { getGameAccountsByCookie, getGameAccountsBySToken } from "./getGameAccounts.js";
|
||||
import { getGameRecord } from "./getGameRecord.js";
|
||||
import { getLTokenBySToken } from "./getLToken.js";
|
||||
import { getGameRoleListByLToken } from "./getRoleList.js";
|
||||
import { getStokenByGameToken, getTokenBySToken } from "./getStoken.js";
|
||||
import getSyncAvatarDetail from "./getSyncAvatarDetail.js";
|
||||
import getSyncAvatarListAll from "./getSyncAvatarListAll.js";
|
||||
import { getTokensByLoginTicket } from "./getTokens.js";
|
||||
import { getUserCollect } from "./getUserCollect.js";
|
||||
import { getUserInfoByCookie } from "./getUserInfo.js";
|
||||
import { verifyLToken } from "./verifyLToken.js";
|
||||
|
||||
const TGRequest = {
|
||||
Anno: {
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import { Response } from "@tauri-apps/api/http";
|
||||
|
||||
import TGApi from "../api/TGApi";
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
|
||||
/**
|
||||
* @description 根据 login_ticket 获取游戏 Token,包括 stoken 和 ltoken
|
||||
* @description 根据 login_ticket 获取游戏 Token,包括 sToken 和 lToken
|
||||
* @since Beta v0.4.3
|
||||
* @param {string} ticket 登录票证
|
||||
* @param {string} uid 登录用户 uid
|
||||
@@ -20,23 +21,15 @@ export async function getTokensByLoginTicket(
|
||||
ticket: string,
|
||||
uid: string,
|
||||
): Promise<TGApp.BBS.Response.getTokensRes[] | TGApp.BBS.Response.Base> {
|
||||
const cookie = {
|
||||
login_ticket: ticket,
|
||||
login_uid: uid,
|
||||
};
|
||||
const cookie = { login_ticket: ticket, login_uid: uid };
|
||||
const url = TGApi.GameTokens.getTokens;
|
||||
|
||||
const params = { login_ticket: ticket, token_types: "3", uid };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.getTokens | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
.fetch(url, { method: "GET", headers: header, query: params })
|
||||
.then((res: Response<TGApp.BBS.Response.getTokens | TGApp.BBS.Response.Base>) => {
|
||||
console.log(res);
|
||||
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
|
||||
if (res.data.retcode !== 0) return res.data;
|
||||
return res.data.data.list;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import type { Response } from "@tauri-apps/api/http";
|
||||
|
||||
import TGApi from "../api/TGApi";
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
|
||||
/**
|
||||
* @description 根据 cookie 获取用户信息
|
||||
@@ -28,12 +29,8 @@ export async function getUserInfoByCookie(
|
||||
const params = { gids: "2" };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common", true);
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
.fetch(url, { method: "GET", headers: header, query: params })
|
||||
.then((res: Response<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>) => {
|
||||
if (res.data.retcode !== 0) return res.data;
|
||||
return res.data.data.user_info;
|
||||
});
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import type { Response } from "@tauri-apps/api/http";
|
||||
|
||||
import TGApi from "../api/TGApi";
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
|
||||
/**
|
||||
* @description 验证 ltoken 有效性,返回 mid
|
||||
@@ -21,20 +22,13 @@ export async function verifyLToken(
|
||||
ltuid: string,
|
||||
): Promise<string | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameTokens.verifyLToken;
|
||||
const cookie = {
|
||||
ltoken,
|
||||
ltuid,
|
||||
};
|
||||
const cookie = { ltoken, ltuid };
|
||||
const data = { ltoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
body: http.Body.json(data),
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.retcode !== 0) return res.data;
|
||||
.fetch(url, { method: "POST", headers: header, body: http.Body.json(data) })
|
||||
.then((res: Response<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>) => {
|
||||
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
|
||||
return res.data.data.user_info.mid;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user