mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-19 10:23:21 +08:00
♻️ types 重构后的问题搞完了,累死
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @file web request getGameAccounts.ts
|
||||
* @description 获取游戏账号信息相关请求函数
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.0
|
||||
* @since Alpha v0.1.5
|
||||
*/
|
||||
|
||||
// tauri
|
||||
@@ -15,12 +15,12 @@ import TGConstant from "../constant/TGConstant";
|
||||
|
||||
/**
|
||||
* @description 通过 stoken 获取游戏账号
|
||||
* @since Alpha v0.2.0
|
||||
* @since Alpha v0.1.5
|
||||
* @param {string} stoken stoken
|
||||
* @param {string} stuid 登录用户 uid
|
||||
* @returns {Promise<BTMuli.User.Game.Account[]|BTMuli.Genshin.Base.Response>}
|
||||
* @returns {Promise<TGApp.User.Game.Account[]|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getGameAccountsBySToken (stoken: string, stuid: string): Promise<BTMuli.User.Game.Account[] | BTMuli.Genshin.Base.Response> {
|
||||
export async function getGameAccountsBySToken (stoken: string, stuid: string): Promise<TGApp.User.Account.Game[] | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.bySToken.getAccounts;
|
||||
const cookie = {
|
||||
stuid,
|
||||
@@ -32,12 +32,12 @@ export async function getGameAccountsBySToken (stoken: string, stuid: string): P
|
||||
|
||||
/**
|
||||
* @description 通过 cookie 获取游戏账号
|
||||
* @since Alpha v0.2.0
|
||||
* @since Alpha v0.1.5
|
||||
* @param {string} cookie_token cookie_token
|
||||
* @param {string} account_id 游戏账号 id
|
||||
* @returns {Promise<BTMuli.User.Game.Account[]|BTMuli.Genshin.Base.Response>}
|
||||
* @returns {Promise<TGApp.User.Account.Game[]|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getGameAccountsByCookie (cookie_token: string, account_id: string): Promise<BTMuli.User.Game.Account[] | BTMuli.Genshin.Base.Response> {
|
||||
export async function getGameAccountsByCookie (cookie_token: string, account_id: string): Promise<TGApp.User.Account.Game[] | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.byCookie.getAccounts;
|
||||
const cookie = {
|
||||
account_id,
|
||||
@@ -53,14 +53,14 @@ export async function getGameAccountsByCookie (cookie_token: string, account_id:
|
||||
* @param {string} url 请求地址
|
||||
* @param {Record<string, string>} cookie cookie
|
||||
* @param {Record<string, string>} params 请求参数
|
||||
* @returns {Promise<BTMuli.User.Game.Account[]|BTMuli.Genshin.Base.Response>}
|
||||
* @returns {Promise<TGApp.User.Account.Game[]|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
async function getGameAccounts (url: string, cookie: Record<string, string>, params: Record<string, string>): Promise<BTMuli.User.Game.Account[] | BTMuli.Genshin.Base.Response> {
|
||||
async function getGameAccounts (url: string, cookie: Record<string, string>, params: Record<string, string>): Promise<TGApp.BBS.Response.Base | TGApp.User.Account.Game[]> {
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http.fetch<BTMuli.User.Response.GameAccounts>(url, {
|
||||
return await http.fetch<TGApp.User.Account.GameResponse>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
body: http.Body.json(params),
|
||||
query: params,
|
||||
}).then(res => {
|
||||
if (res.data.retcode !== 0) return res.data;
|
||||
return res.data.data.list;
|
||||
|
||||
Reference in New Issue
Block a user