前瞻兑换码查看

This commit is contained in:
目棃
2024-08-16 15:55:00 +08:00
parent 68f91035df
commit 9ee256c520
6 changed files with 178 additions and 64 deletions

View File

@@ -9,6 +9,7 @@ import { getAbyss } from "./getAbyss.js";
import { getActionTicketBySToken } from "./getActionTicket.js";
import { getAnnoContent, getAnnoList } from "./getAnno.js";
import { getAvatarList, getAvatarDetail } from "./getAvatarDetail.js";
import getCode from "./getCode.js";
import { getCookieTokenByGameToken, getCookieTokenBySToken } from "./getCookieToken.js";
import { getDeviceFp } from "./getDeviceFp.js";
import { getGachaLog } from "./getGachaLog.js";
@@ -64,6 +65,9 @@ const TGRequest = {
getSyncAvatarDetail,
},
},
Nav: {
getCode,
},
};
export default TGRequest;

View File

@@ -0,0 +1,28 @@
/**
* @file web/request/getCode.ts
* @description 获取兑换码相关请求
* @since Beta v0.5.3
*/
import TGHttp from "../../utils/TGHttp.js";
/**
* @description 获取兑换码请求
* @since Beta v0.5.3
* @param {string} act_id - 活动 id
* @return {Promise<TGApp.BBS.Navigator.CodeData[]|TGApp.BBS.Response.Base>}
*/
async function getCode(
act_id: string,
): Promise<TGApp.BBS.Navigator.CodeData[] | TGApp.BBS.Response.Base> {
const url = "https://api-takumi-static.mihoyo.com/event/miyolive/refreshCode";
const header = { "x-rpc-act_id": act_id };
const res = await TGHttp<TGApp.BBS.Navigator.CodeResponse | TGApp.BBS.Response.Base>(url, {
method: "GET",
headers: header,
});
if (res.retcode !== 0) return <TGApp.BBS.Response.Base>res;
return res.data.code_list;
}
export default getCode;