加载指定用户帖子

This commit is contained in:
目棃
2025-03-12 11:06:12 +08:00
parent e3fb88fd44
commit c3246e95ce
12 changed files with 474 additions and 42 deletions

View File

@@ -48,13 +48,13 @@ async function getUserFullInfo(
/**
* @description 根据gid和id获取用户信息
* @since Beta v0.7.1
* @param {number} gid - gid
* @since Beta v0.7.2
* @param {string} gid - gid
* @param {string} userId - 用户 id
* @returns {Promise<TGApp.BBS.Response.Base | TGApp.BBS.User.Info>}
*/
async function getOtherUserInfo(
gid: number,
gid: string,
userId: string,
): Promise<TGApp.BBS.Response.Base | TGApp.BBS.User.Info> {
const params = { gids: gid.toString(), uid: userId };

View File

@@ -171,6 +171,29 @@ async function getTopicPostList(
return resp.data;
}
/**
* @description 获取用户发布帖子
* @since Beta v0.7.2
* @param {string} uid 用户 ID
* @param {number} gid 社区 ID
* @param {string} offset 偏移量
* @returns {Promise<TGApp.BBS.Post.UserPostRes|TGApp.BBS.Response.Base>}
*/
async function getUserPost(
uid: string,
gid: number,
offset?: string,
): Promise<TGApp.BBS.Post.UserPostRes | TGApp.BBS.Response.Base> {
const params = offset ? { uid, gids: gid, offset, size: 20 } : { uid, gids: gid, size: 20 };
const resp = await TGHttp<TGApp.BBS.Post.UserPostResp>(`${bapBu}userPost`, {
method: "GET",
headers: { referer: Referer },
query: params,
});
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
return resp.data;
}
/**
* @description 搜索帖子
* @since Beta v0.7.1
@@ -222,7 +245,7 @@ const postReq = {
topic: getTopicPostList,
reply: { main: getPostReplies, sub: getSubReplies },
search: searchPosts,
userFavourite: userFavouritePost,
user: { post: getUserPost, collect: userFavouritePost },
};
export default postReq;