帖子搜索集成

fix #103
This commit is contained in:
目棃
2024-04-04 18:48:35 +08:00
parent 623d137457
commit 6bf24bd8c2
10 changed files with 290 additions and 36 deletions

View File

@@ -0,0 +1,42 @@
/**
* @file plugins/Mys/request/searchPost.ts
* @description 帖子搜索
* @since Beta v0.4.5
*/
import { http } from "@tauri-apps/api";
/**
* @description 搜索帖子
* @since Beta v0.4.5
* @param {string} gid 游戏分区 ID
* @param {string} keyword 关键词
* @param {string} last_id 最后一条帖子 ID
* @return {Promise<TGApp.Plugins.Mys.Search.PostsResponseData>} 返回帖子列表
*/
async function searchPosts(
gid: string = "2",
keyword: string,
last_id: string,
): Promise<TGApp.Plugins.Mys.Search.PostsResponseData> {
const url = "https://bbs-api.miyoushe.com/post/wapi/searchPosts";
const params = {
gids: gid,
keyword,
last_id,
size: "20",
};
return await http
.fetch<TGApp.Plugins.Mys.Search.PostsResponse>(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
query: params,
})
.then((res) => {
return res.data.data;
});
}
export default searchPosts;