mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-02 06:45:08 +08:00
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file plugins/Mys/utils/doGameLogin
|
||||
* @description 获取 gameToken,曲线获取 stoken
|
||||
* @since Beta v0.4.3
|
||||
* @since Beta v0.4.4
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
@@ -9,9 +9,11 @@ import { http } from "@tauri-apps/api";
|
||||
import { getDeviceInfo } from "../../../utils/toolFunc";
|
||||
import { getRequestHeader } from "../../../web/utils/getRequestHeader";
|
||||
|
||||
const APP_ID = 8;
|
||||
|
||||
/**
|
||||
* @description 获取登录二维码
|
||||
* @since Beta v0.4.3
|
||||
* @since Beta v0.4.4
|
||||
* @returns {Promise<TGApp.Plugins.Mys.GameLogin.GetLoginQrData|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getLoginQr(): Promise<
|
||||
@@ -20,7 +22,7 @@ export async function getLoginQr(): Promise<
|
||||
const url = "https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/fetch";
|
||||
const device = getDeviceInfo("device_id");
|
||||
const data = {
|
||||
app_id: "4",
|
||||
app_id: APP_ID,
|
||||
device,
|
||||
};
|
||||
const header = getRequestHeader({}, "POST", data, "common");
|
||||
@@ -38,7 +40,7 @@ export async function getLoginQr(): Promise<
|
||||
|
||||
/**
|
||||
* @description 获取登录状态
|
||||
* @since Beta v0.4.3
|
||||
* @since Beta v0.4.4
|
||||
* @param {string} ticket 二维码 ticket
|
||||
* @returns {Promise<TGApp.Plugins.Mys.GameLogin.GetLoginStatusData | TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
@@ -47,7 +49,7 @@ export async function getLoginStatus(
|
||||
): Promise<TGApp.Plugins.Mys.GameLogin.GetLoginStatusData | TGApp.BBS.Response.Base> {
|
||||
const url = "https://hk4e-sdk.mihoyo.com/hk4e_cn/combo/panda/qrcode/query";
|
||||
const device = getDeviceInfo("device_id");
|
||||
const data = { app_id: "4", device, ticket };
|
||||
const data = { app_id: APP_ID, device, ticket };
|
||||
const header = getRequestHeader({}, "POST", data, "common");
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.GameLogin.GetLoginStatusResponse | TGApp.BBS.Response.Base>(url, {
|
||||
|
||||
25
src/plugins/Mys/types/GameLogin.d.ts
vendored
25
src/plugins/Mys/types/GameLogin.d.ts
vendored
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/GameLogin.d.ts
|
||||
* @description Mys 插件 Game 登录类型定义文件
|
||||
* @since Beta v0.4.3
|
||||
* @since Beta v0.4.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Mys 插件 Game 登录类型
|
||||
* @since Beta v0.4.3
|
||||
* @since Beta v0.4.4
|
||||
* @namespace TGApp.Plugins.Mys.GameLogin
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
@@ -76,14 +76,27 @@ declare namespace TGApp.Plugins.Mys.GameLogin {
|
||||
|
||||
/**
|
||||
* @description 反序列化后的登录状态数据
|
||||
* @since Beta v0.4.3
|
||||
* @interface StatusPayloadRaw
|
||||
* @since Beta v0.4.4
|
||||
* @interface StatusPayloadRawOpen
|
||||
* @property {string} uid 用户 UID
|
||||
* @property {string} token 用户 token
|
||||
* @return StatusPayloadRaw
|
||||
* @return StatusPayloadRawOpen
|
||||
*/
|
||||
interface StatusPayloadRaw {
|
||||
interface StatusPayloadRawOpen {
|
||||
open_id: string;
|
||||
open_token: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 反序列化后的登录状态数据
|
||||
* @since Beta v0.4.4
|
||||
* @interface StatusPayloadRawAccount
|
||||
* @property {string} uid 用户 UID
|
||||
* @property {string} token 用户 token
|
||||
* @return StatusPayloadRawOpen
|
||||
*/
|
||||
interface StatusPayloadRawAccount {
|
||||
uid: string;
|
||||
token: string;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user