🐛 修复获取话题帖子异常

This commit is contained in:
目棃
2025-03-02 12:22:54 +08:00
parent 530f45e75c
commit 92603e8599
3 changed files with 39 additions and 37 deletions

View File

@@ -138,6 +138,39 @@ async function getSubReplies(
return resp.data;
}
/**
* @description 获取特定话题帖子列表
* @since Beta v0.7.1
* @param {number} gid 游戏分区 ID
* @param {string} topicId 话题 ID
* @param {string} orderType 排序方式
* @param {string} lastId 最后一条帖子 ID
* @param {number} size 每页大小
* @return {Promise<TGApp.BBS.Topic.PostRes|TGApp.BBS.Response.Base>}
*/
async function getTopicPostList(
gid: number,
topicId: string,
orderType: number = 0,
lastId?: string,
size: number = 20,
): Promise<TGApp.BBS.Topic.PostRes | TGApp.BBS.Response.Base> {
const resp = await TGHttp<TGApp.BBS.Topic.PostResp>(`${bapBu}getTopicPostList`, {
method: "GET",
headers: { referer: Referer },
query: {
gids: gid,
game_id: gid,
topic_id: topicId,
list_type: orderType,
last_id: lastId ?? "",
page_size: size,
},
});
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
return resp.data;
}
/**
* @description 搜索帖子
* @since Beta v0.7.1
@@ -186,6 +219,7 @@ async function userFavouritePost(
const postReq = {
collection: getPostFullInCollection,
post: getPostFull,
topic: getTopicPostList,
reply: { main: getPostReplies, sub: getSubReplies },
search: searchPosts,
userFavourite: userFavouritePost,

View File

@@ -29,39 +29,6 @@ async function getTopicFullInfo(
return resp.data;
}
/**
* @description 获取特定话题帖子列表
* @since Beta v0.7.1
* @param {number} gid 游戏分区 ID
* @param {string} topicId 话题 ID
* @param {string} orderType 排序方式
* @param {string} lastId 最后一条帖子 ID
* @param {number} size 每页大小
* @return {Promise<TGApp.BBS.Topic.PostRes|TGApp.BBS.Response.Base>}
*/
async function getTopicPostList(
gid: number,
topicId: string,
orderType: number = 0,
lastId?: string,
size: number = 20,
): Promise<TGApp.BBS.Topic.PostRes | TGApp.BBS.Response.Base> {
const resp = await TGHttp<TGApp.BBS.Topic.PostResp>(`${batBu}getTopicPostList`, {
method: "GET",
headers: { referer: Referer },
query: {
gids: gid,
game_id: gid,
topic_id: topicId,
list_type: orderType,
last_id: lastId ?? "",
page_size: size,
},
});
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
return resp.data;
}
const topicReq = { info: getTopicFullInfo, posts: getTopicPostList };
const topicReq = { info: getTopicFullInfo };
export default topicReq;