mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-01 06:39:45 +08:00
✨ 加载指定用户帖子
This commit is contained in:
@@ -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 };
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user