mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-16 09:58:13 +08:00
♻️ 米社请求重构
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
/**
|
||||
* @file plugins/Mys/request/getForumList.ts
|
||||
* @description Mys 插件特定论坛请求
|
||||
* @since Beta v0.3.7
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
import MysApi from "../api";
|
||||
|
||||
/**
|
||||
* @description 获取特定论坛列表
|
||||
* @since Beta v0.3.9
|
||||
* @since Beta v0.4.5
|
||||
* @param {number} forumId 特定论坛 ID
|
||||
* @param {number} type 排序方式: 0-按热度排序,1-最新回复,2-按时间排序
|
||||
* @return {Promise<TGApp.Plugins.Mys.Forum.FullData>}
|
||||
@@ -19,11 +17,20 @@ async function getForumList(
|
||||
forumId: number,
|
||||
type: number = 0,
|
||||
): Promise<TGApp.Plugins.Mys.Forum.FullData> {
|
||||
const url = MysApi.Forum.replace("{forum}", forumId.toString()).replace(
|
||||
"{type}",
|
||||
type.toString(),
|
||||
);
|
||||
return await http.fetch<TGApp.Plugins.Mys.Forum.Response>(url).then((res) => res.data.data);
|
||||
const url = "https://bbs-api.miyoushe.com/post/wapi/getForumPostList";
|
||||
const params = {
|
||||
forum_id: forumId.toString(),
|
||||
sort_type: type.toString(),
|
||||
};
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.Forum.Response>(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
query: params,
|
||||
})
|
||||
.then((res) => res.data.data);
|
||||
}
|
||||
|
||||
export default getForumList;
|
||||
|
||||
Reference in New Issue
Block a user