mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-19 04:29:45 +08:00
♻️ 重构部分请求
This commit is contained in:
@@ -1,23 +1,17 @@
|
||||
/**
|
||||
* @file plugins/Mys/index.ts
|
||||
* @description Mys plugin index
|
||||
* @since Beta v0.6.8
|
||||
* @since Beta v0.7.1
|
||||
*/
|
||||
|
||||
import { doCaptchaLogin, getCaptcha } from "./request/doCaptchaLogin.js";
|
||||
import { getGachaData, getPositionData } from "./request/obcReq.js";
|
||||
import * as Painter from "./request/painterReq.js";
|
||||
import * as Post from "./request/postReq.js";
|
||||
import { getGachaCard } from "./utils/getGachaCard.js";
|
||||
import getLotteryCard from "./utils/getLotteryCard.js";
|
||||
import getPositionCard from "./utils/getPositionCard.js";
|
||||
|
||||
const Mys = {
|
||||
Post,
|
||||
Painter,
|
||||
Gacha: { get: getGachaData, card: getGachaCard },
|
||||
Position: { get: getPositionData, card: getPositionCard },
|
||||
Lottery: { get: Painter.lotteryUserShow, card: getLotteryCard },
|
||||
User: { getCaptcha, login: doCaptchaLogin },
|
||||
};
|
||||
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/request/painterReq.ts
|
||||
* @description painter下的请求
|
||||
* @since Beta v0.6.2
|
||||
*/
|
||||
import TGHttp from "@/utils/TGHttp.js";
|
||||
|
||||
// MysPainterApiBaseUrl => Mpabu
|
||||
const Mpabu: Readonly<string> = "https://bbs-api.miyoushe.com/painter/wapi/";
|
||||
|
||||
/**
|
||||
* @description 获取 News 列表
|
||||
* @since Beta v0.6.2
|
||||
* @param {string} gid GID
|
||||
* @param {string} newsType 咨讯类型: 1 为公告,2 为活动,3 为咨讯
|
||||
* @param {number} pageSize 返回数量
|
||||
* @param {number} lastId 上一次请求的最后一条数据的 id
|
||||
* @return {Promise<TGApp.Plugins.Mys.News.FullData>}
|
||||
*/
|
||||
export async function getNewsList(
|
||||
gid: string = "2",
|
||||
newsType: string = "1",
|
||||
pageSize: number = 20,
|
||||
lastId: number = 0,
|
||||
): Promise<TGApp.Plugins.Mys.News.FullData> {
|
||||
return (
|
||||
await TGHttp<TGApp.Plugins.Mys.News.Response>(`${Mpabu}getNewsList`, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
query: { gids: gid, page_size: pageSize, type: newsType, last_id: lastId },
|
||||
})
|
||||
).data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取最近版块热门帖子列表
|
||||
* @since Beta v0.6.7
|
||||
* @param {number} forumId 版块 ID
|
||||
* @param {number} gid 社区 ID
|
||||
* @param {number} pageSize 每页数量
|
||||
* @param {string} lastId 最后 ID
|
||||
* @return {Promise<TGApp.Plugins.Mys.Forum.FullData>}
|
||||
*/
|
||||
export async function getHotForumPostList(
|
||||
forumId: number,
|
||||
gid: number,
|
||||
lastId?: string,
|
||||
pageSize: number = 20,
|
||||
): Promise<TGApp.Plugins.Mys.Forum.FullData> {
|
||||
type ReqParams = {
|
||||
forum_id: number;
|
||||
gids: number;
|
||||
page_size: number;
|
||||
is_good: boolean;
|
||||
last_id?: string;
|
||||
};
|
||||
const params: ReqParams = {
|
||||
forum_id: forumId,
|
||||
gids: gid,
|
||||
page_size: pageSize,
|
||||
is_good: false,
|
||||
};
|
||||
if (lastId) params.last_id = lastId;
|
||||
return (
|
||||
await TGHttp<TGApp.Plugins.Mys.Forum.Response>(`${Mpabu}getHotForumPostList`, {
|
||||
method: "GET",
|
||||
query: params,
|
||||
})
|
||||
).data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取最近版块帖子列表
|
||||
* @since Beta v0.6.7
|
||||
* @param {number} forumId 版块 ID
|
||||
* @param {number} gid 社区 ID
|
||||
* @param {number} type 排序方式: 1-最新回复,2-最新发布
|
||||
* @param {string} lastId 最后 ID
|
||||
* @param {number} pageSize 每页数量
|
||||
* @return {Promise<TGApp.Plugins.Mys.Forum.FullData>}
|
||||
*/
|
||||
export async function getRecentForumPostList(
|
||||
forumId: number,
|
||||
gid: number,
|
||||
type: number = 1,
|
||||
lastId?: string,
|
||||
pageSize: number = 20,
|
||||
): Promise<TGApp.Plugins.Mys.Forum.FullData> {
|
||||
type ReqParams = {
|
||||
forum_id: number;
|
||||
gids: number;
|
||||
sort_type: number;
|
||||
is_good: boolean;
|
||||
page_size: number;
|
||||
last_id?: string;
|
||||
};
|
||||
const params: ReqParams = {
|
||||
forum_id: forumId,
|
||||
gids: gid,
|
||||
sort_type: type,
|
||||
is_good: false,
|
||||
page_size: pageSize,
|
||||
};
|
||||
if (lastId) params.last_id = lastId;
|
||||
return (
|
||||
await TGHttp<TGApp.Plugins.Mys.Forum.Response>(`${Mpabu}getRecentForumPostList`, {
|
||||
method: "GET",
|
||||
query: params,
|
||||
})
|
||||
).data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取抽奖信息
|
||||
* @since Beta v0.6.2
|
||||
* @param {string} lotteryId 抽奖 ID
|
||||
* @return {Promise<TGApp.BBS.Response.Base|TGApp.Plugins.Mys.Lottery.FullData>}
|
||||
*/
|
||||
export async function lotteryUserShow(
|
||||
lotteryId: string,
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.Lottery.FullData> {
|
||||
const resp = await TGHttp<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.Lottery.Response>(
|
||||
`${Mpabu}lottery/user/show`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
query: { id: lotteryId },
|
||||
},
|
||||
);
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
return resp.data.show_lottery;
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/request/postReq.ts
|
||||
* @description 帖子相关的获取
|
||||
* @since Beta v0.7.0
|
||||
*/
|
||||
|
||||
import TGHttp from "@/utils/TGHttp.js";
|
||||
import { getRequestHeader } from "@/web/utils/getRequestHeader.js";
|
||||
|
||||
// MysPostApiBaseUrl => Mpabu
|
||||
const Mpabu: Readonly<string> = "https://bbs-api.mihoyo.com/post/wapi/";
|
||||
// MysTopicApiBaseUrl => Mtapu
|
||||
const Mtabu: Readonly<string> = "https://bbs-api.miyoushe.com/topic/wapi/";
|
||||
const Referer: Readonly<string> = "https://bbs.mihoyo.com/";
|
||||
|
||||
/**
|
||||
* @description 获取单个帖子信息
|
||||
* @since Beta v0.7.0
|
||||
* @param {number} postId 帖子 ID
|
||||
* @param {Record<string, string>} cookie Cookie
|
||||
* @return {Promise<TGApp.Plugins.Mys.Post.FullData|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getPostFull(
|
||||
postId: number,
|
||||
cookie?: Record<string, string>,
|
||||
): Promise<TGApp.Plugins.Mys.Post.FullData | TGApp.BBS.Response.Base> {
|
||||
const param = { post_id: postId, read: 1 };
|
||||
let header;
|
||||
if (cookie) {
|
||||
header = {
|
||||
...getRequestHeader(cookie, "GET", param, "K2", true),
|
||||
"x-rpc-client_type": "2",
|
||||
};
|
||||
} else header = { referer: Referer };
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.Post.Response>(`${Mpabu}getPostFull`, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: param,
|
||||
});
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
return resp.data.post;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取合集帖子
|
||||
* @since Beta v0.6.2
|
||||
* @param {string} collectionId 合集 ID
|
||||
* @returns {Promise<TGApp.Plugins.Mys.Post.FullData[]>}
|
||||
*/
|
||||
export async function getPostFullInCollection(
|
||||
collectionId: string,
|
||||
): Promise<TGApp.Plugins.Mys.Collection.Data[]> {
|
||||
return (
|
||||
await TGHttp<TGApp.Plugins.Mys.Collection.ResponsePosts>(`${Mpabu}getPostFullInCollection`, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json", referer: Referer },
|
||||
query: { collection_id: collectionId },
|
||||
})
|
||||
).data.posts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取帖子回复信息
|
||||
* @since Beta v0.6.4
|
||||
* @param {string} postId 帖子 ID
|
||||
* @param {number} gid 社区 ID
|
||||
* @param {boolean} isHot 是否热门
|
||||
* @param {boolean} onlyMaster 是否只看楼主
|
||||
* @param {number} orderType 排序类型
|
||||
* @param {string} lastId 最后 ID
|
||||
* @param {number} size 每页大小
|
||||
* @return {Promise<TGApp.Plugins.Mys.Reply.ReplyData|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getPostReplies(
|
||||
postId: string,
|
||||
gid: number,
|
||||
isHot: boolean = true,
|
||||
lastId?: string,
|
||||
onlyMaster: boolean = false,
|
||||
orderType?: 1 | 2,
|
||||
size: number = 20,
|
||||
): Promise<TGApp.Plugins.Mys.Reply.ReplyData | TGApp.BBS.Response.Base> {
|
||||
type GprParam = {
|
||||
post_id: string;
|
||||
gids: number;
|
||||
is_hot: boolean;
|
||||
size: number;
|
||||
last_id?: string;
|
||||
order_type?: 1 | 2;
|
||||
only_master?: boolean;
|
||||
};
|
||||
const params: GprParam = { post_id: postId, gids: gid, is_hot: isHot, size: size };
|
||||
if (lastId) params.last_id = lastId;
|
||||
if (orderType) params.order_type = orderType;
|
||||
if (onlyMaster) {
|
||||
params.is_hot = false;
|
||||
params.only_master = onlyMaster;
|
||||
params.order_type = 1;
|
||||
}
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.Reply.Response>(`${Mpabu}getPostReplies`, {
|
||||
method: "GET",
|
||||
headers: { referer: Referer },
|
||||
query: params,
|
||||
});
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取帖子子回复信息
|
||||
* @since Beta v0.6.2
|
||||
* @param {number} floorId 楼层 ID
|
||||
* @param {number} gid 社区 ID
|
||||
* @param {string} postId 帖子 ID
|
||||
* @param {string} lastId 最后 ID
|
||||
* @param {number} size 每页大小
|
||||
* @return {Promise<TGApp.Plugins.Mys.Reply.SubData|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getSubReplies(
|
||||
floorId: number,
|
||||
gid: number,
|
||||
postId: string,
|
||||
lastId?: string,
|
||||
size: number = 20,
|
||||
): Promise<TGApp.Plugins.Mys.Reply.SubData | TGApp.BBS.Response.Base> {
|
||||
type GsrParam = {
|
||||
floor_id: number;
|
||||
gids: number;
|
||||
post_id: string;
|
||||
size: number;
|
||||
last_id?: string;
|
||||
};
|
||||
const params: GsrParam = { floor_id: floorId, gids: gid, post_id: postId, size: size };
|
||||
if (lastId) params.last_id = lastId;
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.Reply.SubResponse>(`${Mpabu}getSubReplies`, {
|
||||
method: "GET",
|
||||
headers: { referer: Referer },
|
||||
query: params,
|
||||
});
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取特定话题信息
|
||||
* @since Beta v0.6.3
|
||||
* @param {string} gid 游戏分区 ID
|
||||
* @param {string} topicId 话题 ID
|
||||
* @return {Promise<TGApp.Plugins.Mys.Topic.InfoData|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getTopicFullInfo(
|
||||
gid: string,
|
||||
topicId: string,
|
||||
): Promise<TGApp.Plugins.Mys.Topic.InfoData | TGApp.BBS.Response.Base> {
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.Topic.InfoResponse>(`${Mtabu}getTopicFullInfo`, {
|
||||
method: "GET",
|
||||
headers: { referer: Referer },
|
||||
query: { gids: gid, id: topicId },
|
||||
});
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取特定话题帖子列表
|
||||
* @since Beta v0.6.3
|
||||
* @param {number} gid 游戏分区 ID
|
||||
* @param {string} topicId 话题 ID
|
||||
* @param {string} orderType 排序方式
|
||||
* @param {string} lastId 最后一条帖子 ID
|
||||
* @param {number} size 每页大小
|
||||
* @return {Promise<TGApp.Plugins.Mys.Topic.PostData|TGApp.BBS.Response.Base>}
|
||||
*/
|
||||
export async function getTopicPostList(
|
||||
gid: number,
|
||||
topicId: string,
|
||||
orderType: number = 0,
|
||||
lastId?: string,
|
||||
size: number = 20,
|
||||
): Promise<TGApp.Plugins.Mys.Topic.PostData | TGApp.BBS.Response.Base> {
|
||||
const resp = await TGHttp<TGApp.Plugins.Mys.Topic.PostResponse>(`${Mpabu}getTopicPostList`, {
|
||||
method: "GET",
|
||||
headers: { referer: Referer },
|
||||
query: {
|
||||
gids: gid,
|
||||
game_id: gid,
|
||||
topic_id: topicId,
|
||||
list_type: orderType,
|
||||
last_id: lastId ?? "",
|
||||
page_size: size,
|
||||
},
|
||||
});
|
||||
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 搜索帖子
|
||||
* @since Beta v0.6.2
|
||||
* @param {string} gid 游戏分区 ID
|
||||
* @param {string} keyword 关键词
|
||||
* @param {string} lastId 最后一条帖子 ID
|
||||
* @return {Promise<TGApp.Plugins.Mys.Search.PostsResponseData>} 返回帖子列表
|
||||
*/
|
||||
export async function searchPosts(
|
||||
gid: string = "2",
|
||||
keyword: string,
|
||||
lastId: string,
|
||||
): Promise<TGApp.Plugins.Mys.Search.PostsResponseData> {
|
||||
return (
|
||||
await TGHttp<TGApp.Plugins.Mys.Search.PostsResponse>(`${Mpabu}searchPosts`, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
query: { gids: gid, keyword, last_id: lastId, size: 20 },
|
||||
})
|
||||
).data;
|
||||
}
|
||||
67
src/plugins/Mys/types/Collection.d.ts
vendored
67
src/plugins/Mys/types/Collection.d.ts
vendored
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/Collection.d.ts
|
||||
* @description Mys 插件合集类型声明
|
||||
* @since Beta v0.5.5
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Mys 合集类型
|
||||
* @since Beta v0.5.5
|
||||
* @namespace TGApp.Plugins.Mys.Collection
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
declare namespace TGApp.Plugins.Mys.Collection {
|
||||
/**
|
||||
* @description 合集信息
|
||||
* @since Beta v0.3.9
|
||||
* @interface Info
|
||||
* @property {string} cover 封面
|
||||
* @property {string} desc 描述
|
||||
* @property {number} id 合集 ID
|
||||
* @property {boolean} is_delete 是否删除
|
||||
* @property {boolean} is_following 是否关注
|
||||
* @property {number} post_num 帖子数量
|
||||
* @property {number} post_updated_at 帖子更新时间(秒级时间戳)
|
||||
* @property {number} status 状态
|
||||
* @property {string} title 标题
|
||||
* @property {number} uid 用户 ID
|
||||
* @property {number} view_num 浏览量
|
||||
* @return Info
|
||||
*/
|
||||
interface Info {
|
||||
cover: string;
|
||||
desc: string;
|
||||
id: number;
|
||||
is_delete: boolean;
|
||||
is_following: boolean;
|
||||
post_num: number;
|
||||
post_updated_at: number;
|
||||
status: number;
|
||||
title: string;
|
||||
uid: number;
|
||||
view_num: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取合集帖子返回
|
||||
* @since Beta v0.3.9
|
||||
* @interface ResponsePosts
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {Data[]} data.list 合集帖子列表
|
||||
* @return ResponsePosts
|
||||
*/
|
||||
interface ResponsePosts extends TGApp.BBS.Response.BaseWithData {
|
||||
data: {
|
||||
posts: Data[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 合集帖子
|
||||
* @since Beta v0.3.9
|
||||
* @interface Data
|
||||
* @see TGApp.Plugins.Mys.Post.FullData
|
||||
* @return Data
|
||||
*/
|
||||
type Data = TGApp.Plugins.Mys.Post.FullData;
|
||||
}
|
||||
86
src/plugins/Mys/types/Forum.d.ts
vendored
86
src/plugins/Mys/types/Forum.d.ts
vendored
@@ -1,86 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/Forum.d.ts
|
||||
* @description Mys 插件论坛类型定义文件
|
||||
* @since Beta v0.6.3
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Mys 插件论坛类型
|
||||
* @since Beta v0.4.5
|
||||
* @namespace TGApp.Plugins.Mys.Forum
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
declare namespace TGApp.Plugins.Mys.Forum {
|
||||
/**
|
||||
* @description 特定论坛返回数据
|
||||
* @since Beta v0.3.7
|
||||
* @interface Response
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {FullData} data 特定论坛数据
|
||||
* @return Response
|
||||
*/
|
||||
interface Response extends TGApp.BBS.Response.BaseWithData {
|
||||
data: FullData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 特定论坛数据
|
||||
* @since Beta v0.6.3
|
||||
* @interface FullData
|
||||
* @property {string} last_id 最后一条帖子 ID
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {boolean} is_origin 是否原创
|
||||
* @property {number} page 页码
|
||||
* @property {unknown} databox 数据盒子
|
||||
* @property {TGApp.Plugins.Mys.Post.FullData[]} list 帖子列表
|
||||
* @return FullData
|
||||
*/
|
||||
interface FullData {
|
||||
last_id: string;
|
||||
is_last: boolean;
|
||||
is_origin: boolean;
|
||||
page: number;
|
||||
databox: unknown;
|
||||
list: TGApp.Plugins.Mys.Post.FullData[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用于渲染的咨讯卡片
|
||||
* @since Beta v0.4.0
|
||||
* @interface RenderCard
|
||||
* @property {string} title 标题
|
||||
* @property {string} cover 封面图片 URL
|
||||
* @property {string} postId 帖子 ID
|
||||
* @property {string} subtitle 副标题
|
||||
* @property {TGApp.Plugins.Mys.User.Post} user 发帖用户
|
||||
* @property forum 版块
|
||||
* @property {string} forum.name 版块名称
|
||||
* @property {string} forum.icon 版块图标
|
||||
* @property {RenderStatus} status 活动状态,仅活动咨讯有
|
||||
* @property data 帖子统计
|
||||
* @property {number} data.mark 帖子收藏数
|
||||
* @property {number} data.forward 帖子转发数
|
||||
* @property {number} data.like 帖子点赞数
|
||||
* @property {number} data.reply 帖子回复数
|
||||
* @property {number} data.view 帖子浏览数
|
||||
* @return RenderCard
|
||||
*/
|
||||
interface RenderCard {
|
||||
title: string;
|
||||
cover: string;
|
||||
postId: string;
|
||||
subtitle: string;
|
||||
user: TGApp.Plugins.Mys.User.Post;
|
||||
forum: {
|
||||
name: string;
|
||||
icon: string;
|
||||
};
|
||||
data: {
|
||||
mark: number;
|
||||
forward: number;
|
||||
like: number;
|
||||
reply: number;
|
||||
view: number;
|
||||
};
|
||||
}
|
||||
}
|
||||
125
src/plugins/Mys/types/Lottery.d.ts
vendored
125
src/plugins/Mys/types/Lottery.d.ts
vendored
@@ -1,125 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/Lottery.d.ts
|
||||
* @description Mys 插件抽奖类型定义文件
|
||||
* @since Alpha v0.2.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Mys 插件抽奖类型
|
||||
* @since Alpha v0.2.1
|
||||
* @namespace TGApp.Plugins.Mys.Lottery
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
declare namespace TGApp.Plugins.Mys.Lottery {
|
||||
/**
|
||||
* @description 抽奖返回数据
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Response
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {FullData} data.show_lottery 抽奖数据
|
||||
* @return Response
|
||||
*/
|
||||
interface Response extends TGApp.BBS.Response.BaseWithData {
|
||||
data: {
|
||||
show_lottery: FullData;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 抽奖数据
|
||||
* @since Alpha v0.2.1
|
||||
* @interface FullData
|
||||
* @property {string} id 抽奖 ID
|
||||
* @property {TGApp.Plugins.Mys.User.Post} creator 创建者
|
||||
* @property {string} draw_time 抽奖时间
|
||||
* @property {string} participant_way 参与方式 // Forward: 转发
|
||||
* @property {boolean} is_expect_unfocus_user 是否限制未关注用户
|
||||
* @property {boolean} is_expect_non_real_name_user 是否限制未实名用户
|
||||
* @property {Reward[]} user_rewards 用户奖励
|
||||
* @property {string} status 状态 // Settled: 已结算
|
||||
* @property {boolean} is_blocked 是否被屏蔽
|
||||
* @property {string} user_status 用户状态 // NotParticipant: 未参与
|
||||
* @property {boolean} is_upload_address 是否上传地址
|
||||
* @property {string} lottery_entity_summary 抽奖实体摘要
|
||||
* @property {string} entity_id 实体 ID // 若为帖子,则为帖子 ID
|
||||
* @property {string} entity_type 实体类型 // Post: 帖子
|
||||
* @property {string} now_time 当前时间
|
||||
* @return FullData
|
||||
*/
|
||||
interface FullData {
|
||||
id: string;
|
||||
creator: TGApp.Plugins.Mys.User.Post;
|
||||
draw_time: string;
|
||||
participant_way: string;
|
||||
is_expect_unfocus_user: boolean;
|
||||
is_expect_non_real_name_user: boolean;
|
||||
user_rewards: Reward[];
|
||||
status: string;
|
||||
is_blocked: boolean;
|
||||
user_status: string;
|
||||
is_upload_address: boolean;
|
||||
lottery_entity_summary: string;
|
||||
entity_id: string;
|
||||
entity_type: string;
|
||||
now_time: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 抽奖奖励
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Reward
|
||||
* @property {string} reward_name 奖励名称
|
||||
* @property {number} winner_number 获奖人数
|
||||
* @property {number} scheduled_winner_number 预计获奖人数
|
||||
* @property {boolean} is_send_by_post 是否通过帖子发放
|
||||
* @property {TGApp.Plugins.Mys.User.Post[]} users 用户列表
|
||||
* @property {string} id 奖励 ID
|
||||
* @return Reward
|
||||
*/
|
||||
interface Reward {
|
||||
reward_name: string;
|
||||
winner_number: number;
|
||||
scheduled_winner_number: number;
|
||||
is_send_by_post: boolean;
|
||||
users: TGApp.Plugins.Mys.User.Post[];
|
||||
id: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 渲染用的抽奖信息
|
||||
* @since Alpha v0.2.1
|
||||
* @interface RenderCard
|
||||
* @property {string} id 抽奖 ID
|
||||
* @property {string} upWay 参与方式
|
||||
* @property {string} status 状态
|
||||
* @property {TGApp.Plugins.Mys.User.Post} creator 创建者
|
||||
* @property {string} drawTime 开奖时间
|
||||
* @property {RenderReward[]} rewards 奖励列表
|
||||
* @return RenderCard
|
||||
*/
|
||||
interface RenderCard {
|
||||
id: string;
|
||||
upWay: string;
|
||||
status: string;
|
||||
creator: TGApp.Plugins.Mys.User.Post;
|
||||
drawTime: string;
|
||||
rewards: RenderReward[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 渲染用的奖励信息
|
||||
* @since Alpha v0.2.1
|
||||
* @interface RenderReward
|
||||
* @property {string} name 奖励名称
|
||||
* @property {number} win 获奖人数
|
||||
* @property {number} goal 预计获奖人数
|
||||
* @property {TGApp.Plugins.Mys.User.Post[]} users 用户列表
|
||||
* @return RenderReward
|
||||
*/
|
||||
interface RenderReward {
|
||||
name: string;
|
||||
win: number;
|
||||
goal: number;
|
||||
users: TGApp.Plugins.Mys.User.Post[];
|
||||
}
|
||||
}
|
||||
112
src/plugins/Mys/types/News.d.ts
vendored
112
src/plugins/Mys/types/News.d.ts
vendored
@@ -1,112 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/news.d.ts
|
||||
* @description Mys 插件咨讯类型定义文件
|
||||
* @since Beta v0.6.7
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.News {
|
||||
/**
|
||||
* @description 咨讯返回数据
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Response
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {FullData} data 咨讯数据
|
||||
* @return Response
|
||||
*/
|
||||
type Response = TGApp.BBS.Response.BaseWithData & { data: FullData };
|
||||
|
||||
/**
|
||||
* @description 咨讯数据
|
||||
* @since Beta v0.4.5
|
||||
* @interface FullData
|
||||
* @property {number} last_id 最后一条咨讯 ID
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {Item[]} list 咨讯列表
|
||||
* @return FullData
|
||||
*/
|
||||
type FullData = {
|
||||
last_id: number;
|
||||
is_last: boolean;
|
||||
list: Array<TGApp.Plugins.Mys.Post.FullData>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 咨讯元数据,只有活动咨讯才有
|
||||
* @since Alpha v0.2.1
|
||||
* @interface Meta
|
||||
* @property {number} activity_status 活动状态 // ActivityStatus
|
||||
* @property {string} start_at_sec 活动开始时间戳,单位秒
|
||||
* @property {string} end_at_sec 活动结束时间戳,单位秒
|
||||
* @return Meta
|
||||
*/
|
||||
type Meta = { activity_status: number; start_at_sec: string; end_at_sec: string };
|
||||
|
||||
/**
|
||||
* @description 用于渲染的咨讯卡片
|
||||
* @since Beta v0.6.3
|
||||
* @interface RenderCard
|
||||
* @property {string} title 标题
|
||||
* @property {string} cover 封面图片 URL
|
||||
* @property {number} postId 帖子 ID
|
||||
* @property {string} subtitle 副标题
|
||||
* @property {TGApp.Plugins.Mys.User.Post|null} user 发帖用户,可能为 null
|
||||
* @property forum 版块,可能为 null
|
||||
* @property {string} forum.name 版块名称
|
||||
* @property {string} forum.icon 版块图标
|
||||
* @property {RenderStatus} status 活动状态,仅活动咨讯有
|
||||
* @property data 帖子统计,可能为 null
|
||||
* @property {number} data.mark 帖子收藏数
|
||||
* @property {number} data.forward 帖子转发数
|
||||
* @property {number} data.like 帖子点赞数
|
||||
* @property {number} data.reply 帖子回复数
|
||||
* @property {number} data.view 帖子浏览数
|
||||
* @property {TGApp.Plugins.Mys.Topic.Info[]} topics 帖子话题
|
||||
* @return RenderCard
|
||||
*/
|
||||
interface RenderCard {
|
||||
title: string;
|
||||
cover: string;
|
||||
postId: number;
|
||||
subtitle: string;
|
||||
user: TGApp.Plugins.Mys.User.Post | null;
|
||||
forum: RenderForum | null;
|
||||
data: RenderData | null;
|
||||
status?: RenderStatus;
|
||||
topics: TGApp.Plugins.Mys.Topic.Info[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 用于渲染的咨讯状态
|
||||
* @since Beta v0.6.7
|
||||
* @interface RenderStatus
|
||||
* @property {number} stat 活动状态
|
||||
* @property {string} label 活动状态标签
|
||||
* @property {string} color 活动状态颜色
|
||||
* @return RenderStatus
|
||||
*/
|
||||
type RenderStatus = { stat: number; label: string; color: string };
|
||||
|
||||
/**
|
||||
* @description 用于渲染的咨讯信息
|
||||
* @since Beta v0.6.3
|
||||
* @interface RenderData
|
||||
* @property {number} mark 帖子收藏数
|
||||
* @property {number} forward 帖子转发数
|
||||
* @property {number} like 帖子点赞数
|
||||
* @property {number} reply 帖子回复数
|
||||
* @property {number} view 帖子浏览数
|
||||
* @return RenderData
|
||||
*/
|
||||
type RenderData = { mark: number; forward: number; like: number; reply: number; view: number };
|
||||
|
||||
/**
|
||||
* @description 用于渲染的版块信息
|
||||
* @since Beta v0.6.3
|
||||
* @interface RenderForum
|
||||
* @property {string} name 版块名称
|
||||
* @property {string} icon 版块图标
|
||||
* @property {string} id 版块 ID
|
||||
* @return RenderForum
|
||||
*/
|
||||
type RenderForum = { name: string; icon: string; id: number };
|
||||
}
|
||||
21
src/plugins/Mys/types/Post.d.ts
vendored
21
src/plugins/Mys/types/Post.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/post.d.ts
|
||||
* @description Mys 插件帖子类型定义文件
|
||||
* @since Beta v0.6.7
|
||||
* @since Beta v0.7.1
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.Post {
|
||||
@@ -21,7 +21,7 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @interface FullData
|
||||
* @property {Post} post 帖子信息
|
||||
* @property {Forum|null} forum 所属版块,可能为 null
|
||||
* @property {Topic[]} topics 所属话题
|
||||
* @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
|
||||
@@ -39,13 +39,13 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
* @property {boolean} is_block_on 是否被屏蔽
|
||||
* @property {unknown} forum_rank_info 版块排行信息,可能为 null
|
||||
* @property {LinkCard[]} link_card_list 链接卡片列表,可能为空
|
||||
* @property {TGApp.Plugins.Mys.News.Meta} news_meta 咨讯元数据,可能为 null
|
||||
* @property {NewsMeta} news_meta 咨讯元数据,可能为 null
|
||||
* @return FullData
|
||||
*/
|
||||
interface FullData {
|
||||
post: Post;
|
||||
forum: Forum | null;
|
||||
topics: TGApp.Plugins.Mys.Topic.Info[];
|
||||
topics: Array<TGApp.BBS.Topic.Info>;
|
||||
user: TGApp.Plugins.Mys.User.Post | null;
|
||||
self_operation: TGApp.Plugins.Mys.User.SelfOperation;
|
||||
stat: Stat | null;
|
||||
@@ -63,7 +63,7 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
is_block_on: boolean;
|
||||
forum_rank_info: unknown | null;
|
||||
link_card_list: LinkCard[];
|
||||
news_meta: TGApp.Plugins.Mys.News.Meta | null | undefined;
|
||||
news_meta?: NewsMeta | null;
|
||||
recommend_reason: unknown | null;
|
||||
villa_card: unknown | null;
|
||||
is_mentor: boolean;
|
||||
@@ -378,6 +378,17 @@ declare namespace TGApp.Plugins.Mys.Post {
|
||||
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
|
||||
|
||||
252
src/plugins/Mys/types/Reply.d.ts
vendored
252
src/plugins/Mys/types/Reply.d.ts
vendored
@@ -1,252 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/Reply.d.ts
|
||||
* @description Mys 插件帖子回复数据类型定义文件
|
||||
* @since Beta v0.5.5
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Mys 插件帖子回复数据类型定义
|
||||
* @since Beta v0.5.5
|
||||
* @namespace TGApp.Plugins.Mys.Reply
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
declare namespace TGApp.Plugins.Mys.Reply {
|
||||
/**
|
||||
* @description 帖子回复数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface Response
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {ReplyData} data - 回复数据
|
||||
* @return Response
|
||||
*/
|
||||
interface Response extends TGApp.BBS.Response.BaseWithData {
|
||||
data: ReplyData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 子回复数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface SubResponse
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {SubData} data - 子回复数据
|
||||
* @return SubResponse
|
||||
*/
|
||||
interface SubResponse extends TGApp.BBS.Response.BaseWithData {
|
||||
data: SubData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 子回复数据的根数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface SubRootResponse
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {SubRootData} data - 子回复数据
|
||||
* @return SubRootResponse
|
||||
*/
|
||||
interface SubRootResponse extends TGApp.BBS.Response.BaseWithData {
|
||||
data: SubRootData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 子回复数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface SubRootData
|
||||
* @property {TGApp.Plugins.Mys.Post.FullData} post - 帖子数据
|
||||
* @property {ReplyFull} reply - 回复数据
|
||||
* @return SubRootData
|
||||
*/
|
||||
interface SubRootData {
|
||||
post: TGApp.Plugins.Mys.Post.FullData;
|
||||
reply: ReplyFull;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 回复数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface ReplyData
|
||||
* @property {Array<ReplyFull>} list - 回复列表
|
||||
* @property {string} last_id - 最后 ID
|
||||
* @property {boolean} is_last - 是否最后
|
||||
* @property {string} post_owner_id - 帖子拥有者 ID
|
||||
* @property {string} pin_reply_id - 置顶回复 ID
|
||||
* @property {number} fold_reply_num - 折叠回复数
|
||||
* @return ReplyData
|
||||
*/
|
||||
interface ReplyData {
|
||||
list: Array<ReplyFull>;
|
||||
last_id: string;
|
||||
is_last: boolean;
|
||||
post_owner_id: string;
|
||||
pin_reply_id: string;
|
||||
fold_reply_num: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 子回复数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface SubData
|
||||
* @property {Array<ReplyFull>} list - 回复列表
|
||||
* @property {string} last_id - 最后 ID
|
||||
* @property {boolean} is_last - 是否最后
|
||||
* @property {boolean} has_previous - 是否有上一页
|
||||
* @property {string} post_owner_id - 帖子拥有者 ID
|
||||
* @return SubData
|
||||
*/
|
||||
interface SubData {
|
||||
list: Array<ReplyFull>;
|
||||
last_id: string;
|
||||
is_last: boolean;
|
||||
has_previous: boolean;
|
||||
post_owner_id: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 回复数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface ReplyFull
|
||||
* @property {Reply} reply - 回复数据
|
||||
* @property {User} user - 用户数据
|
||||
* @property {Stat} stat - 点赞数据
|
||||
* @property {SelfOperation} self_operation - 自身操作数据
|
||||
* @property {MasterStatus} master_status - 主楼状态数据
|
||||
* @property {Array<TGApp.Plugins.Mys.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 {unknown} r_reply - 未知数据
|
||||
* @property {unknown} r_post - 未知数据
|
||||
* @property {unknown} user_game_info - 未知数据
|
||||
* @return ReplyFull
|
||||
*/
|
||||
interface ReplyFull {
|
||||
reply: Reply;
|
||||
user: TGApp.Plugins.Mys.User.Reply;
|
||||
stat: Stat;
|
||||
self_operation: SelfOperation;
|
||||
master_status: MasterStatus;
|
||||
images: Array<TGApp.Plugins.Mys.Post.Image>;
|
||||
sub_replies: Array<ReplyFull>;
|
||||
is_lz: boolean;
|
||||
sub_reply_count: number;
|
||||
r_user: TGApp.Plugins.Mys.User.Reply | null;
|
||||
r_reply: unknown;
|
||||
r_post: unknown;
|
||||
user_game_info: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 回复数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface Reply
|
||||
* @property {number} game_id - 游戏 ID
|
||||
* @property {string} post_id - 帖子 ID
|
||||
* @property {string} reply_id - 回复 ID
|
||||
* @property {string} uid - 用户 ID
|
||||
* @property {string} r_uid - 回复用户 ID
|
||||
* @property {string} content - 回复内容
|
||||
* @property {number} f_forum_id - 板块 ID
|
||||
* @property {string} f_reply_id - 主楼 ID
|
||||
* @property {number} floor_id - 楼层 ID
|
||||
* @property {number} is_deleted - 是否删除 // 0 未删除 1 已删除
|
||||
* @property {number} delete_src - 删除来源
|
||||
* @property {number} created_at - 创建时间,秒级时间戳
|
||||
* @property {number} updated_at - 更新时间,秒级时间戳
|
||||
* @property {number} deleted_at - 删除时间,秒级时间戳
|
||||
* @property {string} struct_content - 结构化内容
|
||||
* @property {Array<unknown>} structured_content_rows - 结构化内容行
|
||||
* @property {boolean} is_top - 是否置顶
|
||||
* @property {boolean} has_block_word - 是否有屏蔽词
|
||||
* @property {number} overt_status - 公开状态
|
||||
* @property {boolean} is_showing_missing - 是否显示缺失
|
||||
* @property {number} selected_comment_time - 选中评论时间
|
||||
* @property {boolean} is_mentor - 是否导师
|
||||
* @property {number} view_status - 查看状态
|
||||
* @return Reply
|
||||
*/
|
||||
interface Reply {
|
||||
game_id: number;
|
||||
post_id: string;
|
||||
reply_id: string;
|
||||
uid: string;
|
||||
r_uid: string;
|
||||
content: string;
|
||||
f_forum_id: number;
|
||||
f_reply_id: string;
|
||||
floor_id: number;
|
||||
is_deleted: number;
|
||||
delete_src: number;
|
||||
created_at: number;
|
||||
updated_at: number;
|
||||
deleted_at: number;
|
||||
struct_content: string;
|
||||
structured_content_rows: Array<unknown>;
|
||||
is_top: boolean;
|
||||
has_block_word: boolean;
|
||||
overt_status: number;
|
||||
is_showing_missing: boolean;
|
||||
selected_comment_time: number;
|
||||
is_mentor: boolean;
|
||||
view_status: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 回复气泡数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface ReplyBubble
|
||||
* @property {string} assets_id - 资源 ID
|
||||
* @property {string} bg_color - 背景颜色
|
||||
* @property {string} url - 链接
|
||||
* @property {string} name - 名称
|
||||
* @return ReplyBubble
|
||||
*/
|
||||
interface ReplyBubble {
|
||||
assets_id: string;
|
||||
bg_color: string;
|
||||
url: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 点赞数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface Stat
|
||||
* @property {number} reply_num - 回复数
|
||||
* @property {number} like_num - 点赞数
|
||||
* @property {number} sub_num - 子回复数
|
||||
* @property {number} dislike_num - 踩数
|
||||
* @return Stat
|
||||
*/
|
||||
interface Stat {
|
||||
reply_num: number;
|
||||
like_num: number;
|
||||
sub_num: number;
|
||||
dislike_num: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 自身操作数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface SelfOperation
|
||||
* @property {number} attitude - 操作态度
|
||||
* @property {number} reply_vote_attitude - 回复投票态度
|
||||
* @return SelfOperation
|
||||
*/
|
||||
interface SelfOperation {
|
||||
attitude: number;
|
||||
reply_vote_attitude: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 主楼状态数据类型
|
||||
* @since Beta v0.5.5
|
||||
* @interface MasterStatus
|
||||
* @property {boolean} is_official_master - 是否官方
|
||||
* @property {boolean} is_user_master - 是否用户
|
||||
* @return MasterStatus
|
||||
*/
|
||||
interface MasterStatus {
|
||||
is_official_master: boolean;
|
||||
is_user_master: boolean;
|
||||
}
|
||||
}
|
||||
44
src/plugins/Mys/types/Search.d.ts
vendored
44
src/plugins/Mys/types/Search.d.ts
vendored
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/Search.d.ts
|
||||
* @description Mys 插件搜索类型声明
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description 搜索帖子返回
|
||||
* @since Beta v0.4.5
|
||||
* @namespace TGApp.Plugins.Mys.Search
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
declare namespace TGApp.Plugins.Mys.Search {
|
||||
/**
|
||||
* @description 搜索帖子返回
|
||||
* @since Beta v0.4.5
|
||||
* @interface PostsResponse
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {PostsResponseData} data 返回数据
|
||||
* @return PostsResponse
|
||||
*/
|
||||
interface PostsResponse extends TGApp.BBS.Response.BaseWithData {
|
||||
data: PostsResponseData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 搜索帖子返回数据
|
||||
* @since Beta v0.4.5
|
||||
* @interface PostsResponseData
|
||||
* @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 PostsResponseData
|
||||
*/
|
||||
interface PostsResponseData {
|
||||
posts: TGApp.Plugins.Mys.Post.FullData[];
|
||||
last_id: string;
|
||||
is_last: boolean;
|
||||
token_list: string[];
|
||||
databox: Record<string, string>;
|
||||
}
|
||||
}
|
||||
164
src/plugins/Mys/types/Topic.d.ts
vendored
164
src/plugins/Mys/types/Topic.d.ts
vendored
@@ -1,164 +0,0 @@
|
||||
/**
|
||||
* @file plugins/Mys/types/Topic.d.ts
|
||||
* @description Mys 插件话题类型定义文件
|
||||
* @since Beta v0.6.3
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Plugins.Mys.Topic {
|
||||
/**
|
||||
* @description 特定话题返回数据-话题信息
|
||||
* @since Beta v0.6.3
|
||||
* @interface InfoResponse
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {InfoData} data 特定话题数据
|
||||
* @return InfoResponse
|
||||
*/
|
||||
interface InfoResponse extends TGApp.BBS.Response.BaseWithData {
|
||||
data: InfoData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 特定话题返回数据-帖子列表
|
||||
* @since Beta v0.6.3
|
||||
* @interface PostResponse
|
||||
* @extends TGApp.BBS.Response.BaseWithData
|
||||
* @property {PostData} data 特定话题帖子列表数据
|
||||
* @return PostResponse
|
||||
*/
|
||||
interface PostResponse extends TGApp.BBS.Response.BaseWithData {
|
||||
data: PostData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 特定话题数据
|
||||
* @since Beta v0.6.3
|
||||
* @interface InfoData
|
||||
* @property {GameInfo[]} game_info_list 游戏信息列表
|
||||
* @property {boolean} good_exist 是否有精华帖
|
||||
* @property {number} good_post_cnt 精华帖数量
|
||||
* @property {boolean} good_post_exist 是否有精华帖
|
||||
* @property {number} hot_post_cnt 热帖数量
|
||||
* @property {unknown[]} related_forums 相关版块
|
||||
* @property {unknown[]} related_topics 相关话题
|
||||
* @property {unknown[]} top_posts 置顶帖
|
||||
* @property {Info} topic 话题信息
|
||||
* @return InfoData
|
||||
*/
|
||||
interface InfoData {
|
||||
game_info_list: GameInfo[];
|
||||
good_exist: boolean;
|
||||
good_post_cnt: number;
|
||||
good_post_exist: boolean;
|
||||
hot_post_cnt: number;
|
||||
related_forums: unknown[];
|
||||
related_topics: unknown[];
|
||||
top_posts: unknown[];
|
||||
topic: Info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 特定话题帖子列表数据
|
||||
* @since Beta v0.6.3
|
||||
* @interface PostData
|
||||
* @property {boolean} is_last 是否最后一页
|
||||
* @property {boolean} is_origin 是否原创
|
||||
* @property {string} last_id 最后一条帖子 ID
|
||||
* @property {TGApp.Plugins.Mys.Post.FullData[]} posts 帖子列表
|
||||
* @return PostData
|
||||
*/
|
||||
interface PostData {
|
||||
is_last: boolean;
|
||||
is_origin: boolean;
|
||||
last_id: string;
|
||||
posts: TGApp.Plugins.Mys.Post.FullData[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 游戏信息
|
||||
* @since Beta v0.6.3
|
||||
* @interface GameInfo
|
||||
* @property {number} id 游戏 ID
|
||||
* @property {string} name 游戏名称
|
||||
* @property {boolean} has_good 是否有精华帖
|
||||
* @property {boolean} has_hot 是否有热帖
|
||||
* @return GameInfo
|
||||
*/
|
||||
interface GameInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
has_good: boolean;
|
||||
has_hot: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 话题信息
|
||||
* @since Beta v0.6.3
|
||||
* @interface Info
|
||||
* @property {string[]} alias 话题别名
|
||||
* @property {number} content_type 内容类型
|
||||
* @property {string} cover 封面图片 URL
|
||||
* @property {number} created_at 创建时间(秒级时间戳)
|
||||
* @property {string} creator 创建者
|
||||
* @property {number} creator_type 创建者类型
|
||||
* @property {number} default_game_id 默认游戏 ID
|
||||
* @property {string} desc 话题描述
|
||||
* @property {number} game_id 游戏 ID
|
||||
* @property {number} good_cnt 精华帖数量
|
||||
* @property {string} id 话题 ID
|
||||
* @property {number} is_deleted 是否已删除,0-未删除,1-已删除
|
||||
* @property {boolean} is_focus 是否关注
|
||||
* @property {boolean} is_interactive 是否互动
|
||||
* @property {string} name 话题名称
|
||||
* @property {number} order 排序
|
||||
* @property {unknown} related_forum_ids 相关版块 ID
|
||||
* @property {unknown} stat 话题统计-可能为null
|
||||
* @property {SortConfig[]} topic_sort_config 话题排序配置
|
||||
* @property {number} topic_type 话题类型
|
||||
* @property {string} updated_at 更新时间(秒级时间戳)
|
||||
* @property {number[]} view_type 查看类型
|
||||
* @return Info
|
||||
*/
|
||||
interface Info {
|
||||
alias: string[];
|
||||
content_type: number;
|
||||
cover: string;
|
||||
created_at: number;
|
||||
creator: string;
|
||||
creator_type: number;
|
||||
default_game_id: number;
|
||||
desc: string;
|
||||
game_id: number;
|
||||
good_cnt: number;
|
||||
id: string;
|
||||
is_deleted: number;
|
||||
is_focus: boolean;
|
||||
is_interactive: boolean;
|
||||
name: string;
|
||||
order: number;
|
||||
related_forum_ids: unknown;
|
||||
stat: unknown;
|
||||
topic_sort_config: SortConfig[];
|
||||
topic_type: number;
|
||||
updated_at: string;
|
||||
view_type: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 话题排序配置
|
||||
* @since Beta v0.6.3
|
||||
* @interface SortConfig
|
||||
* @property {string} name 排序名称
|
||||
* @property {number} type 排序类型
|
||||
* @property {string} url 排序 URL
|
||||
* @property {number} show_sort 展示顺序
|
||||
* @property {string} data_report_name 数据报告名称
|
||||
* @return SortConfig
|
||||
*/
|
||||
interface SortConfig {
|
||||
name: string;
|
||||
type: number;
|
||||
url: string;
|
||||
show_sort: number;
|
||||
data_report_name: string;
|
||||
}
|
||||
}
|
||||
39
src/plugins/Mys/types/User.d.ts
vendored
39
src/plugins/Mys/types/User.d.ts
vendored
@@ -4,12 +4,6 @@
|
||||
* @since Beta v0.5.5
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Mys 插件用户类型
|
||||
* @since Beta v0.5.5
|
||||
* @namespace TGApp.Plugins.Mys.User
|
||||
* @memberof TGApp.Plugins.Mys
|
||||
*/
|
||||
declare namespace TGApp.Plugins.Mys.User {
|
||||
/**
|
||||
* @description 主页用户信息返回
|
||||
@@ -311,35 +305,6 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
avatar_url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description collection中的用户信息
|
||||
* @since Beta v0.3.9
|
||||
* @interface Collection
|
||||
* @property {string} avatar 用户头像
|
||||
* @property {string} avatar_url 用户头像链接
|
||||
* @property {Certification} certification 用户认证信息
|
||||
* @property {number} gender 用户性别
|
||||
* @property {string} introduce 用户简介
|
||||
* @property {boolean} is_followed 是否被关注
|
||||
* @property {boolean} is_following 是否关注
|
||||
* @property {string} nickname 用户昵称
|
||||
* @property {string} pendant 用户挂件 URL,可能为 ""
|
||||
* @property {number} uid 用户 ID
|
||||
* @return Collection
|
||||
*/
|
||||
interface Collection {
|
||||
avatar: string;
|
||||
avatar_url: string;
|
||||
certification: Certification;
|
||||
gender: number;
|
||||
introduce: string;
|
||||
is_followed: boolean;
|
||||
is_following: boolean;
|
||||
nickname: string;
|
||||
pendant: string;
|
||||
uid: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 帖子回复中的用户信息
|
||||
* @since Beta v0.5.5
|
||||
@@ -358,7 +323,7 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
* @property {boolean} is_followed 是否被关注
|
||||
* @property {AvatarExt} avatar_ext 用户头像扩展信息
|
||||
* @property {boolean} is_super_fan 是否是铁粉
|
||||
* @property {TGApp.Plugins.Mys.Reply.ReplyBubble} reply_bubble 回复气泡,可能为 null
|
||||
* @property {TGApp.BBS.Reply.Bubble} reply_bubble 回复气泡,可能为 null
|
||||
* @return Reply
|
||||
*/
|
||||
interface Reply {
|
||||
@@ -376,6 +341,6 @@ declare namespace TGApp.Plugins.Mys.User {
|
||||
is_followed: boolean;
|
||||
avatar_ext: AvatarExt;
|
||||
is_super_fan: boolean;
|
||||
reply_bubble: TGApp.Plugins.Mys.Reply.ReplyBubble | null;
|
||||
reply_bubble: TGApp.BBS.Reply.Bubble | null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
*/
|
||||
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
import { getPostFull } from "@Mys/request/postReq.js";
|
||||
|
||||
import { AppCharacterData } from "@/data/index.js";
|
||||
import postReq from "@/web/request/postReq.js";
|
||||
|
||||
/**
|
||||
* @description 根据单个卡池信息转为渲染用的卡池信息
|
||||
@@ -26,7 +26,7 @@ async function getGachaItemCard(
|
||||
if (poolCover !== undefined) {
|
||||
cover = poolCover;
|
||||
} else {
|
||||
const postResp = await getPostFull(postId);
|
||||
const postResp = await postReq.post(postId);
|
||||
if ("retcode" in postResp) {
|
||||
showSnackbar.error(`[${postResp.retcode}] ${postResp.message}`);
|
||||
return null;
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* @file plugins Mys utils getLotteryCard.ts
|
||||
* @description 抽奖工具类
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description 根据抽奖奖励信息转为渲染用的抽奖奖励信息
|
||||
* @since Alpha v0.2.1
|
||||
* @param {TGApp.Plugins.Mys.Lottery.Reward} lotteryReward 抽奖奖励信息
|
||||
* @returns {TGApp.Plugins.Mys.Lottery.RenderReward}
|
||||
*/
|
||||
function getLotteryRewardCard(
|
||||
lotteryReward: TGApp.Plugins.Mys.Lottery.Reward,
|
||||
): TGApp.Plugins.Mys.Lottery.RenderReward {
|
||||
return {
|
||||
name: lotteryReward.reward_name,
|
||||
win: lotteryReward.winner_number,
|
||||
goal: lotteryReward.scheduled_winner_number,
|
||||
users: lotteryReward.users,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据抽奖信息转为渲染用的抽奖信息
|
||||
* @since Alpha v0.2.1
|
||||
* @param {TGApp.Plugins.Mys.Lottery.FullData} lotteryData 抽奖信息
|
||||
* @returns {TGApp.Plugins.Mys.Lottery.RenderCard}
|
||||
*/
|
||||
function getLotteryCard(
|
||||
lotteryData: TGApp.Plugins.Mys.Lottery.FullData,
|
||||
): TGApp.Plugins.Mys.Lottery.RenderCard {
|
||||
return {
|
||||
id: lotteryData.id,
|
||||
upWay: lotteryData.participant_way,
|
||||
status: lotteryData.status,
|
||||
creator: lotteryData.creator,
|
||||
drawTime: lotteryData.draw_time,
|
||||
rewards: lotteryData.user_rewards.map(getLotteryRewardCard),
|
||||
};
|
||||
}
|
||||
|
||||
export default getLotteryCard;
|
||||
Reference in New Issue
Block a user