refactor(Mys): request 跟 utils 拿出来了

This commit is contained in:
BTMuli
2023-03-29 17:11:14 +08:00
parent 988f595435
commit 54cccb37a5
11 changed files with 388 additions and 264 deletions

View File

@@ -7,19 +7,6 @@
import { MysResponse } from "./base";
// 卡池 API
/**
* @description 获取卡池信息的返回类型
* @since Alpha
* @see GachaResponse
* @return {string}
*/
export const GACHA_POOL_API =
"https://api-takumi.mihoyo.com/common/blackboard/ys_obc/v1/gacha_pool?app_sn=ys_obc";
// 卡池接口
/**
* @description 获取卡池信息的返回类型
* @since Alpha
@@ -80,23 +67,23 @@ export interface GachaPool {
/**
* @description 用于渲染的卡池数据
* @since Alpha
* @interface GachaPoolRender
* @interface GachaCard
* @property {string} title 卡池标题
* @property {string} subtitle 卡池副标题
* @property {string} cover 卡池封面
* @property {string} post_id 卡池对应帖子ID
* @property {number} post_id 卡池对应帖子ID
* @property {GachaPool[]} characters 卡池包含的角色
* @property {GachaPool} voice 卡池角色语音
* @property time 卡池时间
* @property {string} time.start 卡池开始时间
* @property {string} time.end 卡池结束时间
* @return {GachaPoolRender}
* @return {GachaCard}
*/
export interface GachaPoolRender {
export interface GachaCard {
title: string;
subtitle: string;
cover: string;
post_id: string;
post_id: number;
characters: GachaPool[];
voice: GachaPool;
time: {

View File

@@ -10,52 +10,6 @@ import { Post, Forum, Topic, PostStat } from "./post";
import { User, SelfOperation } from "./user";
import { ImageData, HelpSys } from "./utils";
// 咨讯 API
/**
* @description 咨讯列表 API
* @since Alpha
* @param {number} ews_type 咨讯类型
* @see NewsType
* @return {string}
*/
export const NEWS_LIST_API =
"https://bbs-api.mihoyo.com/post/wapi/getNewsList?gids=2&type={news_type}";
// 咨讯相关枚举数据
/**
* @description 咨讯类型
* @enum NewsType
* @since Alpha
* @property {number} NOTICE 公告
* @property {number} ACTIVITY 活动
* @property {number} NEWS 咨讯
* @return {NewsType}
*/
export enum NewsType {
NOTICE = 1,
ACTIVITY = 2,
NEWS = 3,
}
/**
* @description 活动状态
* @enum ActivityStatus
* @since Alpha
* @property {number} STARTED 进行中
* @property {number} FINISHED 已结束
* @property {number} SELECTION 评选中
* @return {ActivityStatus}
*/
export enum ActivityStatus {
STARTED = 1,
FINISHED = 2,
SELECTION = 3,
}
// 咨讯接口
/**
* @description 咨讯返回数据
* @since Alpha
@@ -155,15 +109,17 @@ export interface NewsMeta {
* @interface NewsCard
* @property {string} title 标题
* @property {string} cover 封面图片 URL
* @property {string} post_id 帖子 ID
* @property {number} post_id 帖子 ID
* @property {string} subtitle 副标题
* @property {number} status 活动状态,仅活动咨讯有
* @property {string} status 活动状态,仅活动咨讯有
* @property {string} status_color 活动状态按钮背景色,仅活动咨讯有
* @return {NewsCard}
*/
export interface NewsCard {
title: string;
cover: string;
post_id: string;
post_id: number;
subtitle: string;
status?: number;
status?: string;
status_color?: string;
}

View File

@@ -10,28 +10,6 @@ import { NewsMeta } from "./news";
import { User, SelfOperation } from "./user";
import { ImageData, HelpSys } from "./utils";
// Post API
/**
* @description 帖子完整信息 API
* @since Alpha
* @see PostResponse
* @param {number} post_id 帖子 ID
* @return {string}
*/
export const POST_FULL_API =
"https://bbs-api.mihoyo.com/post/wapi/getPostFull?gids=2&post_id={post_id}";
/**
* @description 帖子完整信息 Referer
* @since Alpha
* @param {number} post_id 帖子 ID
* @return {string}
*/
export const POST_FULL_REFERER = "https://bbs.mihoyo.com/ys/article/{post_id}"; // 与 POST_FULL_API 中的 post_id 对应, 用于伪造 Referer
// Post Interface
/**
* @description 帖子返回数据
* @since Alpha