mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file web/request/getGameAccounts.ts
|
||||
* @description 获取游戏账号信息相关请求函数
|
||||
* @since Beta v0.5.0
|
||||
* @since Beta v0.6.0
|
||||
*/
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
@@ -14,12 +14,12 @@ import TGUtils from "../utils/TGUtils.js";
|
||||
* @since Alpha v0.1.5
|
||||
* @param {string} stoken stoken
|
||||
* @param {string} stuid 登录用户 uid
|
||||
* @returns {Promise<TGApp.User.Game.Account[]|TGApp.BBS.Response.Base>}
|
||||
* @returns {Promise<TGApp.BBS.Account.GameAccount[]|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getGameAccountsBySToken(
|
||||
stoken: string,
|
||||
stuid: string,
|
||||
): Promise<TGApp.User.Account.Game[] | TGApp.BBS.Response.Base> {
|
||||
): Promise<TGApp.BBS.Account.GameAccount[] | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.bySToken.getAccounts;
|
||||
const cookie = { stuid, stoken };
|
||||
const params = { stoken, stuid, game_biz: TGConstant.Utils.GAME_BIZ };
|
||||
@@ -31,12 +31,12 @@ export async function getGameAccountsBySToken(
|
||||
* @since Alpha v0.1.5
|
||||
* @param {string} cookie_token cookie_token
|
||||
* @param {string} account_id 游戏账号 id
|
||||
* @returns {Promise<TGApp.User.Account.Game[]|TGApp.BBS.Response.Base>}
|
||||
* @returns {Promise<TGApp.BBS.Account.GameAccount[]|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getGameAccountsByCookie(
|
||||
cookie_token: string,
|
||||
account_id: string,
|
||||
): Promise<TGApp.User.Account.Game[] | TGApp.BBS.Response.Base> {
|
||||
): Promise<TGApp.BBS.Account.GameAccount[] | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.byCookie.getAccounts;
|
||||
const cookie = { account_id, cookie_token };
|
||||
const params = { game_biz: TGConstant.Utils.GAME_BIZ };
|
||||
@@ -49,15 +49,15 @@ export async function getGameAccountsByCookie(
|
||||
* @param {string} url 请求地址
|
||||
* @param {Record<string, string>} cookie cookie
|
||||
* @param {Record<string, string>} params 请求参数
|
||||
* @returns {Promise<TGApp.User.Account.Game[]|TGApp.BBS.Response.Base>}
|
||||
* @returns {Promise<TGApp.BBS.Account.GameAccount[]|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
async function getGameAccounts(
|
||||
url: string,
|
||||
cookie: Record<string, string>,
|
||||
params: Record<string, string>,
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.User.Account.Game[]> {
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.BBS.Account.GameAccount[]> {
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.User.Account.GameResponse | TGApp.BBS.Response.Base>(url, {
|
||||
const resp = await TGHttp<TGApp.BBS.Response.getGameAccounts | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
|
||||
Reference in New Issue
Block a user