🌱 点赞

This commit is contained in:
目棃
2025-02-24 14:39:08 +08:00
parent 0f278ad25e
commit 2bafb6d491
5 changed files with 78 additions and 10 deletions

View File

@@ -103,12 +103,38 @@ async function homeNew(gid: number = 2): Promise<TGApp.BBS.Navigator.Navigator[]
).data.navigator;
}
/**
* @description 点赞
* @since Beta v0.6.10/v0.7.0
* @param {string} id 帖子 ID
* @param {Record<string,string>} cookie 用户 Cookie
* @param {boolean} cancel 是否取消点赞
* @return {Promise<TGApp.BBS.Response.Base>}
*/
async function upVotePost(
id: string,
cookie: Record<string, string>,
cancel: boolean = false,
): Promise<TGApp.BBS.Response.Base> {
const data = { is_cancel: cancel, post_id: id };
const header = {
...getRequestHeader(cookie, "POST", data, "K2", true),
"x-rpc-client_type": "2",
};
return await TGHttp<TGApp.BBS.Response.Base>(`${Mahbu}api/upvotePost`, {
method: "POST",
headers: header,
body: JSON.stringify(data),
});
}
const apiHubReq = {
vote: { info: getVotes, result: getVoteResult },
home: homeNew,
forum: getAllGamesForums,
game: getGameList,
mission: getMissions,
post: { like: upVotePost },
};
export default apiHubReq;