mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-01 06:39:45 +08:00
34 lines
893 B
TypeScript
34 lines
893 B
TypeScript
/**
|
|
* 话题相关的请求
|
|
* @since Beta v0.7.9
|
|
*/
|
|
import TGHttp from "@utils/TGHttp.js";
|
|
|
|
// BBSApiTopicBaseUrl => batBu
|
|
const batBu: Readonly<string> = "https://bbs-api.miyoushe.com/topic/wapi/";
|
|
const Referer: Readonly<string> = "https://bbs.mihoyo.com/";
|
|
|
|
/**
|
|
* 获取特定话题信息
|
|
* @since Beta v0.7.9
|
|
* @param gid - 游戏分区 ID
|
|
* @param topicId - 话题 ID
|
|
* @returns 话题信息
|
|
*/
|
|
async function getTopicFullInfo(
|
|
gid: string,
|
|
topicId: string,
|
|
): Promise<TGApp.BBS.Topic.InfoRes | TGApp.BBS.Response.Base> {
|
|
const resp = await TGHttp<TGApp.BBS.Topic.InfoResp>(`${batBu}getTopicFullInfo`, {
|
|
method: "GET",
|
|
headers: { referer: Referer, cookie: "" },
|
|
query: { gids: gid, id: topicId },
|
|
});
|
|
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
|
return resp.data;
|
|
}
|
|
|
|
const topicReq = { info: getTopicFullInfo };
|
|
|
|
export default topicReq;
|