mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
@@ -15,6 +15,7 @@ import getNewsList from "./request/getNewsList";
|
||||
import { getPositionData } from "./request/getPositionData";
|
||||
import getPostData from "./request/getPostData";
|
||||
import { getVoteInfo, getVoteResult } from "./request/getVoteData";
|
||||
import searchPosts from "./request/searchPost";
|
||||
import { getGachaCard } from "./utils/getGachaCard";
|
||||
import getLotteryCard from "./utils/getLotteryCard";
|
||||
import getPositionCard from "./utils/getPositionCard";
|
||||
@@ -31,6 +32,7 @@ const Mys = {
|
||||
Posts: {
|
||||
get: getForumList,
|
||||
nav: getHomeNavigator,
|
||||
search: searchPosts,
|
||||
},
|
||||
Gacha: {
|
||||
get: getGachaData,
|
||||
|
||||
42
src/plugins/Mys/request/searchPost.ts
Normal file
42
src/plugins/Mys/request/searchPost.ts
Normal 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;
|
||||
8
src/plugins/Mys/types/Post.d.ts
vendored
8
src/plugins/Mys/types/Post.d.ts
vendored
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/post.d.ts
|
||||
* @description Mys 插件帖子类型定义文件
|
||||
* @since Beta v0.4.0
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Mys 插件帖子类型
|
||||
* @since Beta v0.4.0
|
||||
* @since Beta v0.4.5
|
||||
* @namespace TGApp.Plugins.Mys.Post
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
@@ -27,7 +27,7 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
|
||||
/**
|
||||
* @description 帖子数据
|
||||
* @since Beta v0.4.0
|
||||
* @since Beta v0.4.5
|
||||
* @interface FullData
|
||||
* @property {Post} post 帖子信息
|
||||
* @property {Forum} forum 所属版块
|
||||
@@ -73,7 +73,7 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
is_block_on: boolean;
|
||||
forum_rank_info: unknown | null;
|
||||
link_card_list: unknown[];
|
||||
news_meta: TGApp.Plugins.Mys.News.Meta | null;
|
||||
news_meta: TGApp.Plugins.Mys.News.Meta | null | undefined;
|
||||
recommend_reason: unknown | null;
|
||||
villa_card: unknown | null;
|
||||
is_mentor: boolean;
|
||||
|
||||
44
src/plugins/Mys/types/Search.d.ts
vendored
Normal file
44
src/plugins/Mys/types/Search.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/Search.d.ts
|
||||
* @description Mys 插件搜索类型声明
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description 搜索帖子返回
|
||||
* @since Beta v0.4.5
|
||||
* @namespace TGApp.Plugins.Mys.Search
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
declare namespace TGApp.Plugins.Mys.Search {
|
||||
/**
|
||||
* @description 搜索帖子返回
|
||||
* @since Beta v0.4.5
|
||||
* @interface PostsResponse
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {PostsResponseData} data 返回数据
|
||||
* @return PostsResponse
|
||||
*/
|
||||
interface PostsResponse extends TGApp.BBS.Response.BaseWithData {
|
||||
data: PostsResponseData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 搜索帖子返回数据
|
||||
* @since Beta v0.4.5
|
||||
* @interface PostsResponseData
|
||||
* @property {TGApp.Plugins.Mys.Post.FullData[]} posts 帖子列表
|
||||
* @property {string} last_id 索引
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {string[]} token_list token 列表
|
||||
* @property {Record<string,string>} databox 数据盒
|
||||
* @return PostsResponseData
|
||||
*/
|
||||
interface PostsResponseData {
|
||||
posts: TGApp.Plugins.Mys.Post.FullData[];
|
||||
last_id: string;
|
||||
is_last: boolean;
|
||||
token_list: string[];
|
||||
databox: Record<string, string>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user