mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
🏷️ 完善 getActionTicket 类型
This commit is contained in:
74
src/types/BBS/Account.d.ts
vendored
74
src/types/BBS/Account.d.ts
vendored
@@ -1,10 +1,15 @@
|
|||||||
/**
|
/**
|
||||||
* @file types BBS Account.d.ts
|
* @file types/BBS/Account.d.ts
|
||||||
* @description BBS 账户相关类型定义文件
|
* @description BBS 账户相关类型定义文件
|
||||||
* @author BTMuli<bt-muli@outlook.com>
|
* @since Beta v0.3.4
|
||||||
* @since Beta v0.3.0
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 米游社账户信息
|
||||||
|
* @since Beta v0.3.4
|
||||||
|
* @namespace TGApp.BBS.Account
|
||||||
|
* @memberof TGApp.BBS
|
||||||
|
*/
|
||||||
declare namespace TGApp.BBS.Account {
|
declare namespace TGApp.BBS.Account {
|
||||||
/**
|
/**
|
||||||
* @description stoken 验证获取的用户信息
|
* @description stoken 验证获取的用户信息
|
||||||
@@ -25,7 +30,7 @@ declare namespace TGApp.BBS.Account {
|
|||||||
* @property {unknown[]} links 账号绑定信息
|
* @property {unknown[]} links 账号绑定信息
|
||||||
* @return VerifySTokenInfo
|
* @return VerifySTokenInfo
|
||||||
*/
|
*/
|
||||||
export interface VerifySTokenInfo {
|
interface VerifySTokenInfo {
|
||||||
aid: string;
|
aid: string;
|
||||||
mid: string;
|
mid: string;
|
||||||
account_name: string;
|
account_name: string;
|
||||||
@@ -63,7 +68,7 @@ declare namespace TGApp.BBS.Account {
|
|||||||
* @property {string} country 国家
|
* @property {string} country 国家
|
||||||
* @return getStokenByGameTokenInfo
|
* @return getStokenByGameTokenInfo
|
||||||
*/
|
*/
|
||||||
export interface getStokenByGameTokenInfo {
|
interface getStokenByGameTokenInfo {
|
||||||
aid: string;
|
aid: string;
|
||||||
mid: string;
|
mid: string;
|
||||||
account_name: string;
|
account_name: string;
|
||||||
@@ -81,4 +86,63 @@ declare namespace TGApp.BBS.Account {
|
|||||||
links: unknown[];
|
links: unknown[];
|
||||||
country: string;
|
country: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 通过 sToken 获取 actionTicket 返回数据里的用户信息
|
||||||
|
* @interface getActionTicketBySTokenInfo
|
||||||
|
* @since Beta v0.3.4
|
||||||
|
* @property {boolean} is_realname 是否实名认证
|
||||||
|
* @property {string} mobile 手机号
|
||||||
|
* @property {string} safe_mobile 安全手机号
|
||||||
|
* @property {string} account_id 账号 id
|
||||||
|
* @property {string} account_name 账号名称
|
||||||
|
* @property {string} email 邮箱
|
||||||
|
* @property {boolean} is_email_verify 是否验证邮箱
|
||||||
|
* @property {string} area_code 手机区号
|
||||||
|
* @property {string} safe_area_code 安全手机区号
|
||||||
|
* @property {string} real_name 真实姓名
|
||||||
|
* @property {string} identity_code 身份证号
|
||||||
|
* @property {string} create_time 创建时间
|
||||||
|
* @property {string} create_ip 创建 ip
|
||||||
|
* @property {string} change_pwd_time 修改密码时间
|
||||||
|
* @property {string} nickname 昵称
|
||||||
|
* @property {number} user_icon_id 用户头像 id
|
||||||
|
* @property {number} safe_level 安全等级
|
||||||
|
* @property {string} black_endtime 黑名单结束时间
|
||||||
|
* @property {string} black_note 黑名单备注
|
||||||
|
* @property {number} gender 性别
|
||||||
|
* @property {number} real_stat 实名状态
|
||||||
|
* @property {string} apple_name 苹果账号名称
|
||||||
|
* @property {string} sony_name 索尼账号名称
|
||||||
|
* @property {string} tap_name tap 账号名称
|
||||||
|
* @property {string} reactivate_ticket 重新激活 ticket
|
||||||
|
* @return getActionTicketBySTokenInfo
|
||||||
|
*/
|
||||||
|
interface getActionTicketBySTokenInfo {
|
||||||
|
is_realname: boolean;
|
||||||
|
mobile: string;
|
||||||
|
safe_mobile: string;
|
||||||
|
account_id: string;
|
||||||
|
account_name: string;
|
||||||
|
email: string;
|
||||||
|
is_email_verify: boolean;
|
||||||
|
area_code: string;
|
||||||
|
safe_area_code: string;
|
||||||
|
real_name: string;
|
||||||
|
identity_code: string;
|
||||||
|
create_time: string;
|
||||||
|
create_ip: string;
|
||||||
|
change_pwd_time: string;
|
||||||
|
nickname: string;
|
||||||
|
user_icon_id: number;
|
||||||
|
safe_level: number;
|
||||||
|
black_endtime: string;
|
||||||
|
black_note: string;
|
||||||
|
gender: number;
|
||||||
|
real_stat: number;
|
||||||
|
apple_name: string;
|
||||||
|
sony_name: string;
|
||||||
|
tap_name: string;
|
||||||
|
reactivate_ticket: string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
47
src/types/BBS/Response.d.ts
vendored
47
src/types/BBS/Response.d.ts
vendored
@@ -1,10 +1,15 @@
|
|||||||
/**
|
/**
|
||||||
* @file types BBS Tokens.d.ts
|
* @file types/BBS/Response.d.ts
|
||||||
* @description BBS 返回数据类型定义文件
|
* @description BBS 返回数据类型定义文件
|
||||||
* @author BTMuli< bt-muli@outlook.com>
|
* @since Beta v0.3.4
|
||||||
* @since Beta v0.3.0
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description BBS 返回数据类型定义
|
||||||
|
* @since Beta v0.3.4
|
||||||
|
* @namespace TGApp.BBS.Response
|
||||||
|
* @memberof TGApp.BBS
|
||||||
|
*/
|
||||||
declare namespace TGApp.BBS.Response {
|
declare namespace TGApp.BBS.Response {
|
||||||
/**
|
/**
|
||||||
* @description 基础返回类型,设计米游社接口请求都是这个类型
|
* @description 基础返回类型,设计米游社接口请求都是这个类型
|
||||||
@@ -15,7 +20,7 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {any} data - 响应数据
|
* @property {any} data - 响应数据
|
||||||
* @return Base
|
* @return Base
|
||||||
*/
|
*/
|
||||||
export interface Base {
|
interface Base {
|
||||||
retcode: number;
|
retcode: number;
|
||||||
message: string;
|
message: string;
|
||||||
data: any;
|
data: any;
|
||||||
@@ -29,7 +34,7 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {string} token - token 值
|
* @property {string} token - token 值
|
||||||
* @return getTokensRes
|
* @return getTokensRes
|
||||||
*/
|
*/
|
||||||
export interface getTokensRes {
|
interface getTokensRes {
|
||||||
name: string;
|
name: string;
|
||||||
token: string;
|
token: string;
|
||||||
}
|
}
|
||||||
@@ -42,7 +47,7 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {getTokensRes[]} data.list - token 列表
|
* @property {getTokensRes[]} data.list - token 列表
|
||||||
* @return getTokens
|
* @return getTokens
|
||||||
*/
|
*/
|
||||||
export interface getTokens extends Base {
|
interface getTokens extends Base {
|
||||||
data: {
|
data: {
|
||||||
list: getTokensRes[];
|
list: getTokensRes[];
|
||||||
};
|
};
|
||||||
@@ -56,7 +61,7 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {string} data.ltoken - ltoken 值
|
* @property {string} data.ltoken - ltoken 值
|
||||||
* @return getLTokenBySToken
|
* @return getLTokenBySToken
|
||||||
*/
|
*/
|
||||||
export interface getLTokenBySToken extends Base {
|
interface getLTokenBySToken extends Base {
|
||||||
data: {
|
data: {
|
||||||
ltoken: string;
|
ltoken: string;
|
||||||
};
|
};
|
||||||
@@ -71,7 +76,7 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {string} data.cookie_token - cookie_token 值
|
* @property {string} data.cookie_token - cookie_token 值
|
||||||
* @return getCookieTokenBySToken
|
* @return getCookieTokenBySToken
|
||||||
*/
|
*/
|
||||||
export interface getCookieTokenBySToken extends Base {
|
interface getCookieTokenBySToken extends Base {
|
||||||
data: {
|
data: {
|
||||||
uid: string;
|
uid: string;
|
||||||
cookie_token: string;
|
cookie_token: string;
|
||||||
@@ -88,7 +93,7 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {boolean} data.need_realperson - 是否需要实名认证
|
* @property {boolean} data.need_realperson - 是否需要实名认证
|
||||||
* @return verifyUserInfoBySToken
|
* @return verifyUserInfoBySToken
|
||||||
*/
|
*/
|
||||||
export interface verifyUserInfoBySToken extends Base {
|
interface verifyUserInfoBySToken extends Base {
|
||||||
data: {
|
data: {
|
||||||
user_info: TGApp.BBS.Account.VerifySTokenInfo;
|
user_info: TGApp.BBS.Account.VerifySTokenInfo;
|
||||||
realname_info: unknown;
|
realname_info: unknown;
|
||||||
@@ -104,7 +109,7 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {getStokenByGameTokenData} data - 返回数据
|
* @property {getStokenByGameTokenData} data - 返回数据
|
||||||
* @return getStokenByGameToken
|
* @return getStokenByGameToken
|
||||||
*/
|
*/
|
||||||
export interface getStokenByGameToken extends Base {
|
interface getStokenByGameToken extends Base {
|
||||||
data: getStokenByGameTokenData;
|
data: getStokenByGameTokenData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +124,7 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {boolean} need_realperson - 是否需要实名认证
|
* @property {boolean} need_realperson - 是否需要实名认证
|
||||||
* @return getStokenByGameToken
|
* @return getStokenByGameToken
|
||||||
*/
|
*/
|
||||||
export interface getStokenByGameTokenData {
|
interface getStokenByGameTokenData {
|
||||||
token: {
|
token: {
|
||||||
token_type: number;
|
token_type: number;
|
||||||
token: string;
|
token: string;
|
||||||
@@ -138,10 +143,28 @@ declare namespace TGApp.BBS.Response {
|
|||||||
* @property {string} data.cookie_token - cookie_token 值
|
* @property {string} data.cookie_token - cookie_token 值
|
||||||
* @return getCookieTokenByGameToken
|
* @return getCookieTokenByGameToken
|
||||||
*/
|
*/
|
||||||
export interface getCookieTokenByGameToken extends Base {
|
interface getCookieTokenByGameToken extends Base {
|
||||||
data: {
|
data: {
|
||||||
uid: string;
|
uid: string;
|
||||||
cookie_token: string;
|
cookie_token: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 通过 sToken 获取 actionTicket 的返回类型
|
||||||
|
* @interface getActionTicketBySToken
|
||||||
|
* @since Beta v0.3.4
|
||||||
|
* @extends Base
|
||||||
|
* @property {string} data.ticket - actionTicket 值
|
||||||
|
* @property {boolean} data.is_verified - 是否验证
|
||||||
|
* @property {TGApp.BBS.Account.getActionTicketBySTokenInfo} data.account_info - 用户信息
|
||||||
|
* @return getActionTicketBySToken
|
||||||
|
*/
|
||||||
|
interface getActionTicketBySToken extends Base {
|
||||||
|
data: {
|
||||||
|
ticket: string;
|
||||||
|
is_verified: boolean;
|
||||||
|
account_info: TGApp.BBS.Account.getActionTicketBySTokenInfo;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,19 +11,18 @@ import TGUtils from "../utils/TGUtils";
|
|||||||
/**
|
/**
|
||||||
* @description 通过 stoken 获取 ActionTicket
|
* @description 通过 stoken 获取 ActionTicket
|
||||||
* @since Beta v0.3.4
|
* @since Beta v0.3.4
|
||||||
* @todo 类型完善
|
|
||||||
* @param {string} ActionType 动作类型
|
* @param {string} ActionType 动作类型
|
||||||
* @param {string} SToken stoken
|
* @param {string} SToken stoken
|
||||||
* @param {string} MID 用户 MID
|
* @param {string} MID 用户 MID
|
||||||
* @param {string} UID 用户 UID
|
* @param {string} UID 用户 UID
|
||||||
* @returns {Promise<TGApp.BBS.Response.Base>}
|
* @returns {Promise<TGApp.BBS.Response.getActionTicketBySToken>}
|
||||||
*/
|
*/
|
||||||
export async function getActionTicketBySToken(
|
export async function getActionTicketBySToken(
|
||||||
ActionType: string,
|
ActionType: string,
|
||||||
SToken: string,
|
SToken: string,
|
||||||
MID: string,
|
MID: string,
|
||||||
UID: string,
|
UID: string,
|
||||||
): Promise<TGApp.BBS.Response.Base> {
|
): Promise<TGApp.BBS.Response.getActionTicketBySToken> {
|
||||||
const url = "https://api-takumi.mihoyo.com/auth/api/getActionTicketBySToken";
|
const url = "https://api-takumi.mihoyo.com/auth/api/getActionTicketBySToken";
|
||||||
const params = {
|
const params = {
|
||||||
action_type: ActionType,
|
action_type: ActionType,
|
||||||
@@ -36,7 +35,7 @@ export async function getActionTicketBySToken(
|
|||||||
};
|
};
|
||||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "k2");
|
const header = TGUtils.User.getHeader(cookie, "GET", params, "k2");
|
||||||
return await http
|
return await http
|
||||||
.fetch<TGApp.BBS.Response.Base>(url, {
|
.fetch<TGApp.BBS.Response.getActionTicketBySToken>(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: header,
|
headers: header,
|
||||||
query: params,
|
query: params,
|
||||||
|
|||||||
Reference in New Issue
Block a user