mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-30 06:19:45 +08:00
♻️ 类型迁移&重构
This commit is contained in:
429
src/plugins/Mys/types/Post.d.ts
vendored
429
src/plugins/Mys/types/Post.d.ts
vendored
@@ -1,429 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/post.d.ts
|
||||
* @description Mys 插件帖子类型定义文件
|
||||
* @since Beta v0.7.1
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.Post {
|
||||
/**
|
||||
* @description 帖子返回数据
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Response
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {FullData} data.post 帖子数据
|
||||
* @return Response
|
||||
*/
|
||||
type Response = TGApp.BBS.Response.BaseWithData & { data: { post: FullData } };
|
||||
|
||||
/**
|
||||
* @description 帖子数据
|
||||
* @since Beta v0.6.7
|
||||
* @interface FullData
|
||||
* @property {Post} post 帖子信息
|
||||
* @property {Forum|null} forum 所属版块,可能为 null
|
||||
* @property {Array<TGApp.BBS.Topic.Info>} topics 所属话题
|
||||
* @property {TGApp.Plugins.Mys.User.Post|null} user 发帖人,可能为 null
|
||||
* @property {TGApp.Plugins.Mys.User.SelfOperation} self_operation 当前用户操作
|
||||
* @property {Stat|null} stat 帖子统计,可能为 null
|
||||
* @property {HelpSys} help_sys 帮助系统,可能为 null
|
||||
* @property {Image} cover 封面图,可能为 null
|
||||
* @property {Image[]} image_list 图片列表
|
||||
* @property {boolean} is_official_master 是否为官方帖
|
||||
* @property {boolean} is_user_master 是否为用户帖
|
||||
* @property {boolean} hot_reply_exist 是否存在热门回复
|
||||
* @property {number} vote_count 投票数
|
||||
* @property {number} last_modify_time 最后修改时间
|
||||
* @property {string} recommend_type 推荐类型
|
||||
* @property {Collection} collection 合集,可能为 null
|
||||
* @property {unknown[]} vod_list 视频列表,可能为空
|
||||
* @property {boolean} is_block_on 是否被屏蔽
|
||||
* @property {unknown} forum_rank_info 版块排行信息,可能为 null
|
||||
* @property {LinkCard[]} link_card_list 链接卡片列表,可能为空
|
||||
* @property {NewsMeta} news_meta 咨讯元数据,可能为 null
|
||||
* @return FullData
|
||||
*/
|
||||
interface FullData {
|
||||
post: Post;
|
||||
forum: Forum | null;
|
||||
topics: Array<TGApp.BBS.Topic.Info>;
|
||||
user: TGApp.Plugins.Mys.User.Post | null;
|
||||
self_operation: TGApp.Plugins.Mys.User.SelfOperation;
|
||||
stat: Stat | null;
|
||||
help_sys: HelpSys | null;
|
||||
cover: Image | null;
|
||||
image_list: Image[];
|
||||
is_official_master: boolean;
|
||||
is_user_master: boolean;
|
||||
hot_reply_exist: boolean;
|
||||
vote_count: number;
|
||||
last_modify_time: number;
|
||||
recommend_type: string;
|
||||
collection: Collection | null;
|
||||
vod_list: Vod[];
|
||||
is_block_on: boolean;
|
||||
forum_rank_info: unknown | null;
|
||||
link_card_list: LinkCard[];
|
||||
news_meta?: NewsMeta | null;
|
||||
recommend_reason: unknown | null;
|
||||
villa_card: unknown | null;
|
||||
is_mentor: boolean;
|
||||
villa_room_card: unknown | null;
|
||||
reply_avatar_action_info: unknown | null;
|
||||
challenge: unknown | null;
|
||||
hot_reply_list: unknown[];
|
||||
villa_msg_image_list: unknown[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 帖子信息
|
||||
* @since Beta v0.3.7
|
||||
* @interface Post
|
||||
* @property {number} game_id 游戏 ID // 2 为原神
|
||||
* @property {string} post_id 帖子 ID
|
||||
* @property {number} f_forum_id 所属版块 ID
|
||||
* @property {string} uid 发帖人 UID
|
||||
* @property {string} subject 帖子标题
|
||||
* @property {string} content 帖子内容,为 html 格式
|
||||
* @property {string} cover 封面图 URL,可能为 ""
|
||||
* @property {number} view_type 浏览类型
|
||||
* @property {number} created_at 发帖时间
|
||||
* @property {string[]} images 图片列表,可能为空
|
||||
* @property post_status 帖子状态
|
||||
* @property {boolean} post_status.is_top 是否置顶
|
||||
* @property {boolean} post_status.is_good 是否加精
|
||||
* @property {boolean} post_status.is_official 是否官方
|
||||
* @property {number} post_status.post_status 帖子状态
|
||||
* @property {number[]} topic_ids 所属话题 ID 列表
|
||||
* @property {number} view_status 浏览状态
|
||||
* @property {number} max_floor 最大楼层
|
||||
* @property {number} is_original 是否原创
|
||||
* @property {number} republish_authorization 是否授权转载
|
||||
* @property {string} reply_time 最后回复时间 // "2023-03-05 20:26:54"
|
||||
* @property {number} is_deleted 是否删除
|
||||
* @property {boolean} is_interactive 是否互动
|
||||
* @property {string} structured_content 结构化内容 // 反序列化后为 TGApp.Plugins.Mys.SctPost.Common[]
|
||||
* @property {string[]} structured_content_rows 结构化内容原始数据
|
||||
* @property {number} review_id 审核ID
|
||||
* @property {boolean} is_profit 是否盈利
|
||||
* @property {boolean} is_in_profit 是否在盈利
|
||||
* @property {number} updated_at 更新时间
|
||||
* @property {number} deleted_at 删除时间
|
||||
* @property {number} pre_pub_status 预发布状态
|
||||
* @property {number} cate_id 分类ID
|
||||
* @property {number} profit_post_status 盈利帖子状态
|
||||
* @property {number} audit_status 审核状态
|
||||
* @property {string} meta_content 元内容,可能为 ""
|
||||
* @property {boolean} is_missing 是否缺失
|
||||
* @property {number} block_reply_img 是否屏蔽回复图片
|
||||
* @property {boolean} is_showing_missing 是否显示缺失
|
||||
* @property {number} block_latest_reply_time 是否屏蔽最新回复时间
|
||||
* @property {number} selected_comment 是否选择评论
|
||||
* @property {boolean} is_mentor 是否为导师
|
||||
* @return Post
|
||||
*/
|
||||
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[];
|
||||
post_status: {
|
||||
is_top: boolean;
|
||||
is_good: boolean;
|
||||
is_official: boolean;
|
||||
post_status: number;
|
||||
};
|
||||
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_mentor: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 版块信息
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Forum
|
||||
* @property {number} id 版块 ID
|
||||
* @property {string} name 版块名称
|
||||
* @property {string} icon 版块图标 URL
|
||||
* @property {number} game_id 游戏 ID // 2 为原神
|
||||
* @property {unknown} forum_cate 版块分类,可能为 null
|
||||
* @return Forum
|
||||
*/
|
||||
interface Forum {
|
||||
id: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
game_id: number;
|
||||
forum_cate: unknown | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 帖子状态
|
||||
* @since Beta v0.3.7
|
||||
* @interface Stat
|
||||
* @property {number} view_num 浏览数
|
||||
* @property {number} reply_num 回复数
|
||||
* @property {number} like_num 点赞数
|
||||
* @property {number} bookmark_num 收藏数
|
||||
* @property {number} forward_num 转发数
|
||||
* @property post_upvote_stat 互动
|
||||
* @property {number} post_upvote_stat[].upvote_type 互动类型
|
||||
* @property {number} post_upvote_stat[].upvote_cnt 互动数量
|
||||
* @return Stat
|
||||
*/
|
||||
interface Stat {
|
||||
view_num: number;
|
||||
reply_num: number;
|
||||
like_num: number;
|
||||
bookmark_num: number;
|
||||
forward_num: number;
|
||||
original_like_num: number;
|
||||
post_upvote_stat: Array<{
|
||||
upvote_type: number;
|
||||
upvote_cnt: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 图片数据
|
||||
* @since Beta v0.5.5
|
||||
* @interface Image
|
||||
* @property {string} url 图片 URL
|
||||
* @property {number} height 图片高度
|
||||
* @property {string} width 图片宽度
|
||||
* @property {string} format 图片格式 // jpg
|
||||
* @property {string} size 图片大小 // 281428
|
||||
* @property crop 图片裁剪信息,可能为 null
|
||||
* @property {number} crop.x 裁剪 X 轴
|
||||
* @property {number} crop.y 裁剪 Y 轴
|
||||
* @property {number} crop.w 裁剪宽度
|
||||
* @property {number} crop.h 裁剪高度
|
||||
* @property {string} crop.url 裁剪图片 URL
|
||||
* @property {boolean} is_user_set_cover 是否为封面
|
||||
* @property {string} image_id 图片 ID
|
||||
* @property {string} entity_type 图片类型 // IMG_ENTITY_POST, IMG_ENTITY_UNKOWN
|
||||
* @property {string} entity_id 图片 ID
|
||||
* @property {boolean} is_deleted 是否已删除
|
||||
* @return Image
|
||||
*/
|
||||
interface Image {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description help_sys 信息
|
||||
* @since Alpha v0.2.1
|
||||
* @interface HelpSys
|
||||
* @property {unknown} top_up 置顶, 可能为 null
|
||||
* @property {unknown[]} top_n 置顶, 可能为空
|
||||
* @property {number} answer_num 回答数
|
||||
* @return HelpSys
|
||||
*/
|
||||
interface HelpSys {
|
||||
top_up: unknown | null;
|
||||
top_n: unknown[];
|
||||
answer_num: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 合集信息
|
||||
* @since Beta v0.3.9
|
||||
* @interface Collection
|
||||
* @property {string} prev_post_id 上一篇帖子 ID,为 0 说明没有上一篇
|
||||
* @property {string} next_post_id 下一篇帖子 ID,为 0 说明没有下一篇
|
||||
* @property {string} collection_id 合集 ID
|
||||
* @property {number} cur 第几篇
|
||||
* @property {number} total 总篇数
|
||||
* @property {string} collection_title 合集标题
|
||||
* @property {number} prev_post_game_id 上一篇帖子游戏 ID
|
||||
* @property {number} next_post_game_id 下一篇帖子游戏 ID
|
||||
* @property {number} prev_post_view_type 上一篇帖子浏览类型
|
||||
* @property {number} next_post_view_type 下一篇帖子浏览类型
|
||||
* @return Collection
|
||||
*/
|
||||
interface Collection {
|
||||
prev_post_id: string;
|
||||
next_post_id: string;
|
||||
collection_id: string;
|
||||
cur: number;
|
||||
total: number;
|
||||
collection_title: string;
|
||||
prev_post_game_id: number;
|
||||
next_post_game_id: number;
|
||||
prev_post_view_type: number;
|
||||
next_post_view_type: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 链接卡片信息
|
||||
* @since Beta v0.6.7
|
||||
* @interface LinkCard
|
||||
* @property {string} button_text 按钮文本
|
||||
* @property {string} card_id 卡片 ID
|
||||
* @property {unknown} card_meta 卡片元数据
|
||||
* @property {number} card_status 卡片状态
|
||||
* @property {string} cover 封面图 URL
|
||||
* @property {string} landing_url 落地页 URL
|
||||
* @property {number} landing_url_type 落地页类型
|
||||
* @property {number} link_type 链接类型
|
||||
* @property {string} market_price 市场价
|
||||
* @property {string} origin_url 原始 URL
|
||||
* @property {string} origin_user_avatar 原始用户头像 URL
|
||||
* @property {string} origin_user_avatar_url 原始用户头像 URL
|
||||
* @property {string} origin_user_nickname 原始用户名
|
||||
* @property {string} price 价格
|
||||
* @property {string} title 标题
|
||||
* @returns LinkCard
|
||||
*/
|
||||
type LinkCard = {
|
||||
button_text: string;
|
||||
card_id: string;
|
||||
card_meta: unknown;
|
||||
card_status: number;
|
||||
cover: string;
|
||||
landing_url: string;
|
||||
landing_url_type: number;
|
||||
link_type: number;
|
||||
market_price: string;
|
||||
origin_url: string;
|
||||
origin_user_avatar: string;
|
||||
origin_user_avatar_url: string;
|
||||
origin_user_nickname: string;
|
||||
price: string;
|
||||
title: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 视频信息
|
||||
* @since Beta v0.3.7
|
||||
* @interface Vod
|
||||
* @property {string} id 视频 ID
|
||||
* @property {number} duration 视频时长
|
||||
* @property {string} cover 视频封面图 URL
|
||||
* @property {string} resolutions[].url 视频 URL
|
||||
* @property {string} resolutions[].definition 视频清晰度
|
||||
* @property {number} resolutions[].width 视频宽度
|
||||
* @property {number} resolutions[].height 视频高度
|
||||
* @property {number} resolutions[].bitrate 视频码率
|
||||
* @property {string} resolutions[].size 视频大小
|
||||
* @property {string} resolutions[].format 视频格式
|
||||
* @property {string} resolutions[].label 视频标签
|
||||
* @property {number} view_num 观看数
|
||||
* @property {number} transcoding_status 转码状态
|
||||
* @property {number} review_status 审核状态
|
||||
* @property {string} brief_info 视频简介
|
||||
* @return Vod
|
||||
*/
|
||||
interface Vod {
|
||||
id: string;
|
||||
duration: number;
|
||||
cover: string;
|
||||
resolutions: Array<{
|
||||
url: string;
|
||||
definition: string;
|
||||
width: number;
|
||||
height: number;
|
||||
bitrate: number;
|
||||
size: string;
|
||||
format: string;
|
||||
label: string;
|
||||
}>;
|
||||
view_num: number;
|
||||
transcoding_status: number;
|
||||
review_status: number;
|
||||
brief_info: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 咨讯元数据,只有活动咨讯才有
|
||||
* @since Beta v0.7.1
|
||||
* @interface NewsMeta
|
||||
* @property {number} activity_status 活动状态 // ActivityStatus
|
||||
* @property {string} start_at_sec 活动开始时间戳,单位秒
|
||||
* @property {string} end_at_sec 活动结束时间戳,单位秒
|
||||
* @return NewsMeta
|
||||
*/
|
||||
type NewsMeta = { activity_status: number; start_at_sec: string; end_at_sec: string };
|
||||
|
||||
/**
|
||||
* @description 推荐理由
|
||||
* @since Beta v0.3.7
|
||||
* @interface RecommendReason
|
||||
* @property {string[]} tags 标签
|
||||
* @property {boolean} is_mentor_rec_block 是否为导师推荐
|
||||
* @return RecommendReason
|
||||
*/
|
||||
interface RecommendReason {
|
||||
tags: string[];
|
||||
is_mentor_rec_block: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 挑战
|
||||
* @since Beta v0.3.7
|
||||
* @interface Challenge
|
||||
* @property {string} id 挑战 ID
|
||||
* @property {string} title 挑战标题
|
||||
* @property {number} participant_amount 参与人数
|
||||
* @property {TGApp.Plugins.Mys.User.Challenge} sponsor 发起人
|
||||
* @property {TGApp.Plugins.Mys.User.Challenge[]} participants 参与人
|
||||
* @property {boolean} is_sandbox 是否为沙盒
|
||||
* @property {string} header_url 头像 URL
|
||||
* @property {string} post_id 帖子 ID
|
||||
* @return Challenge
|
||||
*/
|
||||
interface Challenge {
|
||||
id: string;
|
||||
title: string;
|
||||
participant_amount: number;
|
||||
sponsor: TGApp.Plugins.Mys.User.Challenge;
|
||||
participants: TGApp.Plugins.Mys.User.Challenge[];
|
||||
is_sandbox: boolean;
|
||||
header_url: string;
|
||||
post_id: string;
|
||||
}
|
||||
}
|
||||
44
src/plugins/Mys/types/SctPost.d.ts
vendored
44
src/plugins/Mys/types/SctPost.d.ts
vendored
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/SctPost.d.ts
|
||||
* @description Mys 插件 结构化帖子类型声明文件
|
||||
* @since Beta v0.6.7
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.SctPost {
|
||||
/**
|
||||
* @description 帖子结构化数据-基础类型
|
||||
* @since Beta v0.6.7
|
||||
* @interface Base
|
||||
* @property {string | Record<string, unknown>} insert - 帖子内容
|
||||
* @property {Record<string, unknown>} attributes - 帖子属性
|
||||
* @property {Base[]} children - 子帖子
|
||||
* @return Base
|
||||
*/
|
||||
type Base = {
|
||||
insert: string | Record<string, unknown>;
|
||||
attributes?: Record<string, unknown>;
|
||||
children?: Base[];
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 帖子结构化数据-空类型
|
||||
* @since Beta v0.3.4
|
||||
* @interface Empty
|
||||
* @property {never} insert - 帖子内容
|
||||
* @property {never} attributes - 帖子属性
|
||||
* @return Empty
|
||||
*/
|
||||
type Empty = { insert: never; attributes?: never };
|
||||
|
||||
/**
|
||||
* @description 帖子结构化数据-其他类型
|
||||
* @since Beta v0.6.7
|
||||
* @property {string} describe - 描述
|
||||
* @property {string[]} imgs - 图片链接
|
||||
* @property {string[]} link_card_ids - 关联卡片ID
|
||||
* @return Other
|
||||
*/
|
||||
type Other = { describe: string; imgs: string[]; link_card_ids?: string[] } & {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
}
|
||||
346
src/plugins/Mys/types/User.d.ts
vendored
346
src/plugins/Mys/types/User.d.ts
vendored
@@ -1,346 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/user.ts
|
||||
* @description Mys 插件用户类型定义文件
|
||||
* @since Beta v0.5.5
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.User {
|
||||
/**
|
||||
* @description 主页用户信息返回
|
||||
* @since Alpha v0.2.1
|
||||
* @interface HomeResponse
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {Home} data 用户信息
|
||||
* @return HomeResponse
|
||||
*/
|
||||
interface HomeResponse extends TGApp.BBS.Response.BaseWithData {
|
||||
data: Home;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 主页用户信息
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Home 用户信息
|
||||
* @property {Info} user_info 用户信息
|
||||
* @property {unknown} follow_relation 关注关系
|
||||
* @property {unknown[]} auth_relations 认证关系
|
||||
* @property {boolean} is_in_blacklist 是否在黑名单中
|
||||
* @property {boolean} is_has_collection 是否有收藏
|
||||
* @property {boolean} is_creator 是否是创作者
|
||||
* @property custom_service 客服信息
|
||||
* @property {boolean} custom_service.is_customer_service_staff 是否是客服
|
||||
* @property {number} custom_service.game_id 游戏 ID
|
||||
* @property audit_info 审核信息
|
||||
* @property {boolean} audit_info.is_nickname_in_audit 是否在昵称审核中
|
||||
* @property {string} audit_info.nickname 审核中的昵称
|
||||
* @property {boolean} audit_info.is_introduce_in_audit 是否在简介审核中
|
||||
* @property {string} audit_info.introduce 审核中的简介
|
||||
* @property {number} audit_info.nickname_status 昵称审核状态
|
||||
* @return Home
|
||||
*/
|
||||
interface Home {
|
||||
user_info: Info;
|
||||
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;
|
||||
};
|
||||
audit_info: {
|
||||
is_nickname_in_audit: boolean;
|
||||
nickname: string;
|
||||
is_introduce_in_audit: boolean;
|
||||
introduce: string;
|
||||
nickname_status: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 主页用户信息-二级
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Info
|
||||
* @property {string} uid 用户 ID
|
||||
* @property {string} nickname 用户昵称
|
||||
* @property {string} introduce 用户简介
|
||||
* @property {string} avatar 用户头像编号
|
||||
* @property {number} gender 用户性别
|
||||
* @property {Certification} certification 用户认证信息
|
||||
* @property {LevelExp[]} level_exps 用户等级经验
|
||||
* @property {Archive} archive 用户档案
|
||||
* @property {Community} community_info 用户社区信息
|
||||
* @property {string} avatar_url 用户头像链接
|
||||
* @property {Certification[]} certifications 用户认证信息
|
||||
* @property {LevelExp} level_exp 用户等级经验
|
||||
* @property {string} pendant 用户挂件 URL,可能为 ""
|
||||
* @property {boolean} is_logoff 是否注销
|
||||
* @property {string} ip_region 用户 IP 地区
|
||||
* @return Info
|
||||
*/
|
||||
interface Info {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
introduce: string;
|
||||
avatar: string;
|
||||
gender: number;
|
||||
certification: Certification;
|
||||
level_exps: LevelExp[];
|
||||
archive: Archive;
|
||||
community_info: Community;
|
||||
avatar_url: string;
|
||||
certifications: Certification[];
|
||||
level_exp: LevelExp;
|
||||
pendant: string;
|
||||
is_logoff: boolean;
|
||||
ip_region: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户认证信息
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Certification
|
||||
* @property {number} type 认证类型
|
||||
* @property {string} label 认证标签
|
||||
* @return Certification
|
||||
*/
|
||||
interface Certification {
|
||||
type: number;
|
||||
label: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户等级经验
|
||||
* @since Alpha v0.2.1
|
||||
* @interface LevelExp
|
||||
* @property {number} level 用户等级
|
||||
* @property {number} exp 用户经验
|
||||
* @property {number} game_id 游戏 ID
|
||||
* @return LevelExp
|
||||
*/
|
||||
interface LevelExp {
|
||||
level: number;
|
||||
exp: number;
|
||||
game_id: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户档案
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Archive
|
||||
* @property {string} like_num 获赞数
|
||||
* @property {string} post_num 发帖数
|
||||
* @property {string} replypost_num 回帖数
|
||||
* @property {string} follow_cnt 关注数
|
||||
* @property {string} followed_cnt 被关注数
|
||||
* @property {string} topic_cnt 话题数
|
||||
* @property {string} new_follower_num 新粉丝数
|
||||
* @property {string} good_post_num 精华帖数
|
||||
* @property {string} follow_collection_cnt 收藏数
|
||||
* @return Archive
|
||||
*/
|
||||
interface Archive {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户社区信息
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Community
|
||||
* @property {boolean} is_realname 是否实名
|
||||
* @property {boolean} agree_status 是否同意协议
|
||||
* @property {number} silent_end_time 禁言结束时间
|
||||
* @property {number} forbid_end_time 封禁结束时间
|
||||
* @property {number} info_upd_time 信息更新时间
|
||||
* @property privacy_invisible 用户隐私设置
|
||||
* @property {boolean} privacy_invisible.post 是否隐藏发帖
|
||||
* @property {boolean} privacy_invisible.collect 是否隐藏收藏
|
||||
* @property {boolean} privacy_invisible.watermark 是否隐藏水印
|
||||
* @property {boolean} privacy_invisible.reply 是否隐藏回复
|
||||
* @property {boolean} privacy_invisible.post_and_instant 是否隐藏发帖和即时
|
||||
* @property notify_disable 用户通知设置
|
||||
* @property {boolean} notify_disable.reply 是否禁用回复通知
|
||||
* @property {boolean} notify_disable.upvote 是否禁用点赞通知
|
||||
* @property {boolean} notify_disable.follow 是否禁用关注通知
|
||||
* @property {boolean} notify_disable.system 是否禁用系统通知
|
||||
* @property {boolean} notify_disable.chat 是否禁用聊天通知
|
||||
* @property {boolean} has_initialized 是否初始化
|
||||
* @property user_func_status 用户功能状态
|
||||
* @property {boolean} user_func_status.enable_history_view 是否启用历史记录
|
||||
* @property {boolean} user_func_status.enable_recommend 是否启用推荐
|
||||
* @property {boolean} user_func_status.enable_mention 是否启用提及
|
||||
* @property {number} user_func_status.user_center_view 是否启用用户中心\
|
||||
* @property {unknown[]} forum_silent_info 论坛禁言信息
|
||||
* @property {string} last_login_ip 上次登录 IP
|
||||
* @property {number} last_login_time 上次登录时间
|
||||
* @property {number} created_at 创建时间
|
||||
* @return Community
|
||||
*/
|
||||
interface Community {
|
||||
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;
|
||||
};
|
||||
notify_disable: {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description post中的用户信息
|
||||
* @since Beta v0.3.7
|
||||
* @interface Post
|
||||
* @property {string} uid 用户 ID
|
||||
* @property {string} nickname 用户昵称
|
||||
* @property {string} introduce 用户简介
|
||||
* @property {string} avatar 用户头像
|
||||
* @property {number} gender 用户性别
|
||||
* @property {Certification} certification 用户认证信息
|
||||
* @property level_exp 用户等级经验
|
||||
* @property {number} level_exp.level 用户等级
|
||||
* @property {number} level_exp.exp 用户经验
|
||||
* @property {boolean} is_following 是否关注
|
||||
* @property {boolean} is_followed 是否被关注
|
||||
* @property {string} avatar_url 用户头像链接
|
||||
* @property {string} pendant 用户挂件 URL,可能为 ""
|
||||
* @property {boolean} is_creator 是否是创作者
|
||||
* @property {AvatarExt} avatar_ext 用户头像扩展信息
|
||||
* @return Post
|
||||
*/
|
||||
interface Post {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
introduce: string;
|
||||
avatar: string;
|
||||
gender: number;
|
||||
certification: Certification;
|
||||
level_exp: {
|
||||
level: number;
|
||||
exp: number;
|
||||
};
|
||||
is_following: boolean;
|
||||
is_followed: boolean;
|
||||
avatar_url: string;
|
||||
pendant: string;
|
||||
is_creator: boolean;
|
||||
avatar_ext: AvatarExt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户操作
|
||||
* @since Beta v0.3.7
|
||||
* @interface SelfOperation
|
||||
* @property {number} attitude 操作类型
|
||||
* @property {boolean} is_collected 是否收藏
|
||||
* @property {number} upvote_type 互动类型
|
||||
* @returns {SelfOperation}
|
||||
*/
|
||||
interface SelfOperation {
|
||||
attitude: number;
|
||||
is_collected: boolean;
|
||||
upvote_type: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用户头像扩展信息
|
||||
* @since Beta v0.3.7
|
||||
* @interface AvatarExt
|
||||
* @property {number} avatar_type 头像类型
|
||||
* @property {string} avatar_assets_id 头像资源 ID
|
||||
* @property {unknown[]} resources 资源
|
||||
* @property {unknown[]} hd_resources 高清资源
|
||||
* @return AvatarExt
|
||||
*/
|
||||
interface AvatarExt {
|
||||
avatar_type: number;
|
||||
avatar_assets_id: string;
|
||||
resources: unknown[];
|
||||
hd_resources: unknown[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description post.challenge 用户挑战信息
|
||||
* @since Beta v0.3.7
|
||||
* @interface Challenge
|
||||
* @property {string} uid 用户 ID
|
||||
* @property {string} nickname 用户昵称
|
||||
* @property {string} avatar_url 用户头像链接
|
||||
* @return Challenge
|
||||
*/
|
||||
interface Challenge {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
avatar_url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 帖子回复中的用户信息
|
||||
* @since Beta v0.5.5
|
||||
* @interface Reply
|
||||
* @property {string} uid 用户 ID
|
||||
* @property {string} nickname 用户昵称
|
||||
* @property {string} introduce 用户简介
|
||||
* @property {string} avatar 用户头像
|
||||
* @property {number} gender 用户性别
|
||||
* @property {Certification} certification 用户认证信息
|
||||
* @property {LevelExp} level_exp 用户等级经验
|
||||
* @property {string} avatar_url 用户头像链接
|
||||
* @property {string} pendant 用户挂件 URL,可能为 ""
|
||||
* @property {string} ip_region 用户 IP 地区
|
||||
* @property {boolean} is_following 是否关注
|
||||
* @property {boolean} is_followed 是否被关注
|
||||
* @property {AvatarExt} avatar_ext 用户头像扩展信息
|
||||
* @property {boolean} is_super_fan 是否是铁粉
|
||||
* @property {TGApp.BBS.Reply.Bubble} reply_bubble 回复气泡,可能为 null
|
||||
* @return Reply
|
||||
*/
|
||||
interface Reply {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
introduce: string;
|
||||
avatar: string;
|
||||
gender: number;
|
||||
certification: Certification;
|
||||
level_exp: LevelExp;
|
||||
avatar_url: string;
|
||||
pendant: string;
|
||||
ip_region: string;
|
||||
is_following: boolean;
|
||||
is_followed: boolean;
|
||||
avatar_ext: AvatarExt;
|
||||
is_super_fan: boolean;
|
||||
reply_bubble: TGApp.BBS.Reply.Bubble | null;
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,10 @@ import { timestampToDate } from "@/utils/toolFunc.js";
|
||||
* @description 获取插入游戏账号数据的sql
|
||||
* @since Beta v0.6.0
|
||||
* @param {string} uid - 米社UID
|
||||
* @param {TGApp.BBS.Account.GameAccount} data - 游戏账号数据
|
||||
* @param {TGApp.BBS.Game.Account} data - 游戏账号数据
|
||||
* @return {string}
|
||||
*/
|
||||
function getInsertGameAccountSql(uid: string, data: TGApp.BBS.Account.GameAccount): string {
|
||||
function getInsertGameAccountSql(uid: string, data: TGApp.BBS.Game.Account): string {
|
||||
const isChosen = data.is_chosen ? 1 : 0;
|
||||
const isOfficial = data.is_official ? 1 : 0;
|
||||
const timeNow = timestampToDate(new Date().getTime());
|
||||
@@ -265,12 +265,12 @@ async function getCurGameAccount(uid: string): Promise<TGApp.Sqlite.Account.Game
|
||||
* @description 保存游戏账户数据
|
||||
* @since Beta v0.6.0
|
||||
* @param {string} uid - 米社UID
|
||||
* @param {TGApp.BBS.Account.GameAccount[]} accounts - 账户数据
|
||||
* @param {Array<TGApp.BBS.Game.Account>} accounts - 账户数据
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
async function saveGameAccount(
|
||||
uid: string,
|
||||
accounts: TGApp.BBS.Account.GameAccount[],
|
||||
accounts: Array<TGApp.BBS.Game.Account>,
|
||||
): Promise<void> {
|
||||
const db = await TGSqlite.getDB();
|
||||
for (const account of accounts) {
|
||||
|
||||
@@ -147,14 +147,14 @@ async function updateCollect(title: string, newTitle: string, newDesc: string):
|
||||
* @description 添加收藏
|
||||
* @since Beta v0.4.5
|
||||
* @param {string} postId 文章 id
|
||||
* @param {TGApp.Plugins.Mys.Post.FullData} post 文章信息
|
||||
* @param {TGApp.BBS.Post.FullData} post 文章信息
|
||||
* @param {string} collection 收藏合集标题,可能为 undefined
|
||||
* @param {boolean} recursive 是否递归添加
|
||||
* @return {Promise<boolean>} 返回是否添加成功
|
||||
*/
|
||||
async function addCollect(
|
||||
postId: string,
|
||||
post: TGApp.Plugins.Mys.Post.FullData,
|
||||
post: TGApp.BBS.Post.FullData,
|
||||
collection: string | undefined = undefined,
|
||||
recursive: boolean = false,
|
||||
): Promise<boolean> {
|
||||
@@ -219,13 +219,10 @@ async function addCollect(
|
||||
* @description 更新帖子信息
|
||||
* @since Beta v0.4.5
|
||||
* @param {string} postId 文章 id
|
||||
* @param {TGApp.Plugins.Mys.Post.FullData} post 文章信息
|
||||
* @param {TGApp.BBS.Post.FullData} post 文章信息
|
||||
* @return {Promise<boolean>} 返回是否更新成功
|
||||
*/
|
||||
async function updatePostInfo(
|
||||
postId: string,
|
||||
post: TGApp.Plugins.Mys.Post.FullData,
|
||||
): Promise<boolean> {
|
||||
async function updatePostInfo(postId: string, post: TGApp.BBS.Post.FullData): Promise<boolean> {
|
||||
const db = await TGSqlite.getDB();
|
||||
const sql = "SELECT id FROM UFPost WHERE id = ?";
|
||||
const res: Array<{ id: number }> = await db.select(sql, [postId]);
|
||||
|
||||
Reference in New Issue
Block a user