🎨 调整加载逻辑

This commit is contained in:
目棃
2024-11-17 16:39:27 +08:00
parent 53f2612d32
commit 63929bc9fd
5 changed files with 77 additions and 22 deletions

View File

@@ -17,18 +17,38 @@ const Referer = "https://bbs.mihoyo.com/";
* @since Beta v0.6.2
* @param {number} forumId 特定论坛 ID
* @param {number} type 排序方式: 0-按热度排序1-最新回复2-按时间排序
* @param {string} last_id 最后 ID
* @param {number} page_size 每页数量
* @return {Promise<TGApp.Plugins.Mys.Forum.FullData>}
*/
export async function getForumPostList(
forumId: number,
type: number = 0,
type: number = 1,
last_id?: string,
page_size: number = 20,
): Promise<TGApp.Plugins.Mys.Forum.FullData> {
let params;
if (type === 3) {
params = {
forum_id: forumId,
is_hot: true,
page_size: page_size,
last_id: last_id,
};
} else {
params = {
forum_id: forumId,
sort_type: type,
is_good: false,
is_hot: false,
page_size: page_size,
last_id: last_id,
};
}
return (
await TGHttp<TGApp.Plugins.Mys.Forum.Response>(`${Mpabu}getForumPostList`, {
method: "GET",
query: { forum_id: forumId, sort_type: type, page_size: page_size },
query: params,
})
).data;
}

View File

@@ -1,7 +1,7 @@
/**
* @file plugins/Mys/types/Forum.d.ts
* @description Mys 插件论坛类型定义文件
* @since Beta v0.4.5
* @since Beta v0.6.3
*/
/**
@@ -25,9 +25,9 @@ declare namespace TGApp.Plugins.Mys.Forum {
/**
* @description 特定论坛数据
* @since Beta v0.4.5
* @since Beta v0.6.3
* @interface FullData
* @property {number} last_id 最后一条帖子 ID
* @property {string} last_id 最后一条帖子 ID
* @property {boolean} is_last 是否最后一页
* @property {boolean} is_origin 是否原创
* @property {number} page 页码
@@ -36,7 +36,7 @@ declare namespace TGApp.Plugins.Mys.Forum {
* @return FullData
*/
interface FullData {
last_id: number;
last_id: string;
is_last: boolean;
is_origin: boolean;
page: number;