mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
✨ 前瞻兑换码查看
This commit is contained in:
@@ -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;
|
||||
|
||||
28
src/web/request/getCode.ts
Normal file
28
src/web/request/getCode.ts
Normal 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;
|
||||
Reference in New Issue
Block a user