mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-05-18 04:56:47 +08:00
🎨 代码格式化
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
* @returns {MysResponse}
|
||||
*/
|
||||
export interface MysResponse {
|
||||
retcode: number
|
||||
message: string
|
||||
data: any
|
||||
retcode: number;
|
||||
message: string;
|
||||
data: any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,8 +30,8 @@ export interface MysResponse {
|
||||
*/
|
||||
export interface MysObcResponse extends MysResponse {
|
||||
data: {
|
||||
list: MysObc[]
|
||||
}
|
||||
list: MysObc[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,13 +48,13 @@ export interface MysObcResponse extends MysResponse {
|
||||
* @returns {MysObc}
|
||||
*/
|
||||
export interface MysObc {
|
||||
id: number
|
||||
name: string
|
||||
parent_id: number
|
||||
depth: number
|
||||
ch_ext: string
|
||||
children: MysObc[]
|
||||
list: unknown[]
|
||||
id: number;
|
||||
name: string;
|
||||
parent_id: number;
|
||||
depth: number;
|
||||
ch_ext: string;
|
||||
children: MysObc[];
|
||||
list: unknown[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,8 +17,8 @@ import { type MysResponse } from "./base";
|
||||
*/
|
||||
export interface GachaResponse extends MysResponse {
|
||||
data: {
|
||||
list: GachaData[]
|
||||
}
|
||||
list: GachaData[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,16 +39,16 @@ export interface GachaResponse extends MysResponse {
|
||||
* @returns {GachaData}
|
||||
*/
|
||||
export interface GachaData {
|
||||
id: string
|
||||
title: string
|
||||
activity_url: string
|
||||
content_before_act: string
|
||||
pool: GachaPool[]
|
||||
voice_icon: string
|
||||
voice_url: string
|
||||
voice_status: string
|
||||
start_time: string
|
||||
end_time: string
|
||||
id: string;
|
||||
title: string;
|
||||
activity_url: string;
|
||||
content_before_act: string;
|
||||
pool: GachaPool[];
|
||||
voice_icon: string;
|
||||
voice_url: string;
|
||||
voice_status: string;
|
||||
start_time: string;
|
||||
end_time: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,8 +60,8 @@ export interface GachaData {
|
||||
* @returns {GachaPool}
|
||||
*/
|
||||
export interface GachaPool {
|
||||
icon: string
|
||||
url: string
|
||||
icon: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,16 +82,16 @@ export interface GachaPool {
|
||||
* @returns {GachaCard}
|
||||
*/
|
||||
export interface GachaCard {
|
||||
title: string
|
||||
subtitle: string
|
||||
cover: string
|
||||
post_id: number
|
||||
characters: GachaPool[]
|
||||
voice: GachaPool
|
||||
title: string;
|
||||
subtitle: string;
|
||||
cover: string;
|
||||
post_id: number;
|
||||
characters: GachaPool[];
|
||||
voice: GachaPool;
|
||||
time: {
|
||||
start: string
|
||||
start_stamp: number
|
||||
end: string
|
||||
end_stamp: number
|
||||
}
|
||||
start: string;
|
||||
start_stamp: number;
|
||||
end: string;
|
||||
end_stamp: number;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import { type UserInfoPost } from "./user";
|
||||
*/
|
||||
export interface LotteryResponse extends MysResponse {
|
||||
data: {
|
||||
show_lottery: LotteryData
|
||||
}
|
||||
show_lottery: LotteryData;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,21 +44,21 @@ export interface LotteryResponse extends MysResponse {
|
||||
* @returns {LotteryData}
|
||||
*/
|
||||
export interface LotteryData {
|
||||
id: string
|
||||
creator: UserInfoPost
|
||||
draw_time: string
|
||||
participant_way: string
|
||||
is_expect_unfocus_user: boolean
|
||||
is_expect_non_real_name_user: boolean
|
||||
user_rewards: LotteryReward[]
|
||||
status: string
|
||||
is_blocked: boolean
|
||||
user_status: string
|
||||
is_upload_address: boolean
|
||||
lottery_entity_summary: string
|
||||
entity_id: string
|
||||
entity_type: string
|
||||
now_time: string
|
||||
id: string;
|
||||
creator: UserInfoPost;
|
||||
draw_time: string;
|
||||
participant_way: string;
|
||||
is_expect_unfocus_user: boolean;
|
||||
is_expect_non_real_name_user: boolean;
|
||||
user_rewards: LotteryReward[];
|
||||
status: string;
|
||||
is_blocked: boolean;
|
||||
user_status: string;
|
||||
is_upload_address: boolean;
|
||||
lottery_entity_summary: string;
|
||||
entity_id: string;
|
||||
entity_type: string;
|
||||
now_time: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,12 +74,12 @@ export interface LotteryData {
|
||||
* @returns {LotteryReward}
|
||||
*/
|
||||
export interface LotteryReward {
|
||||
reward_name: string
|
||||
winner_number: number
|
||||
scheduled_winner_number: number
|
||||
is_send_by_post: boolean
|
||||
users: UserInfoPost[]
|
||||
id: string
|
||||
reward_name: string;
|
||||
winner_number: number;
|
||||
scheduled_winner_number: number;
|
||||
is_send_by_post: boolean;
|
||||
users: UserInfoPost[];
|
||||
id: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,12 +95,12 @@ export interface LotteryReward {
|
||||
* @returns {LotteryCard}
|
||||
*/
|
||||
export interface LotteryCard {
|
||||
id: string
|
||||
participantWay: string
|
||||
status: string
|
||||
creator: UserInfoPost
|
||||
drawTime: string
|
||||
rewards: LotteryRewardCard[]
|
||||
id: string;
|
||||
participantWay: string;
|
||||
status: string;
|
||||
creator: UserInfoPost;
|
||||
drawTime: string;
|
||||
rewards: LotteryRewardCard[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,8 +114,8 @@ export interface LotteryCard {
|
||||
* @returns {LotteryRewardCard}
|
||||
*/
|
||||
export interface LotteryRewardCard {
|
||||
rewardName: string
|
||||
winnerNumber: number
|
||||
scheduledWinnerNumber: number
|
||||
users: UserInfoPost[]
|
||||
rewardName: string;
|
||||
winnerNumber: number;
|
||||
scheduledWinnerNumber: number;
|
||||
users: UserInfoPost[];
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import { type ImageData, type HelpSys } from "./utils";
|
||||
* @returns {NewsResponse}
|
||||
*/
|
||||
export interface NewsResponse extends MysResponse {
|
||||
data: NewsData
|
||||
data: NewsData;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,9 +32,9 @@ export interface NewsResponse extends MysResponse {
|
||||
* @returns {NewsData}
|
||||
*/
|
||||
export interface NewsData {
|
||||
last_id: number
|
||||
is_last: boolean
|
||||
list: NewsItem[]
|
||||
last_id: number;
|
||||
is_last: boolean;
|
||||
list: NewsItem[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,27 +65,27 @@ export interface NewsData {
|
||||
* @returns {NewsItem}
|
||||
*/
|
||||
export interface NewsItem {
|
||||
post: Post
|
||||
forum: Forum
|
||||
topics: Topic[]
|
||||
user: UserInfoPost
|
||||
self_operation: SelfOperation
|
||||
stat: PostStat
|
||||
help_sys: HelpSys
|
||||
cover: ImageData
|
||||
image_list: ImageData[]
|
||||
is_official_master: boolean
|
||||
is_user_master: boolean
|
||||
hot_reply_exist: boolean
|
||||
vote_count: number
|
||||
last_modify_time: number
|
||||
recommend_type: string
|
||||
collection: unknown
|
||||
vod_list: unknown[]
|
||||
is_block_on: boolean
|
||||
forum_rank_info: unknown
|
||||
link_card_list: unknown[]
|
||||
news_meta: NewsMeta
|
||||
post: Post;
|
||||
forum: Forum;
|
||||
topics: Topic[];
|
||||
user: UserInfoPost;
|
||||
self_operation: SelfOperation;
|
||||
stat: PostStat;
|
||||
help_sys: HelpSys;
|
||||
cover: ImageData;
|
||||
image_list: ImageData[];
|
||||
is_official_master: boolean;
|
||||
is_user_master: boolean;
|
||||
hot_reply_exist: boolean;
|
||||
vote_count: number;
|
||||
last_modify_time: number;
|
||||
recommend_type: string;
|
||||
collection: unknown;
|
||||
vod_list: unknown[];
|
||||
is_block_on: boolean;
|
||||
forum_rank_info: unknown;
|
||||
link_card_list: unknown[];
|
||||
news_meta: NewsMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,9 +98,9 @@ export interface NewsItem {
|
||||
* @returns {NewsMeta}
|
||||
*/
|
||||
export interface NewsMeta {
|
||||
activity_status: number
|
||||
start_at_sec: string
|
||||
end_at_sec: string
|
||||
activity_status: number;
|
||||
start_at_sec: string;
|
||||
end_at_sec: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,11 +115,11 @@ export interface NewsMeta {
|
||||
* @returns {NewsCard}
|
||||
*/
|
||||
export interface NewsCard {
|
||||
title: string
|
||||
cover: string
|
||||
post_id: number
|
||||
subtitle: string
|
||||
status?: ActivityStatus
|
||||
title: string;
|
||||
cover: string;
|
||||
post_id: number;
|
||||
subtitle: string;
|
||||
status?: ActivityStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,6 +130,6 @@ export interface NewsCard {
|
||||
* @returns {ActivityStatus}
|
||||
*/
|
||||
export interface ActivityStatus {
|
||||
status: string
|
||||
colorCss: string
|
||||
status: string;
|
||||
colorCss: string;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import { type MysObcResponse, type MysObc } from "./base";
|
||||
*/
|
||||
export interface PositionResponse extends MysObcResponse {
|
||||
data: {
|
||||
list: PositionObc[]
|
||||
}
|
||||
list: PositionObc[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ export interface PositionResponse extends MysObcResponse {
|
||||
* @returns {PositionObc}
|
||||
*/
|
||||
export interface PositionObc extends MysObc {
|
||||
list: PositionData[]
|
||||
list: PositionData[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,19 +53,19 @@ export interface PositionObc extends MysObc {
|
||||
* @returns {PositionData}
|
||||
*/
|
||||
export interface PositionData {
|
||||
recommend_id: number
|
||||
content_id: number
|
||||
title: string
|
||||
ext: string
|
||||
type: number
|
||||
url: string
|
||||
icon: string
|
||||
abstract: string
|
||||
article_user_name: string
|
||||
avatar_url: string
|
||||
article_time: string
|
||||
create_time: string
|
||||
end_time: string
|
||||
recommend_id: number;
|
||||
content_id: number;
|
||||
title: string;
|
||||
ext: string;
|
||||
type: number;
|
||||
url: string;
|
||||
icon: string;
|
||||
abstract: string;
|
||||
article_user_name: string;
|
||||
avatar_url: string;
|
||||
article_time: string;
|
||||
create_time: string;
|
||||
end_time: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,14 +84,14 @@ export interface PositionData {
|
||||
* @returns {PositionCard}
|
||||
*/
|
||||
export interface PositionCard {
|
||||
title: string
|
||||
post_id: number
|
||||
icon: string
|
||||
abstract: string
|
||||
title: string;
|
||||
post_id: number;
|
||||
icon: string;
|
||||
abstract: string;
|
||||
time: {
|
||||
start: string
|
||||
start_stamp: number
|
||||
end: string
|
||||
end_stamp: number
|
||||
}
|
||||
start: string;
|
||||
start_stamp: number;
|
||||
end: string;
|
||||
end_stamp: number;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import { type ImageData, type HelpSys } from "./utils";
|
||||
*/
|
||||
export interface PostResponse extends MysResponse {
|
||||
data: {
|
||||
post: PostData
|
||||
}
|
||||
post: PostData;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,27 +52,27 @@ export interface PostResponse extends MysResponse {
|
||||
* @returns {PostData}
|
||||
*/
|
||||
export interface PostData {
|
||||
post: Post
|
||||
forum: Forum
|
||||
topics: Topic[]
|
||||
user: UserInfoPost
|
||||
self_operation: SelfOperation
|
||||
stat: PostStat
|
||||
help_sys: HelpSys | null
|
||||
cover: ImageData | null
|
||||
image_list: ImageData[]
|
||||
is_official_master: boolean
|
||||
is_user_master: boolean
|
||||
hot_reply_exist: boolean
|
||||
vot_count: number
|
||||
last_modify_time: number
|
||||
recommend_type: string
|
||||
collection: unknown | null
|
||||
vod_list: unknown[]
|
||||
is_block_on: boolean
|
||||
forum_rank_info: unknown | null
|
||||
link_card_list: unknown[]
|
||||
news_meta: NewsMeta | null
|
||||
post: Post;
|
||||
forum: Forum;
|
||||
topics: Topic[];
|
||||
user: UserInfoPost;
|
||||
self_operation: SelfOperation;
|
||||
stat: PostStat;
|
||||
help_sys: HelpSys | null;
|
||||
cover: ImageData | null;
|
||||
image_list: ImageData[];
|
||||
is_official_master: boolean;
|
||||
is_user_master: boolean;
|
||||
hot_reply_exist: boolean;
|
||||
vot_count: number;
|
||||
last_modify_time: number;
|
||||
recommend_type: string;
|
||||
collection: unknown | null;
|
||||
vod_list: unknown[];
|
||||
is_block_on: boolean;
|
||||
forum_rank_info: unknown | null;
|
||||
link_card_list: unknown[];
|
||||
news_meta: NewsMeta | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,46 +121,46 @@ export interface PostData {
|
||||
* @returns {Post}
|
||||
*/
|
||||
export interface Post {
|
||||
game_id: number
|
||||
post_id: string
|
||||
f_forum_id: number
|
||||
uid: string
|
||||
subject: string
|
||||
content: string
|
||||
cover: string
|
||||
view_type: number
|
||||
created_at: number
|
||||
images: string[]
|
||||
game_id: number;
|
||||
post_id: string;
|
||||
f_forum_id: number;
|
||||
uid: string;
|
||||
subject: string;
|
||||
content: string;
|
||||
cover: string;
|
||||
view_type: number;
|
||||
created_at: number;
|
||||
images: string[];
|
||||
post_status: {
|
||||
is_top: boolean
|
||||
is_good: boolean
|
||||
is_official: boolean
|
||||
}
|
||||
topic_ids: number[]
|
||||
view_status: number
|
||||
max_floor: number
|
||||
is_original: number
|
||||
republish_authorization: number
|
||||
reply_time: string
|
||||
is_deleted: number
|
||||
is_interactive: boolean
|
||||
structured_content: string
|
||||
structured_content_rows: string[]
|
||||
review_id: number
|
||||
is_profit: boolean
|
||||
is_in_profit: boolean
|
||||
updated_at: number
|
||||
deleted_at: number
|
||||
pre_pub_status: number
|
||||
cate_id: number
|
||||
profit_post_status: number
|
||||
audit_status: number
|
||||
meta_content: string
|
||||
is_missing: boolean
|
||||
block_reply_img: number
|
||||
is_showing_missing: boolean
|
||||
block_latest_reply_time: number
|
||||
selected_comment: number
|
||||
is_top: boolean;
|
||||
is_good: boolean;
|
||||
is_official: boolean;
|
||||
};
|
||||
topic_ids: number[];
|
||||
view_status: number;
|
||||
max_floor: number;
|
||||
is_original: number;
|
||||
republish_authorization: number;
|
||||
reply_time: string;
|
||||
is_deleted: number;
|
||||
is_interactive: boolean;
|
||||
structured_content: string;
|
||||
structured_content_rows: string[];
|
||||
review_id: number;
|
||||
is_profit: boolean;
|
||||
is_in_profit: boolean;
|
||||
updated_at: number;
|
||||
deleted_at: number;
|
||||
pre_pub_status: number;
|
||||
cate_id: number;
|
||||
profit_post_status: number;
|
||||
audit_status: number;
|
||||
meta_content: string;
|
||||
is_missing: boolean;
|
||||
block_reply_img: number;
|
||||
is_showing_missing: boolean;
|
||||
block_latest_reply_time: number;
|
||||
selected_comment: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,11 +175,11 @@ export interface Post {
|
||||
* @returns {Forum}
|
||||
*/
|
||||
export interface Forum {
|
||||
id: number
|
||||
name: string
|
||||
icon: string
|
||||
game_id: number
|
||||
forum_cate: unknown | null
|
||||
id: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
game_id: number;
|
||||
forum_cate: unknown | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,14 +197,14 @@ export interface Forum {
|
||||
* @returns {Topic}
|
||||
*/
|
||||
export interface Topic {
|
||||
id: number
|
||||
name: string
|
||||
cover: string
|
||||
is_top: boolean
|
||||
is_good: boolean
|
||||
is_interactive: boolean
|
||||
game_id: number
|
||||
content_type: number
|
||||
id: number;
|
||||
name: string;
|
||||
cover: string;
|
||||
is_top: boolean;
|
||||
is_good: boolean;
|
||||
is_interactive: boolean;
|
||||
game_id: number;
|
||||
content_type: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,11 +219,11 @@ export interface Topic {
|
||||
* @returns {PostStat}
|
||||
*/
|
||||
export interface PostStat {
|
||||
view_num: number
|
||||
reply_num: number
|
||||
like_num: number
|
||||
bookmark_num: number
|
||||
forward_num: number
|
||||
view_num: number;
|
||||
reply_num: number;
|
||||
like_num: number;
|
||||
bookmark_num: number;
|
||||
forward_num: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,8 +236,8 @@ export interface PostStat {
|
||||
* @returns {PostContent}
|
||||
*/
|
||||
export interface PostContent {
|
||||
describe: string
|
||||
imgs?: string[]
|
||||
describe: string;
|
||||
imgs?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,38 +271,37 @@ export interface PostContent {
|
||||
* @returns {PostStructuredContent}
|
||||
*/
|
||||
export interface PostStructuredContent {
|
||||
|
||||
insert:
|
||||
| {
|
||||
image?: string
|
||||
video?: string
|
||||
vod?: PostStructuredContentVod
|
||||
backup_text?: string
|
||||
lottery?: {
|
||||
id: string
|
||||
toast: string
|
||||
}
|
||||
fold?: {
|
||||
title: string
|
||||
content: string
|
||||
}
|
||||
link_card?: PostStructuredContentLinkCard
|
||||
divider?: string
|
||||
mention?: {
|
||||
uid: string
|
||||
nickname: string
|
||||
}
|
||||
}
|
||||
| string
|
||||
| {
|
||||
image?: string;
|
||||
video?: string;
|
||||
vod?: PostStructuredContentVod;
|
||||
backup_text?: string;
|
||||
lottery?: {
|
||||
id: string;
|
||||
toast: string;
|
||||
};
|
||||
fold?: {
|
||||
title: string;
|
||||
content: string;
|
||||
};
|
||||
link_card?: PostStructuredContentLinkCard;
|
||||
divider?: string;
|
||||
mention?: {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
};
|
||||
}
|
||||
| string;
|
||||
attributes?: {
|
||||
height?: number
|
||||
width?: number
|
||||
size?: number
|
||||
ext?: string
|
||||
bold?: boolean
|
||||
color?: string
|
||||
link?: string
|
||||
}
|
||||
height?: number;
|
||||
width?: number;
|
||||
size?: number;
|
||||
ext?: string;
|
||||
bold?: boolean;
|
||||
color?: string;
|
||||
link?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,22 +326,22 @@ export interface PostStructuredContent {
|
||||
* @returns {PostStructuredContentVod}
|
||||
*/
|
||||
export interface PostStructuredContentVod {
|
||||
id: number
|
||||
duration: number
|
||||
cover: string
|
||||
id: number;
|
||||
duration: number;
|
||||
cover: string;
|
||||
resolutions: Array<{
|
||||
url: string
|
||||
definition: string
|
||||
height: number
|
||||
width: number
|
||||
bitrate: number
|
||||
size: number
|
||||
format: string
|
||||
label: string
|
||||
}>
|
||||
view_num: number
|
||||
transcoding_status: number
|
||||
review_status: number
|
||||
url: string;
|
||||
definition: string;
|
||||
height: number;
|
||||
width: number;
|
||||
bitrate: number;
|
||||
size: number;
|
||||
format: string;
|
||||
label: string;
|
||||
}>;
|
||||
view_num: number;
|
||||
transcoding_status: number;
|
||||
review_status: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,15 +362,15 @@ export interface PostStructuredContentVod {
|
||||
* @returns {PostStructuredContentLinkCard}
|
||||
*/
|
||||
export interface PostStructuredContentLinkCard {
|
||||
link_type: number
|
||||
origin_url: string
|
||||
landing_url: string
|
||||
cover: string
|
||||
title: string
|
||||
card_id: string
|
||||
card_status: number
|
||||
market_price: string
|
||||
price: string
|
||||
button_text: string
|
||||
landing_url_type: number
|
||||
link_type: number;
|
||||
origin_url: string;
|
||||
landing_url: string;
|
||||
cover: string;
|
||||
title: string;
|
||||
card_id: string;
|
||||
card_status: number;
|
||||
market_price: string;
|
||||
price: string;
|
||||
button_text: string;
|
||||
landing_url_type: number;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { type MysResponse } from "./base";
|
||||
* @returns {UserResponse}
|
||||
*/
|
||||
export interface UserResponse extends MysResponse {
|
||||
data: UserInfoFull
|
||||
data: UserInfoFull;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,23 +41,23 @@ export interface UserResponse extends MysResponse {
|
||||
* @returns {UserInfoFull}
|
||||
*/
|
||||
export interface UserInfoFull {
|
||||
user_info: UserInfo
|
||||
follow_relation: unknown
|
||||
auth_relations: unknown[]
|
||||
is_in_blacklist: boolean
|
||||
is_has_collection: boolean
|
||||
is_creator: boolean
|
||||
user_info: UserInfo;
|
||||
follow_relation: unknown;
|
||||
auth_relations: unknown[];
|
||||
is_in_blacklist: boolean;
|
||||
is_has_collection: boolean;
|
||||
is_creator: boolean;
|
||||
custom_service: {
|
||||
is_customer_service_staff: boolean
|
||||
game_id: number
|
||||
}
|
||||
is_customer_service_staff: boolean;
|
||||
game_id: number;
|
||||
};
|
||||
audit_info: {
|
||||
is_nickname_in_audit: boolean
|
||||
nickname: string
|
||||
is_introduce_in_audit: boolean
|
||||
introduce: string
|
||||
nickname_status: number
|
||||
}
|
||||
is_nickname_in_audit: boolean;
|
||||
nickname: string;
|
||||
is_introduce_in_audit: boolean;
|
||||
introduce: string;
|
||||
nickname_status: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,21 +82,21 @@ export interface UserInfoFull {
|
||||
* @returns {UserInfo}
|
||||
*/
|
||||
export interface UserInfo {
|
||||
uid: string
|
||||
nickname: string
|
||||
introduce: string
|
||||
avatar: string
|
||||
gender: number
|
||||
certification: UserCertification
|
||||
level_exps: UserLevelExp[]
|
||||
archive: UserArchive
|
||||
community_info: UserCommunityInfo
|
||||
avatar_url: string
|
||||
certifications: UserCertification[]
|
||||
level_exp: UserLevelExp
|
||||
pendant: string
|
||||
is_logoff: boolean
|
||||
ip_region: string
|
||||
uid: string;
|
||||
nickname: string;
|
||||
introduce: string;
|
||||
avatar: string;
|
||||
gender: number;
|
||||
certification: UserCertification;
|
||||
level_exps: UserLevelExp[];
|
||||
archive: UserArchive;
|
||||
community_info: UserCommunityInfo;
|
||||
avatar_url: string;
|
||||
certifications: UserCertification[];
|
||||
level_exp: UserLevelExp;
|
||||
pendant: string;
|
||||
is_logoff: boolean;
|
||||
ip_region: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,8 +108,8 @@ export interface UserInfo {
|
||||
* @returns {UserCertification}
|
||||
*/
|
||||
export interface UserCertification {
|
||||
type: number
|
||||
label: string
|
||||
type: number;
|
||||
label: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,9 +123,9 @@ export interface UserCertification {
|
||||
* @returns {UserLevelExp}
|
||||
*/
|
||||
export interface UserLevelExp {
|
||||
level: number
|
||||
exp: number
|
||||
game_id: number
|
||||
level: number;
|
||||
exp: number;
|
||||
game_id: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,15 +144,15 @@ export interface UserLevelExp {
|
||||
* @returns {UserArchive}
|
||||
*/
|
||||
export interface UserArchive {
|
||||
like_num: string
|
||||
post_num: string
|
||||
replypost_num: string
|
||||
follow_cnt: string
|
||||
followed_cnt: string
|
||||
topic_cnt: string
|
||||
new_follower_num: string
|
||||
good_post_num: string
|
||||
follow_collection_cnt: string
|
||||
like_num: string;
|
||||
post_num: string;
|
||||
replypost_num: string;
|
||||
follow_cnt: string;
|
||||
followed_cnt: string;
|
||||
topic_cnt: string;
|
||||
new_follower_num: string;
|
||||
good_post_num: string;
|
||||
follow_collection_cnt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,36 +189,36 @@ export interface UserArchive {
|
||||
* @returns {UserCommunityInfo}
|
||||
*/
|
||||
export interface UserCommunityInfo {
|
||||
is_realname: boolean
|
||||
agree_status: boolean
|
||||
silent_end_time: number
|
||||
forbid_end_time: number
|
||||
info_upd_time: number
|
||||
is_realname: boolean;
|
||||
agree_status: boolean;
|
||||
silent_end_time: number;
|
||||
forbid_end_time: number;
|
||||
info_upd_time: number;
|
||||
privacy_invisible: {
|
||||
post: boolean
|
||||
collect: boolean
|
||||
watermark: boolean
|
||||
reply: boolean
|
||||
post_and_instant: boolean
|
||||
}
|
||||
post: boolean;
|
||||
collect: boolean;
|
||||
watermark: boolean;
|
||||
reply: boolean;
|
||||
post_and_instant: boolean;
|
||||
};
|
||||
notify_disable: {
|
||||
reply: boolean
|
||||
upvote: boolean
|
||||
follow: boolean
|
||||
system: boolean
|
||||
chat: boolean
|
||||
}
|
||||
has_initialized: boolean
|
||||
reply: boolean;
|
||||
upvote: boolean;
|
||||
follow: boolean;
|
||||
system: boolean;
|
||||
chat: boolean;
|
||||
};
|
||||
has_initialized: boolean;
|
||||
user_func_status: {
|
||||
enable_history_view: boolean
|
||||
enable_recommend: boolean
|
||||
enable_mention: boolean
|
||||
user_center_view: number
|
||||
}
|
||||
forum_silent_info: unknown[]
|
||||
last_login_ip: string
|
||||
last_login_time: number
|
||||
created_at: number
|
||||
enable_history_view: boolean;
|
||||
enable_recommend: boolean;
|
||||
enable_mention: boolean;
|
||||
user_center_view: number;
|
||||
};
|
||||
forum_silent_info: unknown[];
|
||||
last_login_ip: string;
|
||||
last_login_time: number;
|
||||
created_at: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,20 +241,20 @@ export interface UserCommunityInfo {
|
||||
* @returns {UserInfoPost}
|
||||
*/
|
||||
export interface UserInfoPost {
|
||||
uid: string
|
||||
nickname: string
|
||||
introduce: string
|
||||
avatar: string
|
||||
gender: number
|
||||
certification: UserCertification
|
||||
uid: string;
|
||||
nickname: string;
|
||||
introduce: string;
|
||||
avatar: string;
|
||||
gender: number;
|
||||
certification: UserCertification;
|
||||
level_exp: {
|
||||
level: number
|
||||
exp: number
|
||||
}
|
||||
is_following: boolean
|
||||
is_follower: boolean
|
||||
avatar_url: string
|
||||
pendant: string
|
||||
level: number;
|
||||
exp: number;
|
||||
};
|
||||
is_following: boolean;
|
||||
is_follower: boolean;
|
||||
avatar_url: string;
|
||||
pendant: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,6 +266,6 @@ export interface UserInfoPost {
|
||||
* @returns {SelfOperation}
|
||||
*/
|
||||
export interface SelfOperation {
|
||||
attitude: number
|
||||
is_collected: boolean
|
||||
attitude: number;
|
||||
is_collected: boolean;
|
||||
}
|
||||
|
||||
@@ -41,23 +41,23 @@ export const OBC_CONTENT_API =
|
||||
* @returns {ImageData}
|
||||
*/
|
||||
export interface ImageData {
|
||||
url: string
|
||||
height: number
|
||||
width: number
|
||||
format: string
|
||||
size: string
|
||||
url: string;
|
||||
height: number;
|
||||
width: number;
|
||||
format: string;
|
||||
size: string;
|
||||
crop: {
|
||||
x: number
|
||||
y: number
|
||||
w: number
|
||||
h: number
|
||||
url: string
|
||||
} | null
|
||||
is_user_set_cover: boolean
|
||||
image_id: string
|
||||
entity_type: string
|
||||
entity_id: string
|
||||
is_deleted: boolean
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
url: string;
|
||||
} | null;
|
||||
is_user_set_cover: boolean;
|
||||
image_id: string;
|
||||
entity_type: string;
|
||||
entity_id: string;
|
||||
is_deleted: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ export interface ImageData {
|
||||
* @returns {HelpSys}
|
||||
*/
|
||||
export interface HelpSys {
|
||||
top_up: unknown | null
|
||||
top_n: unknown[]
|
||||
answer_num: number
|
||||
top_up: unknown | null;
|
||||
top_n: unknown[];
|
||||
answer_num: number;
|
||||
}
|
||||
|
||||
@@ -9,21 +9,22 @@ import { http } from "@tauri-apps/api";
|
||||
import { type GachaResponse, type GachaData } from "../interface/gacha";
|
||||
|
||||
// 卡池 API
|
||||
const GACHA_POOL_API = "https://api-takumi.mihoyo.com/common/blackboard/ys_obc/v1/gacha_pool?app_sn=ys_obc";
|
||||
const GACHA_POOL_API =
|
||||
"https://api-takumi.mihoyo.com/common/blackboard/ys_obc/v1/gacha_pool?app_sn=ys_obc";
|
||||
|
||||
/**
|
||||
* @description 获取卡池信息
|
||||
* @since Alpha
|
||||
* @return {Promise<GachaData[]>}
|
||||
*/
|
||||
export async function getGachaData (): Promise<GachaData[]> {
|
||||
export async function getGachaData(): Promise<GachaData[]> {
|
||||
return await http
|
||||
.fetch<GachaResponse>(GACHA_POOL_API, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data.data.list;
|
||||
});
|
||||
|
||||
@@ -9,7 +9,8 @@ import { http } from "@tauri-apps/api";
|
||||
import { type LotteryResponse, type LotteryData } from "../interface/lottery";
|
||||
|
||||
// 抽奖 API
|
||||
const LOTTERY_API = "https://bbs-api.miyoushe.com/painter/wapi/lottery/user/show?gids=2&id={lottery_id}";
|
||||
const LOTTERY_API =
|
||||
"https://bbs-api.miyoushe.com/painter/wapi/lottery/user/show?gids=2&id={lottery_id}";
|
||||
|
||||
/**
|
||||
* @description 获取抽奖信息
|
||||
@@ -17,14 +18,14 @@ const LOTTERY_API = "https://bbs-api.miyoushe.com/painter/wapi/lottery/user/show
|
||||
* @param {string} lotteryId 抽奖 ID
|
||||
* @return {Promise<LotteryData>}
|
||||
*/
|
||||
export async function getLotteryData (lotteryId: string): Promise<LotteryData> {
|
||||
export async function getLotteryData(lotteryId: string): Promise<LotteryData> {
|
||||
return await http
|
||||
.fetch<LotteryResponse>(LOTTERY_API.replace("{lottery_id}", lotteryId), {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data.data.show_lottery;
|
||||
});
|
||||
|
||||
@@ -37,7 +37,11 @@ enum NewsType {
|
||||
* @param {number} lastId 上一次请求的最后一条数据的 id
|
||||
* @return {Promise<NewsData>}
|
||||
*/
|
||||
export async function getNoticeList (gid: string = "2", pageSize: number = 20, lastId: number = 0): Promise<NewsData> {
|
||||
export async function getNoticeList(
|
||||
gid: string = "2",
|
||||
pageSize: number = 20,
|
||||
lastId: number = 0,
|
||||
): Promise<NewsData> {
|
||||
const url = NEWS_LIST_API.replace("{page_size}", pageSize.toString())
|
||||
.replace("{gid}", gid)
|
||||
.replace("{news_type}", NewsType.NOTICE)
|
||||
@@ -53,7 +57,11 @@ export async function getNoticeList (gid: string = "2", pageSize: number = 20, l
|
||||
* @param {number} lastId 上一次请求的最后一条数据的 id
|
||||
* @return {Promise<NewsData>}
|
||||
*/
|
||||
export async function getActivityList (gid: string = "2", pageSize: number = 20, lastId: number = 0): Promise<NewsData> {
|
||||
export async function getActivityList(
|
||||
gid: string = "2",
|
||||
pageSize: number = 20,
|
||||
lastId: number = 0,
|
||||
): Promise<NewsData> {
|
||||
const url = NEWS_LIST_API.replace("{page_size}", pageSize.toString())
|
||||
.replace("{gid}", gid)
|
||||
.replace("{news_type}", NewsType.ACTIVITY)
|
||||
@@ -69,7 +77,11 @@ export async function getActivityList (gid: string = "2", pageSize: number = 20,
|
||||
* @param {number} lastId 上一次请求的最后一条数据的 id
|
||||
* @return {Promise<NewsData>}
|
||||
*/
|
||||
export async function getNewsList (gid: string = "2", pageSize: number = 20, lastId: number = 0): Promise<NewsData> {
|
||||
export async function getNewsList(
|
||||
gid: string = "2",
|
||||
pageSize: number = 20,
|
||||
lastId: number = 0,
|
||||
): Promise<NewsData> {
|
||||
const url = NEWS_LIST_API.replace("{page_size}", pageSize.toString())
|
||||
.replace("{gid}", gid)
|
||||
.replace("{news_type}", NewsType.NEWS)
|
||||
|
||||
@@ -10,21 +10,22 @@ import { type PositionResponse, type PositionData } from "../interface/position"
|
||||
import { dfs } from "../utils/position";
|
||||
|
||||
// 热点追踪 API
|
||||
const POSITION_API = "https://api-static.mihoyo.com/common/blackboard/ys_obc/v1/home/position?app_sn=ys_obc";
|
||||
const POSITION_API =
|
||||
"https://api-static.mihoyo.com/common/blackboard/ys_obc/v1/home/position?app_sn=ys_obc";
|
||||
|
||||
/**
|
||||
* @description 获取热点追踪信息
|
||||
* @since Alpha v0.1.1
|
||||
* @return {Promise<PositionData[]>}
|
||||
*/
|
||||
export async function getPositionData (): Promise<PositionData[]> {
|
||||
export async function getPositionData(): Promise<PositionData[]> {
|
||||
const res = await http
|
||||
.fetch<PositionResponse>(POSITION_API, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data.data.list;
|
||||
});
|
||||
|
||||
@@ -18,15 +18,15 @@ const POST_REFERER = "https://bbs.mihoyo.com/";
|
||||
* @param {number} postId 帖子 ID
|
||||
* @return {Promise<PostData>}
|
||||
*/
|
||||
export async function getPostData (postId: number): Promise<PostData> {
|
||||
export async function getPostData(postId: number): Promise<PostData> {
|
||||
return await http
|
||||
.fetch<PostResponse>(POST_API.replace("{post_id}", postId.toString()), {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: POST_REFERER,
|
||||
},
|
||||
})
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: POST_REFERER,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data.data.post;
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ import { type GachaCard, type GachaData } from "../interface/gacha";
|
||||
* @param {Map<string>} poolCover 卡池封面
|
||||
* @returns {Promise<GachaCard[]>}
|
||||
*/
|
||||
export async function getGachaCard (
|
||||
export async function getGachaCard(
|
||||
gachaData: GachaData[],
|
||||
poolCover: Record<number, string> | undefined = undefined,
|
||||
): Promise<GachaCard[]> {
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
* @since Alpha v0.1.1
|
||||
*/
|
||||
|
||||
import { type LotteryData, type LotteryCard, type LotteryRewardCard, type LotteryReward } from "../interface/lottery";
|
||||
import {
|
||||
type LotteryData,
|
||||
type LotteryCard,
|
||||
type LotteryRewardCard,
|
||||
type LotteryReward,
|
||||
} from "../interface/lottery";
|
||||
|
||||
/**
|
||||
* @description 根据抽奖信息转为渲染用的抽奖信息
|
||||
@@ -13,7 +18,7 @@ import { type LotteryData, type LotteryCard, type LotteryRewardCard, type Lotter
|
||||
* @param {LotteryData} lotteryData 抽奖信息
|
||||
* @returns {LotteryCard}
|
||||
*/
|
||||
export function getLotteryCard (lotteryData: LotteryData): LotteryCard {
|
||||
export function getLotteryCard(lotteryData: LotteryData): LotteryCard {
|
||||
return {
|
||||
id: lotteryData.id,
|
||||
participantWay: lotteryData.participant_way,
|
||||
@@ -32,7 +37,7 @@ export function getLotteryCard (lotteryData: LotteryData): LotteryCard {
|
||||
* @param {LotteryReward} lotteryReward 抽奖奖励信息
|
||||
* @returns {LotteryRewardCard}
|
||||
*/
|
||||
export function getLotteryRewardCard (lotteryReward: LotteryReward): LotteryRewardCard {
|
||||
export function getLotteryRewardCard(lotteryReward: LotteryReward): LotteryRewardCard {
|
||||
return {
|
||||
rewardName: lotteryReward.reward_name,
|
||||
winnerNumber: lotteryReward.winner_number,
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
* @since Alpha v0.1.2
|
||||
*/
|
||||
|
||||
import { type NewsData, type NewsItem, type NewsCard, type ActivityStatus } from "../interface/news";
|
||||
import {
|
||||
type NewsData,
|
||||
type NewsItem,
|
||||
type NewsCard,
|
||||
type ActivityStatus,
|
||||
} from "../interface/news";
|
||||
|
||||
// 默认封面图
|
||||
const defaultCover = "/source/UI/defaultCover.webp";
|
||||
@@ -44,7 +49,7 @@ const EnumStatus = {
|
||||
* @param {number} status 活动状态码
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getActivityStatus (status: number): ActivityStatus {
|
||||
export function getActivityStatus(status: number): ActivityStatus {
|
||||
switch (status) {
|
||||
case 1:
|
||||
return EnumStatus.STARTED;
|
||||
@@ -63,7 +68,7 @@ export function getActivityStatus (status: number): ActivityStatus {
|
||||
* @param {NewsData} noticeData 公告数据
|
||||
* @returns {NewsCard[]}
|
||||
*/
|
||||
export function getNoticeCard (noticeData: NewsData): NewsCard[] {
|
||||
export function getNoticeCard(noticeData: NewsData): NewsCard[] {
|
||||
const noticeCard: NewsCard[] = [];
|
||||
noticeData.list.map((item: NewsItem) => {
|
||||
return noticeCard.push({
|
||||
@@ -82,7 +87,7 @@ export function getNoticeCard (noticeData: NewsData): NewsCard[] {
|
||||
* @param {NewsData} activityData 活动数据
|
||||
* @returns {NewsCard[]}
|
||||
*/
|
||||
export function getActivityCard (activityData: NewsData): NewsCard[] {
|
||||
export function getActivityCard(activityData: NewsData): NewsCard[] {
|
||||
const activityCard: NewsCard[] = [];
|
||||
activityData.list.map((item: NewsItem) => {
|
||||
const startTime = new Date(Number(item.news_meta.start_at_sec) * 1000).toLocaleDateString();
|
||||
@@ -105,7 +110,7 @@ export function getActivityCard (activityData: NewsData): NewsCard[] {
|
||||
* @param {NewsData} newsData 新闻数据
|
||||
* @returns {NewsCard[]}
|
||||
*/
|
||||
export function getNewsCard (newsData: NewsData): NewsCard[] {
|
||||
export function getNewsCard(newsData: NewsData): NewsCard[] {
|
||||
const newsCard: NewsCard[] = [];
|
||||
newsData.list.map((item: NewsItem) => {
|
||||
return newsCard.push({
|
||||
|
||||
@@ -12,7 +12,7 @@ import { type PostData, type PostStructuredContent } from "../interface/post";
|
||||
* @param {string} hex 16进制颜色
|
||||
* @returns {object} RGB 颜色
|
||||
*/
|
||||
function hexToRgb (hex: string): { r: number, g: number, b: number } {
|
||||
function hexToRgb(hex: string): { r: number; g: number; b: number } {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
if (result === null) {
|
||||
throw new Error("无法解析颜色");
|
||||
@@ -31,16 +31,20 @@ function hexToRgb (hex: string): { r: number, g: number, b: number } {
|
||||
* @param {string} colorFg 前景颜色
|
||||
* @returns {boolean} 是否相近
|
||||
*/
|
||||
function isColorSimilar (colorBg: string, colorFg: string): boolean {
|
||||
function isColorSimilar(colorBg: string, colorFg: string): boolean {
|
||||
const colorBgRGB = hexToRgb(colorBg);
|
||||
const colorFgRGB = hexToRgb(colorFg);
|
||||
const colorBgL = 0.2126 * colorBgRGB.r + 0.7152 * colorBgRGB.g + 0.0722 * colorBgRGB.b;
|
||||
const colorFgL = 0.2126 * colorFgRGB.r + 0.7152 * colorFgRGB.g + 0.0722 * colorFgRGB.b;
|
||||
const colorBgLum = colorBgL / 255;
|
||||
const colorFgLum = colorFgL / 255;
|
||||
const colorBgLumFinal = colorBgLum <= 0.03928 ? colorBgLum / 12.92 : Math.pow((colorBgLum + 0.055) / 1.055, 2.4);
|
||||
const colorFgLumFinal = colorFgLum <= 0.03928 ? colorFgLum / 12.92 : Math.pow((colorFgLum + 0.055) / 1.055, 2.4);
|
||||
const contrast = (Math.max(colorBgLumFinal, colorFgLumFinal) + 0.05) / (Math.min(colorBgLumFinal, colorFgLumFinal) + 0.05);
|
||||
const colorBgLumFinal =
|
||||
colorBgLum <= 0.03928 ? colorBgLum / 12.92 : Math.pow((colorBgLum + 0.055) / 1.055, 2.4);
|
||||
const colorFgLumFinal =
|
||||
colorFgLum <= 0.03928 ? colorFgLum / 12.92 : Math.pow((colorFgLum + 0.055) / 1.055, 2.4);
|
||||
const contrast =
|
||||
(Math.max(colorBgLumFinal, colorFgLumFinal) + 0.05) /
|
||||
(Math.min(colorBgLumFinal, colorFgLumFinal) + 0.05);
|
||||
return contrast <= 2.5;
|
||||
}
|
||||
|
||||
@@ -50,7 +54,7 @@ function isColorSimilar (colorBg: string, colorFg: string): boolean {
|
||||
* @param {string} url 链接
|
||||
* @returns {boolean} 是否是米游社帖子
|
||||
*/
|
||||
export function IsMysPost (url: string): boolean {
|
||||
export function IsMysPost(url: string): boolean {
|
||||
const regBBS = /^https:\/\/bbs\.mihoyo\.com\/\w+\/article\/\d+$/;
|
||||
const regMYS = /^https:\/\/www\.miyoushe\.com\/\w+\/article\/\d+$/;
|
||||
return regBBS.test(url) || regMYS.test(url);
|
||||
@@ -62,7 +66,7 @@ export function IsMysPost (url: string): boolean {
|
||||
* @param {string} url 链接
|
||||
* @returns {string} 帖子 id
|
||||
*/
|
||||
export function getPostId (url: string): string {
|
||||
export function getPostId(url: string): string {
|
||||
const postId: string | undefined = url.split("/").pop();
|
||||
if (postId === undefined) {
|
||||
throw new Error("无法获取帖子 id");
|
||||
@@ -77,7 +81,7 @@ export function getPostId (url: string): string {
|
||||
* @param {string} content 帖子内容
|
||||
* @returns {string} 解析后的内容
|
||||
*/
|
||||
export function contentParser (content: string): string {
|
||||
export function contentParser(content: string): string {
|
||||
const data = JSON.parse(content);
|
||||
const result: PostStructuredContent[] = [];
|
||||
// 遍历 data 属性,值
|
||||
@@ -114,7 +118,7 @@ export function contentParser (content: string): string {
|
||||
* @description 为了安全考虑,不会解析所有的属性,只会解析几个常用的属性
|
||||
* @returns {string} 解析后的HTML,可作为 v-html 使用
|
||||
*/
|
||||
export function PostParser (post: PostData): string {
|
||||
export function PostParser(post: PostData): string {
|
||||
const postContent = post.post.content;
|
||||
let parserData;
|
||||
if (postContent.startsWith("<")) {
|
||||
@@ -141,22 +145,22 @@ export function PostParser (post: PostData): string {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLDivElement | HTMLSpanElement} 解析后的中转
|
||||
*/
|
||||
function ParserTransfer (data: PostStructuredContent): HTMLDivElement | HTMLSpanElement {
|
||||
function ParserTransfer(data: PostStructuredContent): HTMLDivElement | HTMLSpanElement {
|
||||
if (typeof data.insert === "string") {
|
||||
return TextParser(data);
|
||||
} else if (data.insert.image) {
|
||||
return ImageParser(data);
|
||||
} else if (data.insert.vod) {
|
||||
} else if (data.insert.vod != null) {
|
||||
return VideoParser(data);
|
||||
} else if (data.insert.video) {
|
||||
return VideoParser(data);
|
||||
} else if (data.insert.backup_text) {
|
||||
return BackupTextParser(data);
|
||||
} else if (data.insert.link_card) {
|
||||
} else if (data.insert.link_card != null) {
|
||||
return LinkCardParser(data);
|
||||
} else if (data.insert.divider) {
|
||||
return DividerParser(data);
|
||||
} else if (data.insert.mention) {
|
||||
} else if (data.insert.mention != null) {
|
||||
return MentionParser(data);
|
||||
} else {
|
||||
return UnknownParser(data);
|
||||
@@ -169,7 +173,7 @@ function ParserTransfer (data: PostStructuredContent): HTMLDivElement | HTMLSpan
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLDivElement} 解析后的未知数据
|
||||
*/
|
||||
function UnknownParser (data: PostStructuredContent): HTMLDivElement {
|
||||
function UnknownParser(data: PostStructuredContent): HTMLDivElement {
|
||||
// 创建 div
|
||||
const div = document.createElement("div");
|
||||
div.classList.add("mys-post-unknown");
|
||||
@@ -188,7 +192,7 @@ function UnknownParser (data: PostStructuredContent): HTMLDivElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLSpanElement} 解析后的文本
|
||||
*/
|
||||
function TextParser (data: PostStructuredContent): HTMLSpanElement {
|
||||
function TextParser(data: PostStructuredContent): HTMLSpanElement {
|
||||
// 检查数据
|
||||
if (typeof data.insert !== "string") {
|
||||
throw new Error("data.insert is not a string");
|
||||
@@ -196,7 +200,7 @@ function TextParser (data: PostStructuredContent): HTMLSpanElement {
|
||||
// 创建文本
|
||||
const text = document.createElement("span");
|
||||
// 设置文本属性
|
||||
if (data.attributes) {
|
||||
if (data.attributes != null) {
|
||||
if (data.attributes.bold) text.style.fontWeight = "bold";
|
||||
if (data.attributes.color) {
|
||||
let colorGet = data.attributes.color;
|
||||
@@ -224,12 +228,12 @@ function TextParser (data: PostStructuredContent): HTMLSpanElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLSpanElement} 解析后的链接
|
||||
*/
|
||||
function LinkTextParser (data: PostStructuredContent): HTMLSpanElement {
|
||||
function LinkTextParser(data: PostStructuredContent): HTMLSpanElement {
|
||||
// 检查数据
|
||||
if (typeof data.insert !== "string") {
|
||||
throw new Error("data.insert is not a string");
|
||||
}
|
||||
if (!data.attributes) {
|
||||
if (data.attributes == null) {
|
||||
throw new Error("data.attributes is not defined");
|
||||
}
|
||||
if (!data.attributes.link) {
|
||||
@@ -263,7 +267,7 @@ function LinkTextParser (data: PostStructuredContent): HTMLSpanElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLDivElement} 解析后的分割线
|
||||
*/
|
||||
function DividerParser (data: PostStructuredContent): HTMLDivElement {
|
||||
function DividerParser(data: PostStructuredContent): HTMLDivElement {
|
||||
// 数据检查
|
||||
if (typeof data.insert === "string") {
|
||||
throw new Error("data.insert is a string");
|
||||
@@ -286,7 +290,8 @@ function DividerParser (data: PostStructuredContent): HTMLDivElement {
|
||||
img.src =
|
||||
"https://mihoyo-community-web.oss-cn-shanghai.aliyuncs.com/upload/2021/01/05/e7047588e912d60ff87a975e037c7606.png";
|
||||
} else if (data.insert.divider === "line_4") {
|
||||
img.src = "https://mihoyo-community-web.oss-cn-shanghai.aliyuncs.com/upload/2022/07/13/line_4.png";
|
||||
img.src =
|
||||
"https://mihoyo-community-web.oss-cn-shanghai.aliyuncs.com/upload/2022/07/13/line_4.png";
|
||||
} else {
|
||||
console.error("Unknown divider type", data);
|
||||
return UnknownParser(data);
|
||||
@@ -303,7 +308,7 @@ function DividerParser (data: PostStructuredContent): HTMLDivElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLDivElement} 解析后的图片
|
||||
*/
|
||||
function ImageParser (data: PostStructuredContent): HTMLDivElement {
|
||||
function ImageParser(data: PostStructuredContent): HTMLDivElement {
|
||||
// 检查数据
|
||||
if (typeof data.insert === "string") {
|
||||
throw new Error("data.insert is a string");
|
||||
@@ -340,18 +345,18 @@ function ImageParser (data: PostStructuredContent): HTMLDivElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLDivElement} 解析后的视频
|
||||
*/
|
||||
function VideoParser (data: PostStructuredContent): HTMLDivElement {
|
||||
function VideoParser(data: PostStructuredContent): HTMLDivElement {
|
||||
// 检查数据
|
||||
if (typeof data.insert === "string") {
|
||||
throw new Error("data.insert is a string");
|
||||
}
|
||||
if (!data.insert.vod && !data.insert.video) {
|
||||
if (data.insert.vod == null && !data.insert.video) {
|
||||
throw new Error("data.insert.vod is not defined");
|
||||
}
|
||||
// 创建 div
|
||||
const div = document.createElement("div");
|
||||
div.classList.add("mys-post-div");
|
||||
if (data.insert.vod) {
|
||||
if (data.insert.vod != null) {
|
||||
// 创建视频
|
||||
const video = document.createElement("video");
|
||||
video.classList.add("mys-post-vod");
|
||||
@@ -390,7 +395,7 @@ function VideoParser (data: PostStructuredContent): HTMLDivElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLDivElement} 解析后的折叠内容
|
||||
*/
|
||||
function BackupTextParser (data: PostStructuredContent): HTMLDivElement {
|
||||
function BackupTextParser(data: PostStructuredContent): HTMLDivElement {
|
||||
// 检查数据
|
||||
if (typeof data.insert === "string") {
|
||||
throw new Error("data.insert is a string");
|
||||
@@ -398,7 +403,7 @@ function BackupTextParser (data: PostStructuredContent): HTMLDivElement {
|
||||
if (data.insert.backup_text === "[抽奖]") {
|
||||
return LotteryParser(data);
|
||||
}
|
||||
if (!data.insert.fold) {
|
||||
if (data.insert.fold == null) {
|
||||
throw new Error("data.insert.fold is not defined");
|
||||
}
|
||||
// 转换
|
||||
@@ -436,7 +441,7 @@ function BackupTextParser (data: PostStructuredContent): HTMLDivElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLDivElement} 解析后的抽奖
|
||||
*/
|
||||
function LotteryParser (data: PostStructuredContent): HTMLDivElement {
|
||||
function LotteryParser(data: PostStructuredContent): HTMLDivElement {
|
||||
// 检查数据
|
||||
if (typeof data.insert === "string") {
|
||||
throw new Error("data.insert is a string");
|
||||
@@ -447,7 +452,7 @@ function LotteryParser (data: PostStructuredContent): HTMLDivElement {
|
||||
if (data.insert.backup_text !== "[抽奖]") {
|
||||
throw new Error("data.insert.backup_text is not [抽奖]");
|
||||
}
|
||||
if (!data.insert.lottery) {
|
||||
if (data.insert.lottery == null) {
|
||||
throw new Error("data.insert.lottery is not defined");
|
||||
}
|
||||
// 创建 div
|
||||
@@ -474,12 +479,12 @@ function LotteryParser (data: PostStructuredContent): HTMLDivElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLDivElement} 解析后的链接卡片
|
||||
*/
|
||||
function LinkCardParser (data: PostStructuredContent): HTMLDivElement {
|
||||
function LinkCardParser(data: PostStructuredContent): HTMLDivElement {
|
||||
// 检查数据
|
||||
if (typeof data.insert === "string") {
|
||||
throw new Error("data.insert is a string");
|
||||
}
|
||||
if (!data.insert.link_card) {
|
||||
if (data.insert.link_card == null) {
|
||||
throw new Error("data.insert.link_card is not defined");
|
||||
}
|
||||
// 创建 div
|
||||
@@ -537,12 +542,12 @@ function LinkCardParser (data: PostStructuredContent): HTMLDivElement {
|
||||
* @param {PostStructuredContent} data Mys数据
|
||||
* @returns {HTMLAnchorElement} 解析后的 Mention
|
||||
*/
|
||||
function MentionParser (data: PostStructuredContent): HTMLAnchorElement {
|
||||
function MentionParser(data: PostStructuredContent): HTMLAnchorElement {
|
||||
// 检查数据
|
||||
if (typeof data.insert === "string") {
|
||||
throw new Error("data.insert is a string");
|
||||
}
|
||||
if (!data.insert.mention) {
|
||||
if (data.insert.mention == null) {
|
||||
throw new Error("data.insert.mention is not defined");
|
||||
}
|
||||
// 创建图标
|
||||
|
||||
@@ -13,7 +13,7 @@ import { type PositionObc, type PositionData, type PositionCard } from "../inter
|
||||
* @param {PositionObc[]} list 列表
|
||||
* @returns {PositionData[]} 返回列表
|
||||
*/
|
||||
export function dfs (list: PositionObc[]): PositionData[] {
|
||||
export function dfs(list: PositionObc[]): PositionData[] {
|
||||
const res: PositionData[] = [];
|
||||
for (const item of list) {
|
||||
if (item.name === "近期活动") {
|
||||
@@ -32,7 +32,7 @@ export function dfs (list: PositionObc[]): PositionData[] {
|
||||
* @param {PositionData[]} positionData 列表
|
||||
* @returns {PositionCard[]} 返回列表
|
||||
*/
|
||||
export function getPositionCard (positionData: PositionData[]): PositionCard[] {
|
||||
export function getPositionCard(positionData: PositionData[]): PositionCard[] {
|
||||
const res: PositionCard[] = [];
|
||||
positionData.map((position) => {
|
||||
let endStr: string;
|
||||
|
||||
Reference in New Issue
Block a user