mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-28 05:59:46 +08:00
♻️ 类型迁移&重构
This commit is contained in:
@@ -75,7 +75,7 @@ import { computed, onMounted, shallowRef, watch } from "vue";
|
||||
import { generateShareImg } from "@/utils/TGShare.js";
|
||||
import { createPost } from "@/utils/TGWindow.js";
|
||||
|
||||
type TPostCardProps = { modelValue: TGApp.Plugins.Mys.Post.FullData; selectMode?: boolean };
|
||||
type TPostCardProps = { modelValue: TGApp.BBS.Post.FullData; selectMode?: boolean };
|
||||
type TPostCardEmits = (e: "onSelected", v: string) => void;
|
||||
type TPostStatus = RenderStatus & { stat: ActStat };
|
||||
type RenderForum = { name: string; icon: string; id: number };
|
||||
@@ -86,7 +86,7 @@ export type RenderCard = {
|
||||
cover: string;
|
||||
postId: number;
|
||||
subtitle: string;
|
||||
user: TGApp.Plugins.Mys.User.Post | null;
|
||||
user: TGApp.BBS.Post.User | null;
|
||||
forum: RenderForum | null;
|
||||
data: RenderData | null;
|
||||
status?: RenderStatus;
|
||||
@@ -130,7 +130,7 @@ function getActivityStatus(status: number): RenderStatus {
|
||||
return stats[ActStat.UNKNOWN];
|
||||
}
|
||||
|
||||
function getPostCover(item: TGApp.Plugins.Mys.Post.FullData): string {
|
||||
function getPostCover(item: TGApp.BBS.Post.FullData): string {
|
||||
let cover;
|
||||
if (item.cover) cover = item.cover.url;
|
||||
else if (item.post.cover) cover = item.post.cover;
|
||||
@@ -140,7 +140,7 @@ function getPostCover(item: TGApp.Plugins.Mys.Post.FullData): string {
|
||||
return `${cover}?x-oss-process=image/resize,m_fill,w_360,h_130,limit_0/format,png`;
|
||||
}
|
||||
|
||||
function getCommonCard(item: TGApp.Plugins.Mys.Post.FullData): RenderCard {
|
||||
function getCommonCard(item: TGApp.BBS.Post.FullData): RenderCard {
|
||||
let forumData: RenderForum | null = null;
|
||||
let statData: RenderData | null = null;
|
||||
if (item.forum !== null) {
|
||||
@@ -167,7 +167,7 @@ function getCommonCard(item: TGApp.Plugins.Mys.Post.FullData): RenderCard {
|
||||
};
|
||||
}
|
||||
|
||||
function getPostCard(item: TGApp.Plugins.Mys.Post.FullData): RenderCard {
|
||||
function getPostCard(item: TGApp.BBS.Post.FullData): RenderCard {
|
||||
const commonCard = getCommonCard(item);
|
||||
if (
|
||||
item.news_meta !== undefined &&
|
||||
|
||||
@@ -21,7 +21,7 @@ import parseAnnoContent from "@/web/utils/annoParser.js";
|
||||
type TaParserProps = { data: TGApp.BBS.Announcement.ContentItem };
|
||||
const props = defineProps<TaParserProps>();
|
||||
|
||||
function getTaName(ta: TGApp.Plugins.Mys.SctPost.Base): Component {
|
||||
function getTaName(ta: TGApp.BBS.SctPost.Base): Component {
|
||||
if (ta.children) return TpTexts;
|
||||
if (typeof ta.insert === "string") return TpText;
|
||||
if ("image" in ta.insert) return TpImage;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
import TMiImg from "@comp/app/t-mi-img.vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
type TpAvatarProps = { data: TGApp.Plugins.Mys.User.Post; position: "left" | "right" };
|
||||
type TpAvatarProps = { data: TGApp.BBS.Post.User; position: "left" | "right" };
|
||||
|
||||
const props = defineProps<TpAvatarProps>();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<TpParser :data="JSON.parse(props.data.insert.fold.content)" />
|
||||
</div>
|
||||
</details>
|
||||
<TpUnknown v-else :data="<TGApp.Plugins.Mys.SctPost.Empty>props.data" />
|
||||
<TpUnknown v-else :data="<TGApp.BBS.SctPost.Empty>props.data" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, toRaw } from "vue";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:title="props.data.insert.divider"
|
||||
/>
|
||||
</div>
|
||||
<TpUnknown v-else :data="<TGApp.Plugins.Mys.SctPost.Empty>props.data" />
|
||||
<TpUnknown v-else :data="<TGApp.BBS.SctPost.Empty>props.data" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
|
||||
@@ -24,7 +24,7 @@ import TpVillaCard from "./tp-villaCard.vue";
|
||||
import TpVod from "./tp-vod.vue";
|
||||
import TpVote from "./tp-vote.vue";
|
||||
|
||||
type SctPostDataArr = Array<TGApp.Plugins.Mys.SctPost.Base>;
|
||||
type SctPostDataArr = Array<TGApp.BBS.SctPost.Base>;
|
||||
type TpParserProps = { data: SctPostDataArr };
|
||||
|
||||
const props = defineProps<TpParserProps>();
|
||||
@@ -32,7 +32,7 @@ const props = defineProps<TpParserProps>();
|
||||
function getParsedData(data: SctPostDataArr): SctPostDataArr {
|
||||
const res: SctPostDataArr = [];
|
||||
let child: SctPostDataArr = [];
|
||||
let cur: TGApp.Plugins.Mys.SctPost.Base | undefined;
|
||||
let cur: TGApp.BBS.SctPost.Base | undefined;
|
||||
for (const tp of data) {
|
||||
const tpName = getTpName(tp);
|
||||
// 单独处理 TpMention
|
||||
@@ -90,7 +90,7 @@ function getParsedText(data: TpTextType): Array<TpTextType> {
|
||||
return [data];
|
||||
}
|
||||
|
||||
function getTpName(tp: TGApp.Plugins.Mys.SctPost.Base): Component {
|
||||
function getTpName(tp: TGApp.BBS.SctPost.Base): Component {
|
||||
if (tp.children) return TpTexts;
|
||||
if (typeof tp.insert === "string") return TpText;
|
||||
if ("backup_text" in tp.insert) return TpBackupText;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { onMounted, toRaw } from "vue";
|
||||
|
||||
import TGLogger from "@/utils/TGLogger.js";
|
||||
|
||||
type TpUnknownProps = { data: TGApp.Plugins.Mys.SctPost.Empty };
|
||||
type TpUnknownProps = { data: TGApp.BBS.SctPost.Empty };
|
||||
|
||||
const props = defineProps<TpUnknownProps>();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import VpOverlayCollect from "./vp-overlay-collect.vue";
|
||||
|
||||
import TGLogger from "@/utils/TGLogger.js";
|
||||
|
||||
type TbCollectProps = { modelValue: number; data?: TGApp.Plugins.Mys.Post.FullData };
|
||||
type TbCollectProps = { modelValue: number; data?: TGApp.BBS.Post.FullData };
|
||||
|
||||
const props = defineProps<TbCollectProps>();
|
||||
const isCollected = ref<boolean>(false);
|
||||
|
||||
@@ -39,7 +39,7 @@ import showSnackbar from "@comp/func/snackbar.js";
|
||||
import TSUserCollection from "@Sqlite/modules/userCollect.js";
|
||||
import { ref, shallowRef, watch } from "vue";
|
||||
|
||||
type ToPostCollectProps = { post?: TGApp.Plugins.Mys.Post.FullData };
|
||||
type ToPostCollectProps = { post?: TGApp.BBS.Post.FullData };
|
||||
type ToPostCollectEmits = (e: "submit") => void;
|
||||
|
||||
const props = defineProps<ToPostCollectProps>();
|
||||
|
||||
@@ -54,7 +54,7 @@ import { useRouter } from "vue-router";
|
||||
import { timestampToDate } from "@/utils/toolFunc.js";
|
||||
import postReq from "@/web/request/postReq.js";
|
||||
|
||||
type TpoCollectionProps = { collection: TGApp.Plugins.Mys.Post.Collection };
|
||||
type TpoCollectionProps = { collection: TGApp.BBS.Post.Collection };
|
||||
type TpoCollectionItem = {
|
||||
postId: string;
|
||||
title: string;
|
||||
|
||||
@@ -53,7 +53,7 @@ type RenderCard = {
|
||||
id: string;
|
||||
upWay: string;
|
||||
status: string;
|
||||
creator: TGApp.Plugins.Mys.User.Post;
|
||||
creator: TGApp.BBS.Post.User;
|
||||
drawTime: string;
|
||||
rewards: Array<RenderReward>;
|
||||
};
|
||||
@@ -61,7 +61,7 @@ type RenderReward = {
|
||||
name: string;
|
||||
win: number;
|
||||
goal: number;
|
||||
users: TGApp.Plugins.Mys.User.Post[];
|
||||
users: Array<TGApp.BBS.Post.User>;
|
||||
};
|
||||
|
||||
const props = defineProps<TpoLotteryProps>();
|
||||
|
||||
@@ -38,7 +38,7 @@ const lastId = ref<string>("");
|
||||
const game = ref<string>("2");
|
||||
const isLast = ref<boolean>(false);
|
||||
const load = ref<boolean>(false);
|
||||
const results = shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]);
|
||||
const results = shallowRef<Array<TGApp.BBS.Post.FullData>>([]);
|
||||
const gameName = computed<string>(
|
||||
() => TGBbs.channels.find((v) => v.gid.toString() === game.value)?.title || "未知分区",
|
||||
);
|
||||
|
||||
@@ -122,7 +122,7 @@ const collections = shallowRef<Array<TGApp.Sqlite.UserCollection.UFCollection>>(
|
||||
const selected = shallowRef<Array<TGApp.Sqlite.UserCollection.UFPost>>([]);
|
||||
const length = computed<number>(() => Math.ceil(selected.value.length / 12));
|
||||
const view = computed<number>(() => (length.value === 1 ? 1 : length.value > 5 ? 5 : length.value));
|
||||
const curPosts = computed<Array<TGApp.Plugins.Mys.Post.FullData>>(() =>
|
||||
const curPosts = computed<Array<TGApp.BBS.Post.FullData>>(() =>
|
||||
selected.value.slice((page.value - 1) * 12, page.value * 12).map((i) => JSON.parse(i.content)),
|
||||
);
|
||||
|
||||
@@ -372,10 +372,7 @@ async function freshUser(uid?: string): Promise<void> {
|
||||
}
|
||||
|
||||
// 合并收藏帖子
|
||||
async function mergePosts(
|
||||
posts: Array<TGApp.Plugins.Mys.Post.FullData>,
|
||||
collect: string,
|
||||
): Promise<void> {
|
||||
async function mergePosts(posts: Array<TGApp.BBS.Post.FullData>, collect: string): Promise<void> {
|
||||
const title = `用户收藏-${collect}`;
|
||||
for (const post of posts) {
|
||||
await showLoading.update(`[POST]${post.post.subject} [collection]${title}`);
|
||||
|
||||
@@ -159,7 +159,7 @@ const isReq = ref<boolean>(false);
|
||||
const selectedForum = shallowRef<SortSelect>();
|
||||
const sortGameList = shallowRef<Array<SortSelectGame>>([]);
|
||||
const postRaw = shallowRef<PostRaw>({ isLast: false, lastId: "", total: 0 });
|
||||
const posts = shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]);
|
||||
const posts = shallowRef<Array<TGApp.BBS.Post.FullData>>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
await showLoading.start("正在加载帖子数据");
|
||||
|
||||
@@ -72,7 +72,7 @@ import TGLogger from "@/utils/TGLogger.js";
|
||||
import { createPost } from "@/utils/TGWindow.js";
|
||||
import painterReq from "@/web/request/painterReq.js";
|
||||
|
||||
type PostData = { [key in NewsType]: Ref<Array<TGApp.Plugins.Mys.Post.FullData>> };
|
||||
type PostData = { [key in NewsType]: Ref<Array<TGApp.BBS.Post.FullData>> };
|
||||
type RawItem = { isLast: boolean; name: string; lastId: number };
|
||||
type RawData = { [key in NewsType]: Ref<RawItem> };
|
||||
|
||||
@@ -88,9 +88,9 @@ const showList = ref<boolean>(false);
|
||||
const showSearch = ref<boolean>(false);
|
||||
const search = ref<string>("");
|
||||
const postData = reactive<PostData>({
|
||||
notice: shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]),
|
||||
activity: shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]),
|
||||
news: shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]),
|
||||
notice: shallowRef<Array<TGApp.BBS.Post.FullData>>([]),
|
||||
activity: shallowRef<Array<TGApp.BBS.Post.FullData>>([]),
|
||||
news: shallowRef<Array<TGApp.BBS.Post.FullData>>([]),
|
||||
});
|
||||
const rawData = reactive<RawData>({
|
||||
notice: shallowRef<RawItem>({ isLast: false, name: "公告", lastId: 0 }),
|
||||
|
||||
@@ -115,7 +115,7 @@ const isReq = ref<boolean>(false);
|
||||
const allGames = shallowRef<Array<TGApp.BBS.Game.Item>>([]);
|
||||
const postRaw = shallowRef<PostMiniData>({ isLast: false, lastId: "", total: 0 });
|
||||
const topicInfo = shallowRef<TGApp.BBS.Topic.InfoRes>();
|
||||
const posts = shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]);
|
||||
const posts = shallowRef<Array<TGApp.BBS.Post.FullData>>([]);
|
||||
const curGame = shallowRef<GameList>();
|
||||
const sortList = computed<Array<SortSelect>>(() => {
|
||||
if (!topicInfo.value) return [];
|
||||
|
||||
@@ -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]);
|
||||
|
||||
32
src/types/BBS/Account.d.ts
vendored
32
src/types/BBS/Account.d.ts
vendored
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* @file types/BBS/Account.d.ts
|
||||
* @description BBS 账户相关类型定义文件
|
||||
* @since Beta v0.6.7
|
||||
*/
|
||||
|
||||
declare namespace TGApp.BBS.Account {
|
||||
/**
|
||||
* @description 游戏账号类型
|
||||
* @interface GameAccount
|
||||
* @since Beta v0.6.0
|
||||
* @property {string} game_biz 游戏 biz,例如 hk4e_cn
|
||||
* @property {string} game_uid 游戏 uid
|
||||
* @property {boolean} is_chosen 是否为当前选中账号
|
||||
* @property {boolean} is_official 是否为官服账号
|
||||
* @property {string} level 游戏等级
|
||||
* @property {string} nickname 游戏昵称
|
||||
* @property {string} region 游戏区域
|
||||
* @property {string} region_name 游戏区域名称
|
||||
* @return Game
|
||||
*/
|
||||
interface GameAccount {
|
||||
game_biz: string;
|
||||
game_uid: string;
|
||||
is_chosen: boolean;
|
||||
is_official: boolean;
|
||||
level: string;
|
||||
nickname: string;
|
||||
region: string;
|
||||
region_name: string;
|
||||
}
|
||||
}
|
||||
17
src/types/BBS/Collection.d.ts
vendored
17
src/types/BBS/Collection.d.ts
vendored
@@ -23,9 +23,16 @@ declare namespace TGApp.BBS.Collection {
|
||||
* @property {PostsRes} data - 返回数据
|
||||
* @return PostsResp
|
||||
*/
|
||||
type PostsResp = TGApp.BBS.Response.BaseWithData & {
|
||||
data: { posts: Array<TGApp.Plugins.Mys.Post.FullData> };
|
||||
};
|
||||
type PostsResp = TGApp.BBS.Response.BaseWithData<PostsRes>;
|
||||
|
||||
/**
|
||||
* @description 帖子列表数据
|
||||
* @since Beta v0.7.1
|
||||
* @interface PostsRes
|
||||
* @property {Array<TGApp.BBS.Post.FullData>} posts - 帖子列表
|
||||
* @return PostsRes
|
||||
*/
|
||||
type PostsRes = { posts: Array<TGApp.BBS.Post.FullData> };
|
||||
|
||||
/**
|
||||
* @description 用户收藏帖子响应数据
|
||||
@@ -33,12 +40,12 @@ declare namespace TGApp.BBS.Collection {
|
||||
* @interface UserPostRes
|
||||
* @property {boolean} is_last - 是否最后一页
|
||||
* @property {string} next_offset - 下一页偏移量
|
||||
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} list - 帖子列表
|
||||
* @property {Array<TGApp.BBS.Post.FullData>} list - 帖子列表
|
||||
* @return UserPostRes
|
||||
*/
|
||||
type UserPostRes = {
|
||||
is_last: boolean;
|
||||
next_offset: string;
|
||||
list: Array<TGApp.Plugins.Mys.Post.FullData>;
|
||||
list: Array<TGApp.BBS.Post.FullData>;
|
||||
};
|
||||
}
|
||||
|
||||
20
src/types/BBS/Forum.d.ts
vendored
20
src/types/BBS/Forum.d.ts
vendored
@@ -64,8 +64,8 @@ declare namespace TGApp.BBS.Forum {
|
||||
* @property {number} show_type 显示类型
|
||||
* @property {number} default_tab 默认标签
|
||||
* @property {string} read_me 说明
|
||||
* @property {Array<ForumCat>} forum_cate_list 分类列表
|
||||
* @property {Array<ForumCat>} video_cat_list 视频分类列表
|
||||
* @property {Array<ForumCate>} forum_cate_list 分类列表
|
||||
* @property {Array<ForumCate>} video_cat_list 视频分类列表
|
||||
* @return GameForumItem
|
||||
*/
|
||||
type GameForumItem = {
|
||||
@@ -94,33 +94,33 @@ declare namespace TGApp.BBS.Forum {
|
||||
show_type: number;
|
||||
default_tab: number;
|
||||
read_me: string;
|
||||
forum_cate_list: Array<ForumCat>;
|
||||
video_cat_list: Array<ForumCat>;
|
||||
forum_cate_list: Array<ForumCate>;
|
||||
video_cat_list: Array<ForumCate>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 视频分类
|
||||
* @since Beta v0.6.8
|
||||
* @interface ForumCat
|
||||
* @interface ForumCate
|
||||
* @property {number} id 分类 ID
|
||||
* @property {string} name 分类名称
|
||||
* @property {number} forum_id 版块 ID
|
||||
* @property {string} desc 描述
|
||||
* @property {string} remark 备注
|
||||
* @return ForumCat
|
||||
* @return ForumCate
|
||||
*/
|
||||
type ForumCat = { id: number; name: string; forum_id: number; desc: string; remark: string };
|
||||
type ForumCate = { id: number; name: string; forum_id: number; desc: string; remark: string };
|
||||
|
||||
/**
|
||||
* @description 版块帖子列表
|
||||
* @since Beta v0.7.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface PostForumRes
|
||||
* @property {string} last_id 最后一条帖子 ID
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {boolean} is_origin 是否原创
|
||||
* @property {number} page 页码
|
||||
* @property {unknown} databox 数据盒子
|
||||
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} list 帖子列表
|
||||
* @property {Array<TGApp.BBS.Post.FullData>} list 帖子列表
|
||||
* @return PostForumRes
|
||||
*/
|
||||
type PostForumRes = {
|
||||
@@ -129,6 +129,6 @@ declare namespace TGApp.BBS.Forum {
|
||||
is_origin: boolean;
|
||||
page: number;
|
||||
databox: unknown;
|
||||
list: TGApp.Plugins.Mys.Post.FullData[];
|
||||
list: Array<TGApp.BBS.Post.FullData>;
|
||||
};
|
||||
}
|
||||
|
||||
46
src/types/BBS/Game.d.ts
vendored
46
src/types/BBS/Game.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file types/BBS/Game.d.ts
|
||||
* @description 游戏相关的类型定义
|
||||
* @since Beta v0.6.8
|
||||
* @since Beta v0.7.2
|
||||
*/
|
||||
|
||||
declare namespace TGApp.BBS.Game {
|
||||
@@ -49,4 +49,48 @@ declare namespace TGApp.BBS.Game {
|
||||
has_wiki: boolean;
|
||||
game_sort_config: Array<unknown>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 游戏账号返回
|
||||
* @since Beta v0.7.2
|
||||
* @interface AccountResp
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {AccountRes} data 游戏账号数据
|
||||
* @return AccountResp
|
||||
*/
|
||||
type AccountResp = TGApp.BBS.Response.BaseWithData<AccountRes>;
|
||||
|
||||
/**
|
||||
* @description 游戏账号数据
|
||||
* @since Beta v0.7.2
|
||||
* @interface AccountRes
|
||||
* @property {Array<Account>} list 游戏账号列表
|
||||
* @return AccountRes
|
||||
*/
|
||||
type AccountRes = { list: Array<Account> };
|
||||
|
||||
/**
|
||||
* @description 游戏账号类型
|
||||
* @since Beta v0.7.2
|
||||
* @interface Account
|
||||
* @property {string} game_biz 游戏 biz,例如 hk4e_cn
|
||||
* @property {string} game_uid 游戏 uid
|
||||
* @property {boolean} is_chosen 是否为当前选中账号
|
||||
* @property {boolean} is_official 是否为官服账号
|
||||
* @property {string} level 游戏等级
|
||||
* @property {string} nickname 游戏昵称
|
||||
* @property {string} region 游戏区域
|
||||
* @property {string} region_name 游戏区域名称
|
||||
* @return Account
|
||||
*/
|
||||
type Account = {
|
||||
game_biz: string;
|
||||
game_uid: string;
|
||||
is_chosen: boolean;
|
||||
is_official: boolean;
|
||||
level: string;
|
||||
nickname: string;
|
||||
region: string;
|
||||
region_name: string;
|
||||
};
|
||||
}
|
||||
|
||||
14
src/types/BBS/Lottery.d.ts
vendored
14
src/types/BBS/Lottery.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file types/BBS/Lottery.d.ts
|
||||
* @description 米游社抽奖类型
|
||||
* @since Beta v0.7.1
|
||||
* @since Beta v0.7.2
|
||||
*/
|
||||
|
||||
declare namespace TGApp.BBS.Lottery {
|
||||
@@ -17,10 +17,10 @@ declare namespace TGApp.BBS.Lottery {
|
||||
|
||||
/**
|
||||
* @description 抽奖数据
|
||||
* @since Beta v0.7.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface FullData
|
||||
* @property {string} id 抽奖 ID
|
||||
* @property {TGApp.Plugins.Mys.User.Post} creator 创建者
|
||||
* @property {TGApp.BBS.Post.User} creator 创建者
|
||||
* @property {string} draw_time 抽奖时间
|
||||
* @property {string} participant_way 参与方式 // Forward: 转发
|
||||
* @property {boolean} is_expect_unfocus_user 是否限制未关注用户
|
||||
@@ -38,7 +38,7 @@ declare namespace TGApp.BBS.Lottery {
|
||||
*/
|
||||
type FullData = {
|
||||
id: string;
|
||||
creator: TGApp.Plugins.Mys.User.Post;
|
||||
creator: TGApp.BBS.Post.User;
|
||||
draw_time: string;
|
||||
participant_way: string;
|
||||
is_expect_unfocus_user: boolean;
|
||||
@@ -56,13 +56,13 @@ declare namespace TGApp.BBS.Lottery {
|
||||
|
||||
/**
|
||||
* @description 抽奖奖励
|
||||
* @since Beta v0.7.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface Reward
|
||||
* @property {string} reward_name 奖励名称
|
||||
* @property {number} winner_number 获奖人数
|
||||
* @property {number} scheduled_winner_number 预计获奖人数
|
||||
* @property {boolean} is_send_by_post 是否通过帖子发放
|
||||
* @property {Array<>TGApp.Plugins.Mys.User.Post>} users 用户列表
|
||||
* @property {Array<TGApp.BBS.Post.User>} users 用户列表
|
||||
* @property {string} id 奖励 ID
|
||||
* @return Reward
|
||||
*/
|
||||
@@ -71,7 +71,7 @@ declare namespace TGApp.BBS.Lottery {
|
||||
winner_number: number;
|
||||
scheduled_winner_number: number;
|
||||
is_send_by_post: boolean;
|
||||
users: Array<TGApp.Plugins.Mys.User.Post>;
|
||||
users: Array<TGApp.BBS.Post.User>;
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
32
src/types/BBS/News.d.ts
vendored
32
src/types/BBS/News.d.ts
vendored
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* @file types/BBS/News.d.ts
|
||||
* @description BBS 咨讯类型定义
|
||||
* @since Beta v0.7.1
|
||||
*/
|
||||
|
||||
declare namespace TGApp.BBS.News {
|
||||
/**
|
||||
* @description 咨讯返回数据
|
||||
* @since Beta v0.7.1
|
||||
* @interface Resp
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {Res} data 咨讯数据
|
||||
* @return Resp
|
||||
*/
|
||||
type Resp = TGApp.BBS.Response.BaseWithData<Res>;
|
||||
|
||||
/**
|
||||
* @description 咨讯数据
|
||||
* @since Beta v0.7.1
|
||||
* @interface Res
|
||||
* @property {number} last_id 最后一条咨讯 ID
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} list 咨讯列表
|
||||
* @return Res
|
||||
*/
|
||||
type Res = {
|
||||
last_id: number;
|
||||
is_last: boolean;
|
||||
list: Array<TGApp.Plugins.Mys.Post.FullData>;
|
||||
};
|
||||
}
|
||||
@@ -1,33 +1,92 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/post.d.ts
|
||||
* @description Mys 插件帖子类型定义文件
|
||||
* @since Beta v0.7.1
|
||||
* @file types/BBS/Post.d.ts
|
||||
* @description 帖子类型定义文件
|
||||
* @since Beta v0.7.2
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.Post {
|
||||
declare namespace TGApp.BBS.Post {
|
||||
/**
|
||||
* @description 帖子返回数据
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Response
|
||||
* @description 获取帖子详情返回数据
|
||||
* @since Beta v0.7.2
|
||||
* @interface FullResp
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {FullData} data.post 帖子数据
|
||||
* @return Response
|
||||
* @property {FullRes} data 帖子数据
|
||||
* @return FullResp
|
||||
*/
|
||||
type Response = TGApp.BBS.Response.BaseWithData & { data: { post: FullData } };
|
||||
type FullResp = TGApp.BBS.Response.BaseWithData<FullRes>;
|
||||
|
||||
/**
|
||||
* @description 帖子数据
|
||||
* @since Beta v0.6.7
|
||||
* @since Beta v0.7.2
|
||||
* @interface FullRes
|
||||
* @property {FullData} post 帖子数据
|
||||
* @return FullRes
|
||||
*/
|
||||
type FullRes = { post: FullData };
|
||||
|
||||
/**
|
||||
* @description 搜索结果返回
|
||||
* @since Beta v0.7.2
|
||||
* @interface SearchResp
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {SearchRes} data 返回数据
|
||||
* @return SearchResp
|
||||
*/
|
||||
type SearchResp = TGApp.BBS.Response.BaseWithData<SearchRes>;
|
||||
|
||||
/**
|
||||
* @description 搜索结果数据
|
||||
* @since Beta v0.7.2
|
||||
* @interface SearchRes
|
||||
* @property {Array<FullData>} posts 帖子列表
|
||||
* @property {string} last_id 索引
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {Array<string>} token_list token 列表
|
||||
* @property {Record<string,string>} databox 数据盒
|
||||
* @return SearchRes
|
||||
*/
|
||||
type SearchRes = {
|
||||
posts: Array<FullData>;
|
||||
last_id: string;
|
||||
is_last: boolean;
|
||||
token_list: Array<string>;
|
||||
databox: Record<string, string>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 咨讯返回
|
||||
* @since Beta v0.7.2
|
||||
* @interface NewsResp
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {NewsRes} data 返回数据
|
||||
* @return NewsResp
|
||||
*/
|
||||
type NewsResp = TGApp.BBS.Response.BaseWithData<NewsRes>;
|
||||
|
||||
/**
|
||||
* @description 咨讯数据
|
||||
* @since Beta v0.7.2
|
||||
* @interface NewsRes
|
||||
* @property {Array<FullData>} list 咨讯列表
|
||||
* @property {string} last_id 最后 ID
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @return NewsRes
|
||||
*/
|
||||
type NewsRes = { list: Array<FullData>; last_id: string; is_last: boolean };
|
||||
|
||||
/**
|
||||
* @description 帖子数据
|
||||
* @since Beta v0.7.2
|
||||
* @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 {User|null} user 发帖人,可能为 null
|
||||
* @property {TGApp.BBS.User.SelfOperation} self_operation 当前用户操作
|
||||
* @property {Stat|null} stat 帖子统计,可能为 null
|
||||
* @property {HelpSys} help_sys 帮助系统,可能为 null
|
||||
* @property {Image} cover 封面图,可能为 null
|
||||
* @property {Image[]} image_list 图片列表
|
||||
* @property {Array<Image>} image_list 图片列表
|
||||
* @property {boolean} is_official_master 是否为官方帖
|
||||
* @property {boolean} is_user_master 是否为用户帖
|
||||
* @property {boolean} hot_reply_exist 是否存在热门回复
|
||||
@@ -35,23 +94,31 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @property {number} last_modify_time 最后修改时间
|
||||
* @property {string} recommend_type 推荐类型
|
||||
* @property {Collection} collection 合集,可能为 null
|
||||
* @property {unknown[]} vod_list 视频列表,可能为空
|
||||
* @property {Array<Vod>} vod_list 视频列表,可能为空
|
||||
* @property {boolean} is_block_on 是否被屏蔽
|
||||
* @property {unknown} forum_rank_info 版块排行信息,可能为 null
|
||||
* @property {LinkCard[]} link_card_list 链接卡片列表,可能为空
|
||||
* @property {NewsMeta} news_meta 咨讯元数据,可能为 null
|
||||
* @property {NewsMeta} news_meta 咨讯元数据,可能为 null'
|
||||
* @property {RecommendReason|null} recommend_reason 推荐理由,可能为 null
|
||||
* @property {unknown} villa_card 未知数据,可能为 null
|
||||
* @property {boolean} is_mentor 是否为导师
|
||||
* @property {unknown} villa_room_card 未知数据,可能为 null
|
||||
* @property {unknown} reply_avatar_action_info 未知数据,可能为 null
|
||||
* @property {unknown} challenge 挑战,可能为 null
|
||||
* @property {Array<unknown>} hot_reply_list 热门回复列表
|
||||
* @property {Array<unknown>} villa_msg_image_list 未知数据列表
|
||||
* @return FullData
|
||||
*/
|
||||
interface FullData {
|
||||
type 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;
|
||||
user: User | null;
|
||||
self_operation: TGApp.BBS.User.SelfOperation;
|
||||
stat: Stat | null;
|
||||
help_sys: HelpSys | null;
|
||||
cover: Image | null;
|
||||
image_list: Image[];
|
||||
image_list: Array<Image>;
|
||||
is_official_master: boolean;
|
||||
is_user_master: boolean;
|
||||
hot_reply_exist: boolean;
|
||||
@@ -59,24 +126,61 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
last_modify_time: number;
|
||||
recommend_type: string;
|
||||
collection: Collection | null;
|
||||
vod_list: Vod[];
|
||||
vod_list: Array<Vod>;
|
||||
is_block_on: boolean;
|
||||
forum_rank_info: unknown | null;
|
||||
link_card_list: LinkCard[];
|
||||
link_card_list: Array<LinkCard>;
|
||||
news_meta?: NewsMeta | null;
|
||||
recommend_reason: unknown | null;
|
||||
recommend_reason: RecommendReason | 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[];
|
||||
}
|
||||
hot_reply_list: Array<unknown>;
|
||||
villa_msg_image_list: Array<unknown>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 用户信息
|
||||
* @since Beta v0.7.2
|
||||
* @interface User
|
||||
* @property {string} uid 用户 ID
|
||||
* @property {string} nickname 用户昵称
|
||||
* @property {string} introduce 用户简介
|
||||
* @property {string} avatar 用户头像
|
||||
* @property {number} gender 用户性别
|
||||
* @property {TGApp.BBS.User.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 {TGApp.BBS.User.AvatarExt} avatar_ext 用户头像扩展信息
|
||||
* @return User
|
||||
*/
|
||||
type User = {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
introduce: string;
|
||||
avatar: string;
|
||||
gender: number;
|
||||
certification: TGApp.BBS.User.Certification;
|
||||
level_exp: TGApp.BBS.User.LevelExp;
|
||||
is_following: boolean;
|
||||
is_followed: boolean;
|
||||
avatar_url: string;
|
||||
pendant: string;
|
||||
is_creator: boolean;
|
||||
avatar_ext: TGApp.BBS.User.AvatarExt;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 帖子信息
|
||||
* @since Beta v0.3.7
|
||||
* @since Beta v0.7.2
|
||||
* @interface Post
|
||||
* @property {number} game_id 游戏 ID // 2 为原神
|
||||
* @property {string} post_id 帖子 ID
|
||||
@@ -87,13 +191,9 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @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 {Array<string>} images 图片列表,可能为空
|
||||
* @property {PostStat} post_status 帖子状态
|
||||
* @property {Array<number>} topic_ids 所属话题 ID 列表
|
||||
* @property {number} view_status 浏览状态
|
||||
* @property {number} max_floor 最大楼层
|
||||
* @property {number} is_original 是否原创
|
||||
@@ -101,8 +201,8 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @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 {string} structured_content 结构化内容 // 反序列化后为 TGApp.BBS.SctPost.Common[]
|
||||
* @property {Array<string>} structured_content_rows 结构化内容原始数据
|
||||
* @property {number} review_id 审核ID
|
||||
* @property {boolean} is_profit 是否盈利
|
||||
* @property {boolean} is_in_profit 是否在盈利
|
||||
@@ -121,7 +221,7 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @property {boolean} is_mentor 是否为导师
|
||||
* @return Post
|
||||
*/
|
||||
interface Post {
|
||||
type Post = {
|
||||
game_id: number;
|
||||
post_id: string;
|
||||
f_forum_id: number;
|
||||
@@ -131,14 +231,9 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
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[];
|
||||
images: Array<string>;
|
||||
post_status: PostStat;
|
||||
topic_ids: Array<number>;
|
||||
view_status: number;
|
||||
max_floor: number;
|
||||
is_original: number;
|
||||
@@ -147,7 +242,7 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
is_deleted: number;
|
||||
is_interactive: boolean;
|
||||
structured_content: string;
|
||||
structured_content_rows: string[];
|
||||
structured_content_rows: Array<string>;
|
||||
review_id: number;
|
||||
is_profit: boolean;
|
||||
is_in_profit: boolean;
|
||||
@@ -164,26 +259,38 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
block_latest_reply_time: number;
|
||||
selected_comment: number;
|
||||
is_mentor: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 帖子状态
|
||||
* @since Beta v0.7.2
|
||||
* @interface PostStat
|
||||
* @property {boolean} is_top 是否置顶
|
||||
* @property {boolean} is_good 是否加精
|
||||
* @property {boolean} is_official 是否官方
|
||||
* @property {number} post_status 帖子状态
|
||||
* @return PostStat
|
||||
*/
|
||||
type PostStat = { is_top: boolean; is_good: boolean; is_official: boolean; post_status: number };
|
||||
|
||||
/**
|
||||
* @description 版块信息
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface Forum
|
||||
* @property {number} id 版块 ID
|
||||
* @property {string} name 版块名称
|
||||
* @property {string} icon 版块图标 URL
|
||||
* @property {number} game_id 游戏 ID // 2 为原神
|
||||
* @property {unknown} forum_cate 版块分类,可能为 null
|
||||
* @property {TGApp.BBS.Forum.ForumCate|null} forum_cate 版块分类,可能为 null
|
||||
* @return Forum
|
||||
*/
|
||||
interface Forum {
|
||||
type Forum = {
|
||||
id: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
game_id: number;
|
||||
forum_cate: unknown | null;
|
||||
}
|
||||
forum_cate: TGApp.BBS.Forum.ForumCate | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 帖子状态
|
||||
@@ -194,39 +301,40 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @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 互动数量
|
||||
* @property {number} original_like_num 原创点赞数
|
||||
* @property {Array<StatUpvote>} post_upvote_stat 互动信息
|
||||
* @return Stat
|
||||
*/
|
||||
interface Stat {
|
||||
type 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;
|
||||
}>;
|
||||
}
|
||||
post_upvote_stat: Array<StatUpvote>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 互动信息
|
||||
* @since Beta v0.7.2
|
||||
* @interface StatUpvote
|
||||
* @property {number} upvote_type 互动类型
|
||||
* @property {number} upvote_cnt 互动数量
|
||||
* @return StatUpvote
|
||||
*/
|
||||
type StatUpvote = { upvote_type: number; upvote_cnt: number };
|
||||
|
||||
/**
|
||||
* @description 图片数据
|
||||
* @since Beta v0.5.5
|
||||
* @since Beta v0.7.2
|
||||
* @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 {ImageCrop|null} crop 图片裁剪信息,可能为 null
|
||||
* @property {boolean} is_user_set_cover 是否为封面
|
||||
* @property {string} image_id 图片 ID
|
||||
* @property {string} entity_type 图片类型 // IMG_ENTITY_POST, IMG_ENTITY_UNKOWN
|
||||
@@ -234,44 +342,47 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @property {boolean} is_deleted 是否已删除
|
||||
* @return Image
|
||||
*/
|
||||
interface Image {
|
||||
type Image = {
|
||||
url: string;
|
||||
height: number;
|
||||
width: number;
|
||||
format: string;
|
||||
size: string;
|
||||
crop: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
url: string;
|
||||
} | null;
|
||||
crop: ImageCrop | null;
|
||||
is_user_set_cover?: boolean;
|
||||
image_id: string;
|
||||
entity_type: string;
|
||||
entity_id: string;
|
||||
is_deleted: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 图片裁剪信息
|
||||
* @since Beta v0.7.2
|
||||
* @interface ImageCrop
|
||||
* @property {number} x 裁剪 X 轴
|
||||
* @property {number} y 裁剪 Y 轴
|
||||
* @property {number} w 裁剪宽度
|
||||
* @property {number} h 裁剪高度
|
||||
* @property {string} url 裁剪图片 URL
|
||||
* @return ImageCrop
|
||||
*/
|
||||
type ImageCrop = { x: number; y: number; w: number; h: number; url: string };
|
||||
|
||||
/**
|
||||
* @description help_sys 信息
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface HelpSys
|
||||
* @property {unknown} top_up 置顶, 可能为 null
|
||||
* @property {unknown[]} top_n 置顶, 可能为空
|
||||
* @property {Array<unknown>} top_n 置顶, 可能为空
|
||||
* @property {number} answer_num 回答数
|
||||
* @return HelpSys
|
||||
*/
|
||||
interface HelpSys {
|
||||
top_up: unknown | null;
|
||||
top_n: unknown[];
|
||||
answer_num: number;
|
||||
}
|
||||
type HelpSys = { top_up: unknown | null; top_n: Array<unknown>; answer_num: number };
|
||||
|
||||
/**
|
||||
* @description 合集信息
|
||||
* @since Beta v0.3.9
|
||||
* @since Beta v0.7.2
|
||||
* @interface Collection
|
||||
* @property {string} prev_post_id 上一篇帖子 ID,为 0 说明没有上一篇
|
||||
* @property {string} next_post_id 下一篇帖子 ID,为 0 说明没有下一篇
|
||||
@@ -285,7 +396,7 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @property {number} next_post_view_type 下一篇帖子浏览类型
|
||||
* @return Collection
|
||||
*/
|
||||
interface Collection {
|
||||
type Collection = {
|
||||
prev_post_id: string;
|
||||
next_post_id: string;
|
||||
collection_id: string;
|
||||
@@ -296,11 +407,11 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
next_post_game_id: number;
|
||||
prev_post_view_type: number;
|
||||
next_post_view_type: number;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 链接卡片信息
|
||||
* @since Beta v0.6.7
|
||||
* @since Beta v0.7.2
|
||||
* @interface LinkCard
|
||||
* @property {string} button_text 按钮文本
|
||||
* @property {string} card_id 卡片 ID
|
||||
@@ -339,44 +450,53 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
|
||||
/**
|
||||
* @description 视频信息
|
||||
* @since Beta v0.3.7
|
||||
* @since Beta v0.7.2
|
||||
* @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 {Array<VodResolution>} resolutions 视频分辨率信息
|
||||
* @property {number} view_num 观看数
|
||||
* @property {number} transcoding_status 转码状态
|
||||
* @property {number} review_status 审核状态
|
||||
* @property {string} brief_info 视频简介
|
||||
* @return Vod
|
||||
*/
|
||||
interface Vod {
|
||||
type 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;
|
||||
}>;
|
||||
resolutions: Array<VodResolution>;
|
||||
view_num: number;
|
||||
transcoding_status: number;
|
||||
review_status: number;
|
||||
brief_info: string;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 视频分辨率信息
|
||||
* @since Beta v0.7.2
|
||||
* @interface VodResolution
|
||||
* @property {string} url 视频 URL
|
||||
* @property {string} definition 视频清晰度
|
||||
* @property {number} width 视频宽度
|
||||
* @property {number} height 视频高度
|
||||
* @property {number} bitrate 视频码率
|
||||
* @property {string} size 视频大小
|
||||
* @property {string} format 视频格式
|
||||
* @property {string} label 视频标签
|
||||
* @return VodResolution
|
||||
*/
|
||||
type VodResolution = {
|
||||
url: string;
|
||||
definition: string;
|
||||
width: number;
|
||||
height: number;
|
||||
bitrate: number;
|
||||
size: string;
|
||||
format: string;
|
||||
label: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 咨讯元数据,只有活动咨讯才有
|
||||
@@ -391,39 +511,11 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
|
||||
/**
|
||||
* @description 推荐理由
|
||||
* @since Beta v0.3.7
|
||||
* @since Beta v0.7.2
|
||||
* @interface RecommendReason
|
||||
* @property {string[]} tags 标签
|
||||
* @property {Array<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;
|
||||
}
|
||||
type RecommendReason = { tags: Array<string>; is_mentor_rec_block: boolean };
|
||||
}
|
||||
71
src/types/BBS/Reply.d.ts
vendored
71
src/types/BBS/Reply.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file types/BBS/Reply.d.ts
|
||||
* @description 回复数据类型定义文件
|
||||
* @since Beta v0.7.1
|
||||
* @since Beta v0.7.2
|
||||
*/
|
||||
|
||||
declare namespace TGApp.BBS.Reply {
|
||||
@@ -39,11 +39,11 @@ declare namespace TGApp.BBS.Reply {
|
||||
* @description 子回复数据类型
|
||||
* @since Beta v0.7.1
|
||||
* @interface SubRootRes
|
||||
* @property {TGApp.Plugins.Mys.Post.FullData} post - 帖子数据
|
||||
* @property {TGApp.BBS.Post.FullData} post - 帖子数据
|
||||
* @property {ReplyFull} reply - 回复数据
|
||||
* @return SubRootRes
|
||||
*/
|
||||
type SubRootRes = { post: TGApp.Plugins.Mys.Post.FullData; reply: ReplyFull };
|
||||
type SubRootRes = { post: TGApp.BBS.Post.FullData; reply: ReplyFull };
|
||||
|
||||
/**
|
||||
* @description 回复数据类型
|
||||
@@ -87,18 +87,18 @@ declare namespace TGApp.BBS.Reply {
|
||||
|
||||
/**
|
||||
* @description 回复数据类型
|
||||
* @since Beta v0.7.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface ReplyFull
|
||||
* @property {Reply} reply - 回复数据
|
||||
* @property {User} user - 用户数据
|
||||
* @property {Stat} stat - 点赞数据
|
||||
* @property {SelfOperation} self_operation - 自身操作数据
|
||||
* @property {TGApp.BBS.User.SelfOperation} self_operation - 自身操作数据
|
||||
* @property {MasterStatus} master_status - 主楼状态数据
|
||||
* @property {Array<TGApp.Plugins.Mys.Post.Image>} images - 图片数据
|
||||
* @property {Array<TGApp.BBS.Post.Image>} images - 图片数据
|
||||
* @property {Array<ReplyFull>} sub_replies - 子回复数据
|
||||
* @property {boolean} is_lz - 是否楼主
|
||||
* @property {number} sub_reply_count - 子回复数量
|
||||
* @property {TGApp.Plugins.Mys.User.Reply} r_user - 回复用户数据
|
||||
* @property {User} r_user - 回复用户数据
|
||||
* @property {unknown} r_reply - 未知数据
|
||||
* @property {unknown} r_post - 未知数据
|
||||
* @property {unknown} user_game_info - 未知数据
|
||||
@@ -106,15 +106,15 @@ declare namespace TGApp.BBS.Reply {
|
||||
*/
|
||||
type ReplyFull = {
|
||||
reply: Reply;
|
||||
user: TGApp.Plugins.Mys.User.Reply;
|
||||
user: User;
|
||||
stat: Stat;
|
||||
self_operation: SelfOperation;
|
||||
self_operation: TGApp.BBS.User.SelfOperation;
|
||||
master_status: MasterStatus;
|
||||
images: Array<TGApp.Plugins.Mys.Post.Image>;
|
||||
images: Array<TGApp.BBS.Post.Image>;
|
||||
sub_replies: Array<ReplyFull>;
|
||||
is_lz: boolean;
|
||||
sub_reply_count: number;
|
||||
r_user: TGApp.Plugins.Mys.User.Reply | null;
|
||||
r_user: User | null;
|
||||
r_reply: unknown;
|
||||
r_post: unknown;
|
||||
user_game_info: unknown;
|
||||
@@ -175,6 +175,45 @@ declare namespace TGApp.BBS.Reply {
|
||||
view_status: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 帖子回复中的用户信息
|
||||
* @since Beta v0.7.2
|
||||
* @interface User
|
||||
* @property {string} uid 用户 ID
|
||||
* @property {string} nickname 用户昵称
|
||||
* @property {string} introduce 用户简介
|
||||
* @property {string} avatar 用户头像
|
||||
* @property {number} gender 用户性别
|
||||
* @property {TGApp.BBS.User.Certification} certification 用户认证信息
|
||||
* @property {TGApp.BBS.User.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 {TGApp.BBS.User.AvatarExt} avatar_ext 用户头像扩展信息
|
||||
* @property {boolean} is_super_fan 是否是铁粉
|
||||
* @property {Bubble} reply_bubble 回复气泡,可能为 null
|
||||
* @return User
|
||||
*/
|
||||
type User = {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
introduce: string;
|
||||
avatar: string;
|
||||
gender: number;
|
||||
certification: TGApp.BBS.User.Certification;
|
||||
level_exp: TGApp.BBS.User.LevelExp;
|
||||
avatar_url: string;
|
||||
pendant: string;
|
||||
ip_region: string;
|
||||
is_following: boolean;
|
||||
is_followed: boolean;
|
||||
avatar_ext: TGApp.BBS.User.AvatarExt;
|
||||
is_super_fan: boolean;
|
||||
reply_bubble: Bubble | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 回复气泡数据类型
|
||||
* @since Beta v0.7.1
|
||||
@@ -199,16 +238,6 @@ declare namespace TGApp.BBS.Reply {
|
||||
*/
|
||||
type Stat = { reply_num: number; like_num: number; sub_num: number; dislike_num: number };
|
||||
|
||||
/**
|
||||
* @description 自身操作数据类型
|
||||
* @since Beta v0.7.1
|
||||
* @interface SelfOperation
|
||||
* @property {number} attitude - 操作态度
|
||||
* @property {number} reply_vote_attitude - 回复投票态度
|
||||
* @return SelfOperation
|
||||
*/
|
||||
type SelfOperation = { attitude: number; reply_vote_attitude: number };
|
||||
|
||||
/**
|
||||
* @description 主楼状态数据类型
|
||||
* @since Beta v0.5.5
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/SctPost.d.ts
|
||||
* @description Mys 插件 结构化帖子类型声明文件
|
||||
* @since Beta v0.6.7
|
||||
* @file types/BBS/SctPost.d.ts
|
||||
* @description 结构化帖子类型声明文件
|
||||
* @since Beta v0.7.2
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.SctPost {
|
||||
declare namespace TGApp.BBS.SctPost {
|
||||
/**
|
||||
* @description 帖子结构化数据-基础类型
|
||||
* @since Beta v0.6.7
|
||||
* @interface Base
|
||||
* @property {string | Record<string, unknown>} insert - 帖子内容
|
||||
* @property {Record<string, unknown>} attributes - 帖子属性
|
||||
* @property {Base[]} children - 子帖子
|
||||
* @property {Array<Base>} children - 子帖子
|
||||
* @return Base
|
||||
*/
|
||||
type Base = {
|
||||
insert: string | Record<string, unknown>;
|
||||
attributes?: Record<string, unknown>;
|
||||
children?: Base[];
|
||||
children?: Array<Base>;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -34,11 +34,11 @@ declare namespace TGApp.Plugins.Mys.SctPost {
|
||||
* @description 帖子结构化数据-其他类型
|
||||
* @since Beta v0.6.7
|
||||
* @property {string} describe - 描述
|
||||
* @property {string[]} imgs - 图片链接
|
||||
* @property {string[]} link_card_ids - 关联卡片ID
|
||||
* @property {Array<string>} imgs - 图片链接
|
||||
* @property {Array<string>} link_card_ids - 关联卡片ID
|
||||
* @return Other
|
||||
*/
|
||||
type Other = { describe: string; imgs: string[]; link_card_ids?: string[] } & {
|
||||
type Other = { describe: string; imgs: Array<string>; link_card_ids?: Array<string> } & {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
}
|
||||
36
src/types/BBS/Search.d.ts
vendored
36
src/types/BBS/Search.d.ts
vendored
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* @file types/BBS/Search.d.ts
|
||||
* @description 米游社搜索类型声明
|
||||
* @since Beta v0.7.1
|
||||
*/
|
||||
|
||||
declare namespace TGApp.BBS.Search {
|
||||
/**
|
||||
* @description 搜索帖子返回
|
||||
* @since Beta v0.7.1
|
||||
* @interface PostsResp
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {PostsRes} data 返回数据
|
||||
* @return PostsResp
|
||||
*/
|
||||
type PostsResp = TGApp.BBS.Response.BaseWithData<PostsRes>;
|
||||
|
||||
/**
|
||||
* @description 搜索帖子返回数据
|
||||
* @since Beta v0.7.1
|
||||
* @interface PostsRes
|
||||
* @property {TGApp.Plugins.Mys.Post.FullData[]} posts 帖子列表
|
||||
* @property {string} last_id 索引
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {string[]} token_list token 列表
|
||||
* @property {Record<string,string>} databox 数据盒
|
||||
* @return PostsRes
|
||||
*/
|
||||
type PostsRes = {
|
||||
posts: Array<TGApp.Plugins.Mys.Post.FullData>;
|
||||
last_id: string;
|
||||
is_last: boolean;
|
||||
token_list: string[];
|
||||
databox: Record<string, string>;
|
||||
};
|
||||
}
|
||||
4
src/types/BBS/Topic.d.ts
vendored
4
src/types/BBS/Topic.d.ts
vendored
@@ -59,14 +59,14 @@ declare namespace TGApp.BBS.Topic {
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {boolean} is_origin 是否原创
|
||||
* @property {string} last_id 最后一条帖子 ID
|
||||
* @property {Array<TGApp.Plugins.Mys.Post.FullData>} posts 帖子列表
|
||||
* @property {Array<TGApp.BBS.Post.FullData>} posts 帖子列表
|
||||
* @return PostRes
|
||||
*/
|
||||
type PostRes = {
|
||||
is_last: boolean;
|
||||
is_origin: boolean;
|
||||
last_id: string;
|
||||
posts: Array<TGApp.Plugins.Mys.Post.FullData>;
|
||||
posts: Array<TGApp.BBS.Post.FullData>;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/user.ts
|
||||
* @description Mys 插件用户类型定义文件
|
||||
* @since Beta v0.5.5
|
||||
* @file types/BBS/User.d.ts
|
||||
* @description 用户类型定义文件
|
||||
* @since Beta v0.7.2
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.User {
|
||||
declare namespace TGApp.BBS.User {
|
||||
/**
|
||||
* @description 主页用户信息返回
|
||||
* @since Alpha v0.2.1
|
||||
* @interface HomeResponse
|
||||
* @description 用户信息返回
|
||||
* @since Beta v0.7.2
|
||||
* @interface InfoResp
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {Home} data 用户信息
|
||||
* @return HomeResponse
|
||||
* @property {InfoRes} data 用户信息
|
||||
* @return InfoResp
|
||||
*/
|
||||
interface HomeResponse extends TGApp.BBS.Response.BaseWithData {
|
||||
data: Home;
|
||||
}
|
||||
type InfoResp = TGApp.BBS.Response.BaseWithData<InfoRes>;
|
||||
|
||||
/**
|
||||
* @description 主页用户信息
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Home 用户信息
|
||||
* @since Beta v0.7.2
|
||||
* @interface InfoRes 用户信息
|
||||
* @property {Info} user_info 用户信息
|
||||
* @property {unknown} follow_relation 关注关系
|
||||
* @property {unknown[]} auth_relations 认证关系
|
||||
@@ -36,12 +34,12 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
* @property {boolean} audit_info.is_introduce_in_audit 是否在简介审核中
|
||||
* @property {string} audit_info.introduce 审核中的简介
|
||||
* @property {number} audit_info.nickname_status 昵称审核状态
|
||||
* @return Home
|
||||
* @return InfoRes
|
||||
*/
|
||||
interface Home {
|
||||
type InfoRes = {
|
||||
user_info: Info;
|
||||
follow_relation: unknown;
|
||||
auth_relations: unknown[];
|
||||
auth_relations: Array<unknown>;
|
||||
is_in_blacklist: boolean;
|
||||
is_has_collection: boolean;
|
||||
is_creator: boolean;
|
||||
@@ -56,11 +54,11 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
introduce: string;
|
||||
nickname_status: number;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 主页用户信息-二级
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface Info
|
||||
* @property {string} uid 用户 ID
|
||||
* @property {string} nickname 用户昵称
|
||||
@@ -79,23 +77,23 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
* @property {string} ip_region 用户 IP 地区
|
||||
* @return Info
|
||||
*/
|
||||
interface Info {
|
||||
type Info = {
|
||||
uid: string;
|
||||
nickname: string;
|
||||
introduce: string;
|
||||
avatar: string;
|
||||
gender: number;
|
||||
certification: Certification;
|
||||
level_exps: LevelExp[];
|
||||
level_exps: Array<LevelExp>;
|
||||
archive: Archive;
|
||||
community_info: Community;
|
||||
avatar_url: string;
|
||||
certifications: Certification[];
|
||||
certifications: Array<Certification>;
|
||||
level_exp: LevelExp;
|
||||
pendant: string;
|
||||
is_logoff: boolean;
|
||||
ip_region: string;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 用户认证信息
|
||||
@@ -105,25 +103,46 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
* @property {string} label 认证标签
|
||||
* @return Certification
|
||||
*/
|
||||
interface Certification {
|
||||
type: number;
|
||||
label: string;
|
||||
}
|
||||
type Certification = { type: number; label: string };
|
||||
|
||||
/**
|
||||
* @description 用户等级经验
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface LevelExp
|
||||
* @property {number} level 用户等级
|
||||
* @property {number} exp 用户经验
|
||||
* @property {number} game_id 游戏 ID
|
||||
* @return LevelExp
|
||||
*/
|
||||
interface LevelExp {
|
||||
level: number;
|
||||
exp: number;
|
||||
game_id: number;
|
||||
}
|
||||
type LevelExp = { level: number; exp: number; game_id?: number };
|
||||
|
||||
/**
|
||||
* @description 用户操作
|
||||
* @since Beta v0.7.2
|
||||
* @interface SelfOperation
|
||||
* @property {number} attitude 操作类型
|
||||
* @property {boolean} is_collected 是否收藏
|
||||
* @property {number} upvote_type 互动类型
|
||||
* @returns {SelfOperation}
|
||||
*/
|
||||
type SelfOperation = { attitude: number; is_collected: boolean; upvote_type: number };
|
||||
|
||||
/**
|
||||
* @description 用户头像扩展信息
|
||||
* @since Beta v0.7.2
|
||||
* @interface AvatarExt
|
||||
* @property {number} avatar_type 头像类型
|
||||
* @property {string} avatar_assets_id 头像资源 ID
|
||||
* @property {Array<unknown>} resources 资源
|
||||
* @property {Array<unknown>} hd_resources 高清资源
|
||||
* @return AvatarExt
|
||||
*/
|
||||
type AvatarExt = {
|
||||
avatar_type: number;
|
||||
avatar_assets_id: string;
|
||||
resources: Array<unknown>;
|
||||
hd_resources: Array<unknown>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 用户档案
|
||||
@@ -140,7 +159,7 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
* @property {string} follow_collection_cnt 收藏数
|
||||
* @return Archive
|
||||
*/
|
||||
interface Archive {
|
||||
type Archive = {
|
||||
like_num: string;
|
||||
post_num: string;
|
||||
replypost_num: string;
|
||||
@@ -150,11 +169,11 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
new_follower_num: string;
|
||||
good_post_num: string;
|
||||
follow_collection_cnt: string;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 用户社区信息
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.7.2
|
||||
* @interface Community
|
||||
* @property {boolean} is_realname 是否实名
|
||||
* @property {boolean} agree_status 是否同意协议
|
||||
@@ -185,7 +204,7 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
* @property {number} created_at 创建时间
|
||||
* @return Community
|
||||
*/
|
||||
interface Community {
|
||||
type Community = {
|
||||
is_realname: boolean;
|
||||
agree_status: boolean;
|
||||
silent_end_time: number;
|
||||
@@ -216,131 +235,5 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
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;
|
||||
}
|
||||
};
|
||||
}
|
||||
2
src/types/Sqlite/Collection.d.ts
vendored
2
src/types/Sqlite/Collection.d.ts
vendored
@@ -17,7 +17,7 @@ declare namespace TGApp.Sqlite.UserCollection {
|
||||
* @interface UFPost
|
||||
* @property {string} id - 帖子 ID
|
||||
* @property {string} title - 标题
|
||||
* @description 反序列化后是 TGApp.Plugins.Mys.Post.FullData
|
||||
* @description 反序列化后是 TGApp.BBS.Post.FullData
|
||||
* @property {string} content - 内容
|
||||
* @property {string} updated - 更新时间
|
||||
* @return UFPost
|
||||
|
||||
@@ -89,7 +89,7 @@ const lang = <AnnoLang>route.params.lang;
|
||||
const { theme } = storeToRefs(useAppStore());
|
||||
const jsonList = shallowRef<TGApp.BBS.Announcement.AnnoSingle>();
|
||||
const jsonContent = shallowRef<TGApp.BBS.Announcement.ContentItem>();
|
||||
const parsedJson = shallowRef<Array<TGApp.Plugins.Mys.SctPost.Base>>();
|
||||
const parsedJson = shallowRef<Array<TGApp.BBS.SctPost.Base>>();
|
||||
const jsonTheme = computed<"dark" | "light">(() => (theme.value === "dark" ? "dark" : "light"));
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -66,8 +66,8 @@ const { theme } = storeToRefs(useAppStore());
|
||||
const { cookie } = storeToRefs(useUserStore());
|
||||
const postId = Number(useRoute().params.post_id);
|
||||
const isEmpty = ref<boolean>(false);
|
||||
const jsonData = shallowRef<TGApp.Plugins.Mys.Post.FullData>();
|
||||
const parseData = shallowRef<Array<TGApp.Plugins.Mys.SctPost.Base>>();
|
||||
const jsonData = shallowRef<TGApp.BBS.Post.FullData>();
|
||||
const parseData = shallowRef<Array<TGApp.BBS.SctPost.Base>>();
|
||||
const jsonTheme = computed<"dark" | "light">(() => (theme.value === "dark" ? "dark" : "light"));
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -121,8 +121,8 @@ const postId = Number(useRoute().params.post_id);
|
||||
const showCollection = ref<boolean>(false);
|
||||
const isLike = ref<boolean>(false);
|
||||
const shareTime = ref<number>(Math.floor(Date.now() / 1000));
|
||||
const renderPost = shallowRef<Array<TGApp.Plugins.Mys.SctPost.Base>>([]);
|
||||
const postData = shallowRef<TGApp.Plugins.Mys.Post.FullData>();
|
||||
const renderPost = shallowRef<Array<TGApp.BBS.SctPost.Base>>([]);
|
||||
const postData = shallowRef<TGApp.BBS.Post.FullData>();
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
let shareTimer: NodeJS.Timeout | null = null;
|
||||
@@ -208,8 +208,8 @@ function getRepublishAuthorization(type: number): string {
|
||||
}
|
||||
|
||||
async function getRenderPost(
|
||||
data: TGApp.Plugins.Mys.Post.FullData,
|
||||
): Promise<Array<TGApp.Plugins.Mys.SctPost.Base>> {
|
||||
data: TGApp.BBS.Post.FullData,
|
||||
): Promise<Array<TGApp.BBS.SctPost.Base>> {
|
||||
const postContent = data.post.content;
|
||||
let jsonParse: string;
|
||||
if (postContent.startsWith("<")) {
|
||||
@@ -228,8 +228,8 @@ async function getRenderPost(
|
||||
}
|
||||
|
||||
async function parseContent(content: string): Promise<string> {
|
||||
const data: TGApp.Plugins.Mys.SctPost.Other = JSON.parse(content);
|
||||
const result: TGApp.Plugins.Mys.SctPost.Base[] = [];
|
||||
const data: TGApp.BBS.SctPost.Other = JSON.parse(content);
|
||||
const result: TGApp.BBS.SctPost.Base[] = [];
|
||||
for (const key of Object.keys(data)) {
|
||||
switch (key) {
|
||||
case "describe":
|
||||
@@ -301,7 +301,7 @@ async function toTopic(topic: TGApp.BBS.Topic.Info): Promise<void> {
|
||||
await emit("active_deep_link", `router?path=/posts/topic/${gid}/${topic.id}`);
|
||||
}
|
||||
|
||||
async function toForum(forum: TGApp.Plugins.Mys.Post.Forum): Promise<void> {
|
||||
async function toForum(forum: TGApp.BBS.Post.Forum): Promise<void> {
|
||||
await emit("active_deep_link", `router?path=/posts/forum/${forum.game_id}/${forum.id}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@ async function getEmoticonSet(): Promise<Record<string, string> | TGApp.BBS.Resp
|
||||
* @description 根据 cookie 获取用户信息
|
||||
* @since Beta v0.5.0
|
||||
* @param {TGApp.App.Account.Cookie} cookie - 账户 cookie
|
||||
* @returns {Promise<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.User.Info>}
|
||||
* @returns {Promise<TGApp.BBS.Response.Base | TGApp.BBS.User.Info>}
|
||||
*/
|
||||
async function getUserFullInfo(
|
||||
cookie: TGApp.App.Account.Cookie,
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.User.Info> {
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.BBS.User.Info> {
|
||||
const ck = { cookie_token: cookie.cookie_token, account_id: cookie.account_id };
|
||||
const params = { gids: "2" };
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>(
|
||||
const resp = await TGHttp<TGApp.BBS.User.InfoResp>(
|
||||
"https://bbs-api.miyoushe.com/user/wapi/getUserFullInfo",
|
||||
{ method: "GET", headers: getRequestHeader(ck, "GET", params, "X4", true), query: params },
|
||||
);
|
||||
@@ -51,14 +51,14 @@ async function getUserFullInfo(
|
||||
* @since Beta v0.7.1
|
||||
* @param {number} gid - gid
|
||||
* @param {string} userId - 用户 id
|
||||
* @returns {Promise<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.User.Info>}
|
||||
* @returns {Promise<TGApp.BBS.Response.Base | TGApp.BBS.User.Info>}
|
||||
*/
|
||||
async function getOtherUserInfo(
|
||||
gid: number,
|
||||
userId: string,
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.User.Info> {
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.BBS.User.Info> {
|
||||
const params = { gids: gid.toString(), uid: userId };
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>(
|
||||
const resp = await TGHttp<TGApp.BBS.User.InfoResp>(
|
||||
"https://bbs-api.miyoushe.com/user/wapi/getUserFullInfo",
|
||||
{ method: "GET", headers: getRequestHeader({}, "GET", params, "X4", true), query: params },
|
||||
);
|
||||
|
||||
@@ -15,16 +15,16 @@ const bapBu: Readonly<string> = "https://bbs-api.miyoushe.com/painter/wapi/";
|
||||
* @param {string} newsType 咨讯类型: 1 为公告,2 为活动,3 为咨讯
|
||||
* @param {number} pageSize 返回数量
|
||||
* @param {number} lastId 上一次请求的最后一条数据的 id
|
||||
* @return {Promise<TGApp.BBS.News.Res>}
|
||||
* @return {Promise<TGApp.BBS.Post.NewsRes>}
|
||||
*/
|
||||
async function getNewsList(
|
||||
gid: string = "2",
|
||||
newsType: string = "1",
|
||||
pageSize: number = 20,
|
||||
lastId: number = 0,
|
||||
): Promise<TGApp.BBS.News.Res> {
|
||||
): Promise<TGApp.BBS.Post.NewsRes> {
|
||||
return (
|
||||
await TGHttp<TGApp.BBS.News.Resp>(`${bapBu}getNewsList`, {
|
||||
await TGHttp<TGApp.BBS.Post.NewsResp>(`${bapBu}getNewsList`, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
query: { gids: gid, page_size: pageSize, type: newsType, last_id: lastId },
|
||||
|
||||
@@ -15,12 +15,12 @@ const Referer: Readonly<string> = "https://bbs.mihoyo.com/";
|
||||
* @since Beta v0.7.1
|
||||
* @param {number|string} postId 帖子 ID
|
||||
* @param {Record<string, string>} cookie Cookie
|
||||
* @return {Promise<TGApp.Plugins.Mys.Post.FullData|TGApp.BBS.Response.Base>}
|
||||
* @return {Promise<TGApp.BBS.Post.FullData | TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
async function getPostFull(
|
||||
postId: number | string,
|
||||
cookie?: Record<string, string>,
|
||||
): Promise<TGApp.Plugins.Mys.Post.FullData | TGApp.BBS.Response.Base> {
|
||||
): Promise<TGApp.BBS.Post.FullData | TGApp.BBS.Response.Base> {
|
||||
const param = { post_id: postId, read: 1 };
|
||||
let header;
|
||||
if (cookie) {
|
||||
@@ -29,7 +29,7 @@ async function getPostFull(
|
||||
"x-rpc-client_type": "2",
|
||||
};
|
||||
} else header = { referer: Referer };
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.Post.Response>(`${bapBu}getPostFull`, {
|
||||
const resp = await TGHttp<TGApp.BBS.Post.FullResp>(`${bapBu}getPostFull`, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: param,
|
||||
@@ -42,11 +42,11 @@ async function getPostFull(
|
||||
* @description 获取合集帖子
|
||||
* @since Beta v0.7.1
|
||||
* @param {string} collectionId 合集 ID
|
||||
* @returns {Promise<TGApp.Plugins.Mys.Post.FullData[]>}
|
||||
* @returns {Promise<Array<TGApp.BBS.Post.FullData>>}
|
||||
*/
|
||||
async function getPostFullInCollection(
|
||||
collectionId: string,
|
||||
): Promise<Array<TGApp.Plugins.Mys.Post.FullData>> {
|
||||
): Promise<Array<TGApp.BBS.Post.FullData>> {
|
||||
return (
|
||||
await TGHttp<TGApp.BBS.Collection.PostsResp>(`${bapBu}getPostFullInCollection`, {
|
||||
method: "GET",
|
||||
@@ -177,15 +177,15 @@ async function getTopicPostList(
|
||||
* @param {string} gid 游戏分区 ID
|
||||
* @param {string} keyword 关键词
|
||||
* @param {string} lastId 最后一条帖子 ID
|
||||
* @return {Promise<TGApp.BBS.Search.PostsRes>} 返回帖子列表
|
||||
* @return {Promise<TGApp.BBS.Post.SearchRes>} 返回帖子列表
|
||||
*/
|
||||
async function searchPosts(
|
||||
gid: string = "2",
|
||||
keyword: string,
|
||||
lastId: string,
|
||||
): Promise<TGApp.BBS.Search.PostsRes> {
|
||||
): Promise<TGApp.BBS.Post.SearchRes> {
|
||||
return (
|
||||
await TGHttp<TGApp.BBS.Search.PostsResp>(`${bapBu}searchPosts`, {
|
||||
await TGHttp<TGApp.BBS.Post.SearchResp>(`${bapBu}searchPosts`, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
query: { gids: gid, keyword, last_id: lastId, size: 20 },
|
||||
|
||||
@@ -129,15 +129,14 @@ async function genAuthKey2(
|
||||
* @description 通过cookie获取游戏账号
|
||||
* @since Beta v0.7.2
|
||||
* @param {TGApp.App.Account.Cookie} cookie cookie
|
||||
* @returns {Promise<TGApp.BBS.Account.GameAccount[]|TGApp.BBS.Response.Base>}
|
||||
* @returns {Promise<Array<TGApp.BBS.Game.Account>|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
async function getUserGameRolesByCookie(
|
||||
cookie: TGApp.App.Account.Cookie,
|
||||
): Promise<TGApp.BBS.Account.GameAccount[] | TGApp.BBS.Response.Base> {
|
||||
): Promise<Array<TGApp.BBS.Game.Account> | TGApp.BBS.Response.Base> {
|
||||
const ck = { account_id: cookie.account_id, cookie_token: cookie.cookie_token };
|
||||
const params = { game_biz: "hk4e_cn" };
|
||||
type ResType = { list: Array<TGApp.BBS.Account.GameAccount> };
|
||||
const resp = await TGHttp<TGApp.BBS.Response.BaseWithData<ResType>>(
|
||||
const resp = await TGHttp<TGApp.BBS.Game.AccountResp>(
|
||||
`${taBu}binding/api/getUserGameRolesByCookie`,
|
||||
{
|
||||
method: "GET",
|
||||
|
||||
@@ -41,15 +41,13 @@ function handleAnnoContent(data: string): string {
|
||||
* @description 解析公告内容,转换为结构化数据
|
||||
* @since Beta v0.5.3
|
||||
* @param {TGApp.BBS.Announcement.ContentItem} anno - 公告内容
|
||||
* @returns {TGApp.Plugins.Mys.SctPost.Base[]} 结构化数据
|
||||
* @returns {TGApp.BBS.SctPost.Base[]} 结构化数据
|
||||
*/
|
||||
function parseAnnoContent(
|
||||
anno: TGApp.BBS.Announcement.ContentItem,
|
||||
): Array<TGApp.Plugins.Mys.SctPost.Base> {
|
||||
function parseAnnoContent(anno: TGApp.BBS.Announcement.ContentItem): Array<TGApp.BBS.SctPost.Base> {
|
||||
const parser = new DOMParser();
|
||||
const first = handleAnnoContent(anno.content);
|
||||
const doc = parser.parseFromString(first, "text/html");
|
||||
const children: Array<TGApp.Plugins.Mys.SctPost.Base> = [];
|
||||
const children: Array<TGApp.BBS.SctPost.Base> = [];
|
||||
if (anno.banner !== "") children.push({ insert: { image: anno.banner } });
|
||||
doc.body.childNodes.forEach((child) => children.push(...parseAnnoNode(child)));
|
||||
return children;
|
||||
@@ -60,13 +58,10 @@ function parseAnnoContent(
|
||||
* @since Beta v0.7.0
|
||||
* @param {Node} node - 节点
|
||||
* @param {Record<string, string>} attr - 属性
|
||||
* @returns {TGApp.Plugins.Mys.SctPost.Base} 结构化数据
|
||||
* @returns {TGApp.BBS.SctPost.Base} 结构化数据
|
||||
*/
|
||||
function parseAnnoNode(
|
||||
node: Node,
|
||||
attr?: Record<string, string>,
|
||||
): Array<TGApp.Plugins.Mys.SctPost.Base> {
|
||||
let defaultRes: TGApp.Plugins.Mys.SctPost.Base = {
|
||||
function parseAnnoNode(node: Node, attr?: Record<string, string>): Array<TGApp.BBS.SctPost.Base> {
|
||||
let defaultRes: TGApp.BBS.SctPost.Base = {
|
||||
insert: {
|
||||
tag: node.nodeName,
|
||||
text: node.textContent,
|
||||
@@ -95,7 +90,7 @@ function parseAnnoNode(
|
||||
return [parseAnnoParagraph(element, attr)];
|
||||
}
|
||||
if (element.tagName === "OL" || element.tagName === "LI" || element.tagName === "UL") {
|
||||
const res: Array<TGApp.Plugins.Mys.SctPost.Base> = [];
|
||||
const res: Array<TGApp.BBS.SctPost.Base> = [];
|
||||
Array.from(element.children).forEach((child) => res.push(...parseAnnoNode(child, attr)));
|
||||
for (const comp of res) {
|
||||
if (comp.children) {
|
||||
@@ -112,7 +107,7 @@ function parseAnnoNode(
|
||||
if (element.tagName === "TABLE") return [parseAnnoTable(element)];
|
||||
if (element.tagName === "DIV") {
|
||||
if (element.childNodes.length > 1) {
|
||||
const res: Array<TGApp.Plugins.Mys.SctPost.Base> = [];
|
||||
const res: Array<TGApp.BBS.SctPost.Base> = [];
|
||||
element.childNodes.forEach((child) => res.push(...parseAnnoNode(child, attr)));
|
||||
return res;
|
||||
}
|
||||
@@ -128,12 +123,12 @@ function parseAnnoNode(
|
||||
}
|
||||
if (element.tagName === "SPAN") return [parseAnnoSpan(element, attr)];
|
||||
if (element.tagName === "STRONG") {
|
||||
const res: Array<TGApp.Plugins.Mys.SctPost.Base> = [];
|
||||
const res: Array<TGApp.BBS.SctPost.Base> = [];
|
||||
element.childNodes.forEach((child) => res.push(...parseAnnoNode(child, { bold: "true" })));
|
||||
return res;
|
||||
}
|
||||
if (element.tagName === "T") {
|
||||
const res: Array<TGApp.Plugins.Mys.SctPost.Base> = [];
|
||||
const res: Array<TGApp.BBS.SctPost.Base> = [];
|
||||
element.childNodes.forEach((child) => res.push(...parseAnnoNode(child, attr)));
|
||||
return res;
|
||||
}
|
||||
@@ -145,12 +140,9 @@ function parseAnnoNode(
|
||||
* @since Beta v0.7.0
|
||||
* @param {HTMLElement} p - 段落元素
|
||||
* @param {Record<string, string>} attr - 属性
|
||||
* @returns {TGApp.Plugins.Mys.SctPost.Base} 结构化数据
|
||||
* @returns {TGApp.BBS.SctPost.Base} 结构化数据
|
||||
*/
|
||||
function parseAnnoParagraph(
|
||||
p: HTMLElement,
|
||||
attr?: Record<string, string>,
|
||||
): TGApp.Plugins.Mys.SctPost.Base {
|
||||
function parseAnnoParagraph(p: HTMLElement, attr?: Record<string, string>): TGApp.BBS.SctPost.Base {
|
||||
const defaultRes = {
|
||||
insert: {
|
||||
tag: p.tagName,
|
||||
@@ -193,9 +185,9 @@ function parseAnnoParagraph(
|
||||
if (child.tagName === "T") return { insert: "", children: parseAnnoNode(child) };
|
||||
return defaultRes;
|
||||
}
|
||||
const res: TGApp.Plugins.Mys.SctPost.Base = { insert: "", children: [] };
|
||||
const res: TGApp.BBS.SctPost.Base = { insert: "", children: [] };
|
||||
p.childNodes.forEach((child) => {
|
||||
let childRes: TGApp.Plugins.Mys.SctPost.Base;
|
||||
let childRes: TGApp.BBS.SctPost.Base;
|
||||
if (child.nodeType === Node.TEXT_NODE) {
|
||||
childRes = { insert: child.textContent ?? "" };
|
||||
} else if (child.nodeType === Node.ELEMENT_NODE) {
|
||||
@@ -227,12 +219,9 @@ function parseAnnoParagraph(
|
||||
* @since Beta v0.7.0
|
||||
* @param {HTMLElement} span - span 元素
|
||||
* @param {Record<string, string>} attr - 属性
|
||||
* @returns {TGApp.Plugins.Mys.SctPost.Base} 结构化数据
|
||||
* @returns {TGApp.BBS.SctPost.Base} 结构化数据
|
||||
*/
|
||||
function parseAnnoSpan(
|
||||
span: HTMLElement,
|
||||
attr?: Record<string, string>,
|
||||
): TGApp.Plugins.Mys.SctPost.Base {
|
||||
function parseAnnoSpan(span: HTMLElement, attr?: Record<string, string>): TGApp.BBS.SctPost.Base {
|
||||
const defaultRes = {
|
||||
insert: {
|
||||
tag: span.tagName,
|
||||
@@ -281,9 +270,9 @@ function parseAnnoSpan(
|
||||
* @description 解析公告图片
|
||||
* @since Beta v0.7.0
|
||||
* @param {HTMLElement} img - 图片元素
|
||||
* @returns {TGApp.Plugins.Mys.SctPost.Base} 结构化数据
|
||||
* @returns {TGApp.BBS.SctPost.Base} 结构化数据
|
||||
*/
|
||||
function parseAnnoImage(img: HTMLElement): TGApp.Plugins.Mys.SctPost.Base {
|
||||
function parseAnnoImage(img: HTMLElement): TGApp.BBS.SctPost.Base {
|
||||
if (img.tagName !== "IMG") {
|
||||
return {
|
||||
insert: {
|
||||
@@ -304,9 +293,9 @@ function parseAnnoImage(img: HTMLElement): TGApp.Plugins.Mys.SctPost.Base {
|
||||
* @description 解析公告锚点
|
||||
* @since Beta v0.7.0
|
||||
* @param {HTMLElement} a - 锚点元素
|
||||
* @returns {TGApp.Plugins.Mys.SctPost.Base} 结构化数据
|
||||
* @returns {TGApp.BBS.SctPost.Base} 结构化数据
|
||||
*/
|
||||
function parseAnnoAnchor(a: HTMLElement): TGApp.Plugins.Mys.SctPost.Base {
|
||||
function parseAnnoAnchor(a: HTMLElement): TGApp.BBS.SctPost.Base {
|
||||
if (a.tagName !== "A") {
|
||||
return {
|
||||
insert: {
|
||||
@@ -333,9 +322,9 @@ function parseAnnoAnchor(a: HTMLElement): TGApp.Plugins.Mys.SctPost.Base {
|
||||
* @description 解析公告详情
|
||||
* @since Beta v0.7.0
|
||||
* @param {HTMLElement} details - 详情元素
|
||||
* @returns {TGApp.Plugins.Mys.SctPost.Base} 结构化数据
|
||||
* @returns {TGApp.BBS.SctPost.Base} 结构化数据
|
||||
*/
|
||||
function parseAnnoDetails(details: HTMLElement): TGApp.Plugins.Mys.SctPost.Base {
|
||||
function parseAnnoDetails(details: HTMLElement): TGApp.BBS.SctPost.Base {
|
||||
const defaultRes = {
|
||||
insert: {
|
||||
tag: details.tagName,
|
||||
@@ -368,9 +357,9 @@ function parseAnnoDetails(details: HTMLElement): TGApp.Plugins.Mys.SctPost.Base
|
||||
* @description 解析公告表格
|
||||
* @since Beta v0.7.0
|
||||
* @param {HTMLElement} table - 表格元素
|
||||
* @returns {TGApp.Plugins.Mys.SctPost.Base} 结构化数据
|
||||
* @returns {TGApp.BBS.SctPost.Base} 结构化数据
|
||||
*/
|
||||
function parseAnnoTable(table: HTMLElement): TGApp.Plugins.Mys.SctPost.Base {
|
||||
function parseAnnoTable(table: HTMLElement): TGApp.BBS.SctPost.Base {
|
||||
const defaultRes = {
|
||||
insert: {
|
||||
tag: table.tagName,
|
||||
|
||||
Reference in New Issue
Block a user