mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
✏️ 根据实际请求修正参数
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
* @since Beta v0.5.3
|
||||
*/
|
||||
|
||||
import { app } from "@tauri-apps/api";
|
||||
|
||||
import TGHttp from "../../utils/TGHttp.js";
|
||||
import TGApi from "../api/TGApi.js";
|
||||
import TGUtils from "../utils/TGUtils.js";
|
||||
@@ -23,12 +21,7 @@ export async function getAvatarList(
|
||||
): Promise<TGApp.Game.Avatar.Avatar[] | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.byCookie.getAvatarList;
|
||||
const data = { uid, region: TGUtils.Tools.getServerByUid(uid) };
|
||||
const version = await app.getVersion();
|
||||
const header = {
|
||||
"User-Agent": `TeyvatGuide/${version}`,
|
||||
Referer: "https://webstatic.mihoyo.com/",
|
||||
Cookie: TGUtils.Tools.transCookie(cookie),
|
||||
};
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
|
||||
const resp = await TGHttp<TGApp.Game.Avatar.ListResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
@@ -43,22 +36,21 @@ export async function getAvatarList(
|
||||
* @since Beta v0.5.3
|
||||
* @param {Record<string, string>} cookie Cookie
|
||||
* @param {string} uid 用户 uid
|
||||
* @param {number} avatarId 角色 id
|
||||
* @param {string[]} avatarIds 角色 id 列表
|
||||
* @return {Promise<TGApp.Game.Avatar.AvatarDetail|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getAvatarDetail(
|
||||
cookie: Record<string, string>,
|
||||
uid: string,
|
||||
avatarId: number,
|
||||
avatarIds: string[],
|
||||
): Promise<TGApp.Game.Avatar.AvatarDetail | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.byCookie.getAvatarDetail;
|
||||
const params = { uid, region: TGUtils.Tools.getServerByUid(uid), avatar_id: avatarId };
|
||||
const version = await app.getVersion();
|
||||
const header = {
|
||||
"User-Agent": `TeyvatGuide/${version}`,
|
||||
Referer: "https://webstatic.mihoyo.com/",
|
||||
Cookie: TGUtils.Tools.transCookie(cookie),
|
||||
const params = {
|
||||
role_id: uid,
|
||||
server: TGUtils.Tools.getServerByUid(uid),
|
||||
character_ids: avatarIds,
|
||||
};
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
const resp = await TGHttp<TGApp.Game.Avatar.DetailResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
query: params,
|
||||
|
||||
Reference in New Issue
Block a user