mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-25 22:29:42 +08:00
👽️ 完善类型,改用常量枚举,适配typescript 6
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* painter 下的请求
|
||||
* @since Beta v0.8.3
|
||||
* @since Beta v0.9.9
|
||||
*/
|
||||
import bbsEnum from "@enum/bbs.js";
|
||||
import { getRequestHeader } from "@utils/getRequestHeader.js";
|
||||
@@ -73,7 +73,7 @@ async function getHotForumPostList(
|
||||
|
||||
/**
|
||||
* 获取最近版块帖子列表
|
||||
* @since Beta v0.8.3
|
||||
* @since Beta v0.9.9
|
||||
* @param forumId - 版块 ID
|
||||
* @param gid - 社区 ID
|
||||
* @param type - 排序方式: 1-最新回复,2-最新发布
|
||||
@@ -85,7 +85,7 @@ async function getHotForumPostList(
|
||||
async function getRecentForumPostList(
|
||||
forumId: number,
|
||||
gid: number,
|
||||
type: number = 1,
|
||||
type: TGApp.BBS.Post.ForumSortTypeEnum = bbsEnum.post.forumSortType.LATEST_REPLY,
|
||||
lastId?: string,
|
||||
pageSize: number = 20,
|
||||
cookie?: Record<string, string>,
|
||||
@@ -93,7 +93,7 @@ async function getRecentForumPostList(
|
||||
type ReqParams = {
|
||||
forum_id: number;
|
||||
gids: number;
|
||||
sort_type: number;
|
||||
sort_type: TGApp.BBS.Post.ForumSortTypeEnum;
|
||||
is_good: boolean;
|
||||
page_size: number;
|
||||
last_id?: string;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* 帖子相关的请求
|
||||
* @since Beta v0.9.1
|
||||
* @since Beta v0.9.9
|
||||
*/
|
||||
import bbsEnum from "@enum/bbs.js";
|
||||
import { getRequestHeader } from "@utils/getRequestHeader.js";
|
||||
import TGHttp from "@utils/TGHttp.js";
|
||||
|
||||
@@ -54,7 +55,7 @@ async function getPostFullInCollection(
|
||||
|
||||
/**
|
||||
* 获取帖子回复信息
|
||||
* @since Beta v0.7.1
|
||||
* @since Beta v0.9.9
|
||||
* @param postId - 帖子 ID
|
||||
* @param gid - 社区 ID
|
||||
* @param isHot - 是否热门
|
||||
@@ -70,7 +71,7 @@ async function getPostReplies(
|
||||
isHot: boolean = true,
|
||||
lastId?: string,
|
||||
onlyMaster: boolean = false,
|
||||
orderType?: 1 | 2,
|
||||
orderType?: TGApp.BBS.Reply.ReplyOrderTypeEnum,
|
||||
size: number = 20,
|
||||
): Promise<TGApp.BBS.Reply.MainRes | TGApp.BBS.Response.Base> {
|
||||
type GprParam = {
|
||||
@@ -79,7 +80,7 @@ async function getPostReplies(
|
||||
is_hot: boolean;
|
||||
size: number;
|
||||
last_id?: string;
|
||||
order_type?: 1 | 2;
|
||||
order_type?: TGApp.BBS.Reply.ReplyOrderTypeEnum;
|
||||
only_master?: boolean;
|
||||
};
|
||||
const params: GprParam = { post_id: postId, gids: gid, is_hot: isHot, size: size };
|
||||
@@ -136,7 +137,7 @@ async function getSubReplies(
|
||||
|
||||
/**
|
||||
* 获取特定话题帖子列表
|
||||
* @since Beta v0.7.1
|
||||
* @since Beta v0.9.9
|
||||
* @param gid - 游戏分区 ID
|
||||
* @param topicId - 话题 ID
|
||||
* @param orderType - 排序方式
|
||||
@@ -147,7 +148,7 @@ async function getSubReplies(
|
||||
async function getTopicPostList(
|
||||
gid: number,
|
||||
topicId: string,
|
||||
orderType: number = 0,
|
||||
orderType: TGApp.BBS.Post.PostTopicSortTypeEnum = bbsEnum.post.topicSortType.LATEST,
|
||||
lastId?: string,
|
||||
size: number = 20,
|
||||
): Promise<TGApp.BBS.Topic.PostRes | TGApp.BBS.Response.Base> {
|
||||
@@ -192,7 +193,7 @@ async function getUserPost(
|
||||
|
||||
/**
|
||||
* 搜索帖子
|
||||
* @since Beta v0.8.7
|
||||
* @since Beta v0.9.9
|
||||
* @param gid - 游戏分区 ID
|
||||
* @param keyword - 关键词
|
||||
* @param lastId - 最后一条帖子 ID
|
||||
@@ -203,7 +204,7 @@ async function searchPosts(
|
||||
gid: string = "2",
|
||||
keyword: string,
|
||||
lastId: string,
|
||||
orderType: number,
|
||||
orderType: TGApp.BBS.Post.SearchSortTypeEnum,
|
||||
): Promise<TGApp.BBS.Post.SearchRes> {
|
||||
return (
|
||||
await TGHttp<TGApp.BBS.Post.SearchResp>(`${bapBu}searchPosts`, {
|
||||
|
||||
Reference in New Issue
Block a user