mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
♻️ refactor(types): 给笨蛋牡蛎一点小小的类型震撼
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
66
src/types/Achievement.d.ts
vendored
Normal file
66
src/types/Achievement.d.ts
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @ file
|
||||
* @ author BTMuli<bt-muli@outlook.com>
|
||||
* @ description IndexedDB 里面存储的成就相关类型
|
||||
* @ since Alpha v0.1.2
|
||||
*/
|
||||
|
||||
declare namespace BTMuli.Genshin {
|
||||
/**
|
||||
* @description 本应用的成就类型
|
||||
* @since Alpha v0.1.2
|
||||
* @interface Achievement
|
||||
* @property {number} id - 成就 ID
|
||||
* @property {number} series - 成就系列 ID
|
||||
* @property {number} order - 成就排列顺序,用于展示全部成就
|
||||
* @property {string} name - 成就名称
|
||||
* @property {string} description - 成就描述
|
||||
* @property {number} reward - 成就奖励
|
||||
* @property {boolean} completed - 成就是否完成
|
||||
* @property {string} completed_time - 成就完成时间
|
||||
* @property {number} progress - 成就进度
|
||||
* @property {string} version - 成就版本
|
||||
* @return Achievement
|
||||
*/
|
||||
export interface Achievement {
|
||||
id: number
|
||||
series: number
|
||||
order: number
|
||||
name: string
|
||||
description: string
|
||||
reward: number
|
||||
completed: boolean
|
||||
completed_time: string | null
|
||||
progress: number
|
||||
version: string
|
||||
}
|
||||
|
||||
export namespace Achievement {
|
||||
/**
|
||||
* @description 本应用的成就系列类型
|
||||
* @since Alpha v0.1.2
|
||||
* @interface AchievementSeries
|
||||
* @property {number} id - 成就系列 ID
|
||||
* @property {number} order - 成就系列排列顺序,用于展示全部成就系列
|
||||
* @property {string} name - 成就系列名称
|
||||
* @property {string} version - 成就系列版本
|
||||
* @property {number[]} achievements - 成就系列包含的成就
|
||||
* @property {number} total_count - 成就系列包含的成就数
|
||||
* @property {number} completed_count - 成就系列已完成的成就数
|
||||
* @property {string} card - 成就系列对应名片
|
||||
* @property {string} icon - 成就系列图标
|
||||
* @return AchievementSeries
|
||||
*/
|
||||
export interface Series {
|
||||
id: number
|
||||
order: number
|
||||
name: string
|
||||
version: string
|
||||
achievements: number[]
|
||||
total_count: number
|
||||
completed_count: number
|
||||
card?: string
|
||||
icon: string
|
||||
}
|
||||
}
|
||||
}
|
||||
219
src/types/Announcement.d.ts
vendored
Normal file
219
src/types/Announcement.d.ts
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
/**
|
||||
* @file core types TGAnnouncement.d.ts
|
||||
* @description 类型定义,用于定义原神游戏内公告相关类型
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.1.2
|
||||
*/
|
||||
declare namespace BTMuli.Genshin {
|
||||
/**
|
||||
* @description 公告
|
||||
* @since Alpha v0.1.2
|
||||
* @interface Announcement
|
||||
* @property {AnnoListItem[]} list 公告列表
|
||||
* @property {number} type_id 类型 ID
|
||||
* @property {string} type_label 类型标签
|
||||
* @returns {Announcement}
|
||||
*/
|
||||
export interface Announcement {
|
||||
list: ListItem[]
|
||||
type_id: number
|
||||
type_label: string
|
||||
}
|
||||
/**
|
||||
* @file core types TGAnnouncement.d.ts
|
||||
* @description 类型定义,用于定义原神游戏内公告相关类型
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.1.2
|
||||
*/
|
||||
|
||||
export namespace Announcement {
|
||||
/**
|
||||
* @description 原神游戏内公告列表返回
|
||||
* @since Alpha v0.1.2
|
||||
* @see TGApi.GameAnnoList
|
||||
* @interface AnnoListResponse
|
||||
* @extends TGBase.BaseResponse
|
||||
* @property {AnnoListData} data 公告数据
|
||||
* @returns {ListResponse}
|
||||
*/
|
||||
export interface ListResponse extends Base.Response {
|
||||
data: ListData
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 原神游戏内公告内容返回
|
||||
* @since Alpha v0.1.2
|
||||
* @see TGApi.GameAnnoContent
|
||||
* @interface AnnoContentResponse
|
||||
* @extends Hk4eResponse
|
||||
* @property {AnnoContentData} data 公告数据
|
||||
* @returns {ContentResponse}
|
||||
*/
|
||||
export interface ContentResponse extends Hk4eResponse {
|
||||
data: ContentData
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 公告列表数据
|
||||
* @since Alpha v0.1.2
|
||||
* @interface AnnoListData
|
||||
* @property {Announcement[]} list 公告列表
|
||||
* @property {number} total 公告总数
|
||||
* @property {AnnoTypeList[]} type_list 公告类型列表
|
||||
* @property {boolean} alert 是否有紧急公告
|
||||
* @property {number} alert_id 紧急公告 ID
|
||||
* @property {number} time_zone 时区
|
||||
* @property {string} t 系统时间
|
||||
* @property {unknown[]} pic_list 图片列表
|
||||
* @property {number} pic_total 图片总数
|
||||
* @property {unknown[]} pic_type_list 图片类型列表
|
||||
* @property {boolean} pic_alert 是否有紧急图片
|
||||
* @property {number} pic_alert_id 紧急图片 ID
|
||||
* @property {unknown} static_sign 静态签名
|
||||
* @returns {ListData}
|
||||
*/
|
||||
export interface ListData {
|
||||
list: Announcement[]
|
||||
total: number
|
||||
type_list: TypeList[]
|
||||
alert: boolean
|
||||
alert_id: number
|
||||
time_zone: number
|
||||
t: string
|
||||
pic_list: unknown[]
|
||||
pic_total: number
|
||||
pic_type_list: unknown[]
|
||||
pic_alert: boolean
|
||||
pic_alert_id: number
|
||||
static_sign: unknown
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 公告内容数据
|
||||
* @since Alpha v0.1.2
|
||||
* @interface AnnoContentData
|
||||
* @property {AnnoContentItem[]} list 公告列表
|
||||
* @property {number} total 公告总数
|
||||
* @property {unknown[]} pic_list 图片列表
|
||||
* @property {number} pic_total 图片总数
|
||||
* @returns {ContentData}
|
||||
*/
|
||||
export interface ContentData {
|
||||
list: ContentItem[]
|
||||
total: number
|
||||
pic_list: unknown[]
|
||||
pic_total: number
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 公告类型列表
|
||||
* @since Alpha v0.1.2
|
||||
* @interface AnnoTypeList
|
||||
* @property {number} id 类型 ID
|
||||
* @property {string} name 类型名称
|
||||
* @property {string} mi18n_name 类型名称
|
||||
* @returns {TypeList}
|
||||
*/
|
||||
export interface TypeList {
|
||||
id: number
|
||||
name: string
|
||||
mi18n_name: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 公告列表项
|
||||
* @since Alpha v0.1.2
|
||||
* @interface AnnoListItem
|
||||
* @property {number} ann_id 公告 ID
|
||||
* @property {string} title 公告标题
|
||||
* @property {string} subtitle 公告副标题
|
||||
* @property {string} banner 公告图片
|
||||
* @property {unknown} content 公告内容
|
||||
* @property {string} type_label 公告类型标签
|
||||
* @property {string} tag_label 公告标签
|
||||
* @property {string} tag_icon 公告标签图标
|
||||
* @property {number} login_alert 是否登录提示
|
||||
* @property {string} lang 公告语言
|
||||
* @property {string} start_time 公告开始时间 // "2023-03-01 07:00:00"
|
||||
* @property {string} end_time 公告结束时间 // "2023-04-12 06:00:00"
|
||||
* @property {number} type 公告类型
|
||||
* @property {number} remind 公告提醒
|
||||
* @property {number} alert 公告紧急
|
||||
* @property {string} tag_start_time 公告标签开始时间 // "2000-01-02 15:04:05"
|
||||
* @property {string} tag_end_time 公告标签结束时间 // "2030-01-02 15:04:05"
|
||||
* @property {number} remind_ver 公告提醒版本
|
||||
* @property {boolean} has_content 是否有内容
|
||||
* @property {boolean} extra_remind 是否有额外提醒
|
||||
* @returns {ListItem}
|
||||
*/
|
||||
export interface ListItem {
|
||||
ann_id: number
|
||||
title: string
|
||||
subtitle: string
|
||||
banner: string
|
||||
content: unknown
|
||||
type_label: string
|
||||
tag_label: string
|
||||
tag_icon: string
|
||||
login_alert: number
|
||||
lang: string
|
||||
start_time: string
|
||||
end_time: string
|
||||
type: number
|
||||
remind: number
|
||||
alert: number
|
||||
tag_start_time: string
|
||||
tag_end_time: string
|
||||
remind_ver: number
|
||||
has_content: boolean
|
||||
extra_remind: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 公告内容列表
|
||||
* @since Alpha v0.1.2
|
||||
* @interface AnnoContentItem
|
||||
* @property {number} ann_id 公告 ID
|
||||
* @property {string} title 公告标题
|
||||
* @property {string} subtitle 公告副标题
|
||||
* @property {string} banner 公告图片
|
||||
* @property {string} content 公告内容为 HTML
|
||||
* @property {string} lang 公告语言
|
||||
* @returns {ContentItem}
|
||||
*/
|
||||
export interface ContentItem {
|
||||
ann_id: number
|
||||
title: string
|
||||
subtitle: string
|
||||
banner: string
|
||||
content: string
|
||||
lang: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 渲染用公告列表数据
|
||||
* @since Alpha v0.1.2
|
||||
* @interface AnnoListCard
|
||||
* @property {number} id 公告 ID
|
||||
* @property {string} title 公告标题
|
||||
* @property {string} subtitle 公告副标题
|
||||
* @property {string} banner 公告图片
|
||||
* @property {string} typeLabel 公告类型标签
|
||||
* @property {string} tagIcon 公告标签图标
|
||||
* @property {string} startTime 公告开始时间
|
||||
* @property {string} endTime 公告结束时间
|
||||
* @returns {ListCard}
|
||||
*/
|
||||
export interface ListCard {
|
||||
id: number
|
||||
title: string
|
||||
subtitle: string
|
||||
banner: string
|
||||
typeLabel: string
|
||||
tagIcon: string
|
||||
startTime: string
|
||||
endTime: string
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
40
src/types/Base.d.ts
vendored
Normal file
40
src/types/Base.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @file core types TGBase.d.ts
|
||||
* @description 类型定义,用于定义一些基础类型
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.1.2
|
||||
*/
|
||||
|
||||
declare namespace BTMuli.Genshin {
|
||||
export namespace Base {
|
||||
/**
|
||||
* @description 定义 IndexedDB 数据库配置
|
||||
* @since Alpha v0.1.2
|
||||
* @interface DBConfig
|
||||
* @property {string} storeName 数据库名称
|
||||
* @property {string} keyPath 数据库主键
|
||||
* @property {string[]} indexes 数据库索引
|
||||
* @returns {DBConfig}
|
||||
*/
|
||||
export interface DBConfig {
|
||||
storeName: string
|
||||
keyPath: string
|
||||
indexes: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 定义基础返回数据
|
||||
* @since Alpha v0.1.2
|
||||
* @interface BaseResponse
|
||||
* @property {number} retcode 状态码
|
||||
* @property {string} message 状态信息
|
||||
* @property {any} data 数据
|
||||
* @returns {Response}
|
||||
*/
|
||||
export interface Response {
|
||||
retcode: number
|
||||
message: string
|
||||
data: any
|
||||
}
|
||||
}
|
||||
}
|
||||
56
src/types/Calendar.d.ts
vendored
Normal file
56
src/types/Calendar.d.ts
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @file core types TGCalendar.d.ts
|
||||
* @description 本应用的素材日历类型定义
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.1.2
|
||||
*/
|
||||
|
||||
declare namespace BTMuli.Genshin {
|
||||
export namespace Calendar {
|
||||
/**
|
||||
* @description 素材日历接口
|
||||
* @interface CalendarData
|
||||
* @since Alpha v0.1.2
|
||||
* @property {Record<number, CalendarItem>} characters - 该天的角色相关数据
|
||||
* @property {Record<number, CalendarItem>} weapons - 该天的武器相关数据
|
||||
* @returns {Data}
|
||||
*/
|
||||
export interface Data {
|
||||
characters: Record<number, Item>
|
||||
weapons: Record<number, Item>
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 单日单秘境的素材日历接口
|
||||
* @interface CalendarItem
|
||||
* @since Alpha v0.1.2
|
||||
* @property {string} title - 地区 秘境名称
|
||||
* @property {CalendarMaterial[]} materials - 素材 url
|
||||
* @property {CalendarMaterial[]} contents - 角色/武器 url
|
||||
* @returns {Item}
|
||||
*/
|
||||
export interface Item {
|
||||
title: string
|
||||
materials: Material[]
|
||||
contents: Material[]
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 材料类型
|
||||
* @interface MiniMaterial
|
||||
* @since Alpha v0.1.2
|
||||
* @property {number} id - 角色/武器的 id
|
||||
* @property {number} star - 角色/武器的星级
|
||||
* @property {number} content_id - 观测枢的 content_id
|
||||
* @property {string} name - 名称
|
||||
* @property {string} icon - 图标 url
|
||||
*/
|
||||
export interface Material {
|
||||
id?: number
|
||||
star: number
|
||||
content_id: number
|
||||
name: string
|
||||
icon: string
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/types/NameCard.d.ts
vendored
Normal file
33
src/types/NameCard.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @file core types TGNameCard.d.ts
|
||||
* @description 本应用的名片类型定义
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.1.2
|
||||
*/
|
||||
|
||||
declare namespace BTMuli.Genshin {
|
||||
/**
|
||||
* @description 本应用的名片类型
|
||||
* @since Alpha v0.1.2
|
||||
* @interface NameCard
|
||||
* @property {string} name - 名片名称,同时也是文件名
|
||||
* @property {string} description - 名片描述
|
||||
* @property {string} icon - 名片图标路径
|
||||
* @property {string} bg - 名片背景图路径
|
||||
* @property {string} profile - 名片 Profile 图路径
|
||||
* @property {number} type - 名片类型 (0: 其他,1: 成就,2:角色,3:纪行,4:活动)
|
||||
* @property {string} source - 名片来源
|
||||
* @returns {NameCard}
|
||||
*/
|
||||
export interface NameCard {
|
||||
name: string
|
||||
description: string
|
||||
icon: string
|
||||
bg: string
|
||||
profile: string
|
||||
type: number
|
||||
source: string
|
||||
}
|
||||
export namespace NameCard {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user