mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
♻️ 感觉差不多了,剩下的就靠测试了 #92
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file web/request/TGRequest.ts
|
||||
* @description 应用用到的请求函数
|
||||
* @since Beta v0.4.5
|
||||
* @since Beta v0.5.0
|
||||
*/
|
||||
|
||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey.js";
|
||||
@@ -19,7 +19,6 @@ 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";
|
||||
@@ -38,9 +37,6 @@ const TGRequest = {
|
||||
getCollect: getUserCollect,
|
||||
getGachaLog,
|
||||
getRecord: getGameRecord,
|
||||
byLoginTicket: {
|
||||
getTokens: getTokensByLoginTicket,
|
||||
},
|
||||
byCookie: {
|
||||
getAbyss,
|
||||
getAccounts: getGameAccountsByCookie,
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* @file web/request/getTokens.ts
|
||||
* @description 获取游戏 Token
|
||||
* @since Beta v0.5.0
|
||||
*/
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
|
||||
/**
|
||||
* @description 根据 login_ticket 获取游戏 Token,包括 sToken 和 lToken
|
||||
* @since Beta v0.5.0
|
||||
* @param {string} ticket 登录票证
|
||||
* @param {string} uid 登录用户 uid
|
||||
* @returns {Promise<TGApp.BBS.Response.getTokensRes[] | TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
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 url = TGApi.GameTokens.getTokens;
|
||||
const params = { login_ticket: ticket, token_types: "3", uid };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.BBS.Response.getTokens | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
});
|
||||
console.log(resp);
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
return resp.data.list;
|
||||
}
|
||||
Reference in New Issue
Block a user