mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
@@ -1,13 +1,14 @@
|
||||
/**
|
||||
* @file web/request/TGRequest.ts
|
||||
* @description 应用用到的请求函数
|
||||
* @since Beta v0.5.3
|
||||
* @since Beta v0.6.0
|
||||
*/
|
||||
|
||||
import { genAuthkey, genAuthkey2 } from "./genAuthkey.js";
|
||||
import { getAbyss } from "./getAbyss.js";
|
||||
import { getActionTicketBySToken } from "./getActionTicket.js";
|
||||
import { getAnnoContent, getAnnoList } from "./getAnno.js";
|
||||
import getAuthTicket from "./getAuthTicket.js";
|
||||
import { getAvatarList, getAvatarDetail } from "./getAvatarDetail.js";
|
||||
import getCode from "./getCode.js";
|
||||
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken.js";
|
||||
@@ -35,6 +36,7 @@ const TGRequest = {
|
||||
User: {
|
||||
getAuthkey: genAuthkey,
|
||||
getAuthkey2: genAuthkey2,
|
||||
getAuthTicket,
|
||||
getCollect: getUserCollect,
|
||||
getGachaLog,
|
||||
getRecord: getGameRecord,
|
||||
|
||||
41
src/web/request/getAuthTicket.ts
Normal file
41
src/web/request/getAuthTicket.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @files web/request/getAuthTicket.ts
|
||||
* @description 获取登录 ticket
|
||||
* @since Beta v0.6.0
|
||||
*/
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
|
||||
/**
|
||||
* @description 获取登录ticket
|
||||
* @since Beta v0.6.0
|
||||
* @param {TGApp.Sqlite.Account.Game} account - 账户
|
||||
* @param {TGApp.App.Account.Cookie} cookie - cookie
|
||||
* @returns {Promise<TGApp.BBS.Response.Base|string>}
|
||||
*/
|
||||
async function getAuthTicket(
|
||||
account: TGApp.Sqlite.Account.Game,
|
||||
cookie: TGApp.App.Account.Cookie,
|
||||
): Promise<TGApp.BBS.Response.Base | string> {
|
||||
const url =
|
||||
"https://passport-api.mihoyo.com/account/ma-cn-verifier/app/createAuthTicketByGameBiz";
|
||||
const params = {
|
||||
game_biz: account.gameBiz,
|
||||
stoken: cookie.stoken,
|
||||
uid: account.gameUid,
|
||||
mid: cookie.mid,
|
||||
};
|
||||
const header = {
|
||||
"x-rpc-client_type": "3",
|
||||
"x-rpc-app_id": "ddxf5dufpuyo",
|
||||
};
|
||||
const resp = await TGHttp<TGApp.BBS.Response.getAuthTicketByGameBiz>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
query: params,
|
||||
});
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
return resp.data.ticket;
|
||||
}
|
||||
|
||||
export default getAuthTicket;
|
||||
Reference in New Issue
Block a user