mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-03 06:55:06 +08:00
✨ 重构帖子解析逻辑,增加新类型解析
*PostID:69886846,69915487
This commit is contained in:
57
src/types/BBS/Post.d.ts
vendored
57
src/types/BBS/Post.d.ts
vendored
@@ -151,7 +151,7 @@ declare namespace TGApp.BBS.Post {
|
||||
* @property {string} release_time_type 发布时间类型
|
||||
* @property {number} future_release_time 未来发布时间
|
||||
* @property {ExternalLink} external_link 外部链接信息
|
||||
* @property {unknown} post_full_extra_info 帖子完整额外信息,可能为 null
|
||||
* @property {PostExtraFull} post_full_extra_info 帖子完整额外信息,可能为 null
|
||||
* @property {unknown} post_attachment_info 帖子附件信息,可能为 null
|
||||
* @property {unknown} feed_attachment_info 动态附件信息,可能为 null
|
||||
*/
|
||||
@@ -191,7 +191,7 @@ declare namespace TGApp.BBS.Post {
|
||||
release_time_type: string;
|
||||
future_release_time: number;
|
||||
external_link: ExternalLink;
|
||||
post_full_extra_info: unknown | null;
|
||||
post_full_extra_info: PostExtraFull | null;
|
||||
post_attachment_info: unknown | null;
|
||||
feed_attachment_info: unknown | null;
|
||||
};
|
||||
@@ -243,7 +243,7 @@ declare namespace TGApp.BBS.Post {
|
||||
* @property {string} subject 帖子标题
|
||||
* @property {string} content 帖子内容,为 html 格式
|
||||
* @property {string} cover 封面图 URL,可能为 ""
|
||||
* @property {number} view_type 浏览类型
|
||||
* @property {ViewTypeEnum} view_type 浏览类型
|
||||
* @property {number} created_at 发帖时间
|
||||
* @property {Array<string>} images 图片列表,可能为空
|
||||
* @property {PostStat} post_status 帖子状态
|
||||
@@ -286,7 +286,7 @@ declare namespace TGApp.BBS.Post {
|
||||
subject: string;
|
||||
content: string;
|
||||
cover: string;
|
||||
view_type: number;
|
||||
view_type: ViewTypeEnum | number;
|
||||
created_at: number;
|
||||
images: Array<string>;
|
||||
post_status: PostStat;
|
||||
@@ -322,6 +322,31 @@ declare namespace TGApp.BBS.Post {
|
||||
aigc_meta: PostAigcMeta | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 浏览类型枚举
|
||||
* @since Beta v0.8.4
|
||||
* @const PostViewType
|
||||
* @todo 待确定是否有其他类型
|
||||
* @property {number} NORMAL 正常帖子
|
||||
* @property {number} PIC 图片帖子,如同人图,COS
|
||||
* @property {number} VOD 含视频帖子
|
||||
* @property {number} UGC 千星奇域 // TODO: 待确定是否有其他分类
|
||||
*/
|
||||
const PostViewType = <const>{
|
||||
NORMAL: 1,
|
||||
PIC: 2,
|
||||
VOD: 5,
|
||||
UGC: 7,
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 浏览类型枚举类型
|
||||
* @since Beta v0.8.4
|
||||
* @enum {number}
|
||||
* @type PostViewTypeEnum
|
||||
*/
|
||||
type ViewTypeEnum = (typeof PostViewType)[keyof typeof PostViewType];
|
||||
|
||||
/**
|
||||
* @description 帖子状态
|
||||
* @since Beta v0.7.2
|
||||
@@ -664,4 +689,28 @@ declare namespace TGApp.BBS.Post {
|
||||
* @property {string} external_link_title 外部链接标题
|
||||
*/
|
||||
type ExternalLink = { external_link: string; external_link_title: string };
|
||||
|
||||
/**
|
||||
* @description 帖子完整额外信息
|
||||
* @since Beta v0.8.4
|
||||
* @interface PostExtraFull
|
||||
* @property {PostExtraUgcFull} ugc_master_post_extra UGCMaster 额外信息
|
||||
*/
|
||||
type PostExtraFull = { ugc_master_post_extra: PostExtraUgcFull };
|
||||
|
||||
/**
|
||||
* @description UGC所有者完整额外信息
|
||||
* @since Beta v0.8.4
|
||||
* @interface PostExtraUgcFull
|
||||
* @property {TGApp.BBS.UGC.Character} game_character 游戏角色信息
|
||||
* @property {boolean} user_is_use_game_info 用户是否使用游戏信息
|
||||
* @property {string} ugc_master_post_type UGC 主帖子类型
|
||||
* @property {Array<TGApp.BBS.UGC.Level>} level_list 等级列表
|
||||
*/
|
||||
type PostExtraUgcFull = {
|
||||
game_character: TGApp.BBS.UGC.Character;
|
||||
user_is_use_game_info: boolean;
|
||||
ugc_master_post_type: string;
|
||||
level_list: Array<TGApp.BBS.UGC.Level>;
|
||||
};
|
||||
}
|
||||
|
||||
55
src/types/BBS/SctPost.d.ts
vendored
55
src/types/BBS/SctPost.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file types/BBS/SctPost.d.ts
|
||||
* @description 结构化帖子类型声明文件
|
||||
* @since Beta v0.7.2
|
||||
* @since Beta v0.8.4
|
||||
*/
|
||||
|
||||
declare namespace TGApp.BBS.SctPost {
|
||||
@@ -31,14 +31,59 @@ declare namespace TGApp.BBS.SctPost {
|
||||
type Empty = { insert: never; attributes?: never };
|
||||
|
||||
/**
|
||||
* @description 帖子结构化数据-其他类型
|
||||
* @since Beta v0.6.7
|
||||
* @description 帖子结构化数据-viewType为2
|
||||
* @since Beta v0.8.4
|
||||
* @property {string} describe - 描述
|
||||
* @property {Array<string>} imgs - 图片链接
|
||||
* @property {Array<string>} link_card_ids - 关联卡片ID
|
||||
* @return Other
|
||||
* @return Pic
|
||||
*/
|
||||
type Other = { describe: string; imgs: Array<string>; link_card_ids?: Array<string> } & {
|
||||
type Pic = { describe: string; imgs: Array<string>; link_card_ids?: Array<string> } & {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 帖子结构化数据-viewType为7
|
||||
* @since Beta v0.8.4
|
||||
* @description 下面详细结构参见相关组件
|
||||
* @property {Array<Base>} text - 文字内容
|
||||
* @property {Array<UgcImage>} images - 图片内容
|
||||
* @property {Array<UgcVod>} vods - 视频内容
|
||||
* @property {Array<UgcLevel>} levels - 等级内容
|
||||
*/
|
||||
type Ugc = {
|
||||
text: Array<Base>;
|
||||
images: Array<UgcImage>;
|
||||
vods: Array<UgcVod>;
|
||||
levels: Array<UgcLevel>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Ugc结构下的图片内容
|
||||
* @since Beta v0.8.4
|
||||
* @interface UgcImage
|
||||
* @property {number} image_id - 图片ID
|
||||
* @property {string} image_url - 图片链接
|
||||
* @property {TGApp.BBS.Post.Image} image - 图片信息
|
||||
*/
|
||||
type UgcImage = { image_id: number; image_url: string; image: TGApp.BBS.Post.Image };
|
||||
|
||||
/**
|
||||
* @description Ugc结构下的视频内容
|
||||
* @since Beta v0.8.4
|
||||
* @interface UgcVod
|
||||
* @property {string} vod_id - 视频ID
|
||||
* @property {TGApp.BBS.Post.Vod} vod - 视频信息
|
||||
*/
|
||||
type UgcVod = { vod_id: string; vod: TGApp.BBS.Post.Vod };
|
||||
|
||||
/**
|
||||
* @description Ugc结构下的关卡内容
|
||||
* @since Beta v0.8.4
|
||||
* @interface UgcLevel
|
||||
* @property {string} level_id - 关卡ID
|
||||
* @property {string} region - 关卡服务器
|
||||
* @property {TGApp.BBS.UGC.Level} level - 关卡信息
|
||||
*/
|
||||
type UgcLevel = { level_id: string; region: string; level: TGApp.BBS.UGC.Level };
|
||||
}
|
||||
|
||||
133
src/types/BBS/UGC.d.ts
vendored
Normal file
133
src/types/BBS/UGC.d.ts
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* @file types/BBS/UGC.d.ts
|
||||
* @description 千星奇域类型定义文件
|
||||
* @since Beta v0.8.4
|
||||
*/
|
||||
|
||||
declare namespace TGApp.BBS.UGC {
|
||||
/**
|
||||
* @description UGC 游戏角色信息
|
||||
* @since Beta v0.8.4
|
||||
* @interface Character
|
||||
* @property {string} region 游戏区服
|
||||
* @property {string} game_uid 游戏 UID
|
||||
* @property {string} nickname 游戏昵称
|
||||
* @property {string} user_label 用户标签
|
||||
* @property {string} region_name 区服名称
|
||||
*/
|
||||
type Character = {
|
||||
region: string;
|
||||
game_uid: string;
|
||||
nickname: string;
|
||||
user_label: string;
|
||||
region_name: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 关卡信息
|
||||
* @since Beta v0.8.4
|
||||
* @interface Level
|
||||
* @property {string} level_id 关卡 ID
|
||||
* @property {string} region 区域
|
||||
* @property {string} level_name 关卡名称
|
||||
* @property {Cover} cover 关卡封面
|
||||
* @property {string} desc 关卡描述
|
||||
* @property {number} limit_play_num_min 最小游玩人数
|
||||
* @property {number} limit_play_num_max 最大游玩人数
|
||||
* @property {string} play_type 游玩类型
|
||||
* @property {string} good_rate 好评率
|
||||
* @property {string} hot_score 热度分数
|
||||
* @property {string} creator_uid 创建者 UID
|
||||
* @property {InteractInfo} interact_info 交互信息
|
||||
* @property {LevelAttachment} level_attachment 关卡附件
|
||||
* @property {UserPlayInfo} user_play_info 用户游玩信息
|
||||
* @property {Extra} extra 额外信息
|
||||
* @property {boolean} level_info_has_released 关卡信息是否已发布
|
||||
* @property {string} level_source_type 关卡来源类型
|
||||
* @property {string} data_box 数据盒
|
||||
* @property {string} show_limit_play_num_str 显示的游玩人数限制字符串
|
||||
* @property {string} level_intro 关卡介绍
|
||||
*/
|
||||
type Level = {
|
||||
level_id: string;
|
||||
region: string;
|
||||
level_name: string;
|
||||
cover: Cover;
|
||||
desc: string;
|
||||
limit_play_num_min: number;
|
||||
limit_play_num_max: number;
|
||||
play_type: string;
|
||||
good_rate: string;
|
||||
hot_score: string;
|
||||
creator_uid: string;
|
||||
interact_info: InteractInfo;
|
||||
level_attachment: LevelAttachment | null;
|
||||
user_play_info: UserPlayInfo;
|
||||
extra: Extra;
|
||||
level_info_has_released: boolean;
|
||||
level_source_type: string;
|
||||
data_box: string;
|
||||
show_limit_play_num_str: string;
|
||||
level_intro: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 关卡封面
|
||||
* @since Beta v0.8.4
|
||||
* @interface Cover
|
||||
* @property {string} url 封面链接
|
||||
*/
|
||||
type Cover = { url: string };
|
||||
|
||||
/**
|
||||
* @description 用户交互信息
|
||||
* @since Beta v0.8.4
|
||||
* @interface InteractInfo
|
||||
* @property {boolean} has_fav 是否已收藏
|
||||
*/
|
||||
type InteractInfo = { has_fav: boolean };
|
||||
|
||||
/**
|
||||
* @description 关卡附件
|
||||
* @since Beta v0.8.4
|
||||
* @interface LevelAttachment
|
||||
* @property {string} type 信息类型
|
||||
* @property {string} content 信息内容
|
||||
*/
|
||||
type LevelAttachment = { type: string; content: string };
|
||||
|
||||
/**
|
||||
* @description 游玩信息
|
||||
* @since Beta v0.8.4
|
||||
* @interface UserPlayInfo
|
||||
* @property {boolean} has_played 是否已游玩
|
||||
* @property {string} played_time 游玩时间
|
||||
* @property {number} played_count 游玩次数
|
||||
*/
|
||||
type UserPlayInfo = { has_played: boolean; played_time: string; played_count: number };
|
||||
|
||||
/**
|
||||
* @description 额外信息
|
||||
* @since Beta v0.8.4
|
||||
* @interface Extra
|
||||
* @property {Array<PlayLink>} play_link 游玩链接
|
||||
* @property {boolean} friends_played 好友游玩过
|
||||
* @property {Array<unknown>} friends_played_list 好友游玩列表 // TODO: 类型待确定
|
||||
* @property {string} first_online_time 首次上线时间
|
||||
*/
|
||||
type Extra = {
|
||||
play_link: Array<PlayLink>;
|
||||
friends_played: boolean;
|
||||
friends_played_list: Array<Character>;
|
||||
first_online_time: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 游玩链接
|
||||
* @since Beta v0.8.4
|
||||
* @interface PlayLink
|
||||
* @property {string} link_content 链接内容
|
||||
* @property {string} link_type 链接类型
|
||||
*/
|
||||
type PlayLink = { link_content: string; link_type: string };
|
||||
}
|
||||
Reference in New Issue
Block a user