Commit 46000125 authored by 郑磊's avatar 郑磊

init

parents
/**
* 接口响应数据结构
*/
declare interface ApiResp<T = void> {
/**
* 接口调用是否成功
*/
ok: boolean
/**
* 接口响应码
*/
code: number
/**
* 接口响应消息
*/
msg: string
/**
* 接口返回数据
*/
data: T
}
interface Game {
id: number
app_id: string
app_entry: string | null
name: string
img_path: string
}
/**
* 皇冠数据结构
*/
declare namespace Crown {
declare type Language = 'zh-cn' | 'en-us' | 'zh-tw'
/**
* 皇冠比赛数据
*/
declare interface MatchInfo {
/**
* 比赛时间
*/
match_time: number
/**
* 皇冠比赛id
*/
ecid: string
/**
* 赛事名称
*/
league: string
/**
* 皇冠赛事id
*/
lid: string
/**
* 主队名称
*/
team_h: string
/**
* 客队名称
*/
team_c: string
/**
* 主队id
*/
team_id_h: string
/**
* 客队id
*/
team_id_c: string
}
/**
* 皇冠返回的单个盘口数据
*/
interface Game extends MatchInfo {
/**
* 盘口id
*/
gid: string
datetime: string
/**
* 盘口类型 0-赛果 146-角球
*/
ptype_id: string
/**
* 让球方
*/
strong: 'H' | 'C'
/**
* 全场让球是否开启
*/
sw_R: 'Y' | 'N'
/**
* 全场让球数
*/
ratio: string
/**
* 主队让球赔率
*/
ior_RH: string
/**
* 客队让球赔率
*/
ior_RC: string
/**
* 上半场让球方
*/
hstrong: 'H' | 'C'
/**
* 上半场让球是否开启
*/
sw_HR: 'Y' | 'N'
/**
* 上半场让球数
*/
hratio: string
/**
* 上半场主队让球赔率
*/
ior_HRH: string
/**
* 上半场客队让球赔率
*/
ior_HRC: string
/**
* 全场大小球是否开启
*/
sw_OU: 'Y' | 'N'
/**
* 全场大小球临界点
*/
ratio_o: string
/**
* 全场小球赔率
*/
ior_OUH: string
/**
* 全场大球赔率
*/
ior_OUC: string
/**
* 上半场大小球是否开启
*/
sw_HOU: 'Y' | 'N'
/**
* 上半场大小球临界点
*/
ratio_ho: string
/**
* 上半场小球赔率
*/
ior_HOUH: string
/**
* 上半场大球赔率
*/
ior_HOUC: string
/**
* 滚球全场让球是否开启
*/
sw_RE: 'Y' | 'N'
/**
* 滚球全场让球盘口
*/
ratio_re: string
/**
* 滚球全场让球主队水位
*/
ior_REH: string
/**
* 滚球全场让球客队水位
*/
ior_REC: string
/**
* 滚球全场大小球是否开启
*/
sw_ROU: 'Y' | 'N'
/**
* 滚球全场大小球临界点
*/
ratio_rouo: string
/**
* 滚球全场小球水位
*/
ior_ROUH: string
/**
* 滚球全场大球水位
*/
ior_ROUC: string
/**
* 滚球半场让球是否开启
*/
sw_HRE: 'Y' | 'N'
/**
* 滚球半场让球盘口
*/
ratio_hre: string
/**
* 滚球半场让球主队水位
*/
ior_HREH: string
/**
* 滚球半场让球客队水位
*/
ior_HREC: string
/**
* 滚球半场大小球是否开启
*/
sw_HROU: 'Y' | 'N'
/**
* 滚球半场大小球临界点
*/
ratio_hrouo: string
/**
* 滚球半场大小球小球水位
*/
ior_HROUH: string
/**
* 滚球半场大小球大球水位
*/
ior_HROUC: string
/**
* 全场独赢是否开启
*/
sw_M: 'Y' | 'N'
/**
* 独赢主胜水位
*/
ior_MH: string
/**
* 独赢客胜水位
*/
ior_MC: string
/**
* 独赢平局水位
*/
ior_MN: string
/**
* 上半场独赢是否开启
*/
sw_HM: 'Y' | 'N'
/**
* 上半场独赢主胜水位
*/
ior_HMH: string
/**
* 上半场独赢客胜水位
*/
ior_HMC: string
/**
* 上半场独赢平局水位
*/
ior_HMN: string
}
/**
* 皇冠接口返回的数据
*/
interface Resp {
/**
* 盘口数据
*/
game: Game[]
}
interface OddInfo {
game_id: string
variety: Variety
type: 'r' | 'hr' | 'ou' | 'hou' | 'm' | 'hm'
condition: string
value_h?: string
value_c?: string
value_n?: string
}
/**
* 从皇冠页面上爬取到盘口数据
*/
interface OddData {
match: MatchInfo
odds: OddInfo[]
}
interface ScoreInfo {
league_id: string
match_time: number
team1: string
team2: string
score1: number
score2: number
score1_period1: number
score2_period1: number
}
/**
* 预下单信息
*/
interface OrderInfo {
code: string
gold_gmin: string
gold_gmax: string
ioratio: string
aid: string
fast_check: string
num_c: string
num_h: string
con: string
wtype: string
rtype: string
chose_team: string
ratio: string
}
/**
* 投注结果
*/
interface BetResult {
code: string
nowcredit: string
ticket_id: string
}
}
/**
* 概览数据
*/
declare interface SummaryData {
/**
* 总推荐数
*/
total: number
/**
* 胜场数
*/
win: number
/**
* 负场数
*/
loss: number
/**
* 平局数
*/
draw: number
/**
* 胜率
*/
win_rate: number
/**
* 收益
*/
profit: string | number
}
/**
* 准备中的数据
*/
declare interface PreparingData {
/**
* 联赛id
*/
id: number
/**
* 比赛时间
*/
match_time: string
/**
* 联赛信息
*/
tournament: {
/**
* 联赛名称
*/
name: string
}
/**
* 比赛列表
*/
matches: {
/**
* 比赛id
*/
id: number
/**
* 主队名称
*/
team1: string
/**
* 客队名称
*/
team2: string
}[]
}
/**
* 比赛时段
*/
declare type Period = 'regularTime' | 'period1'
/**
* 盘口类型
*/
declare type OddType = 'ah1' | 'ah2' | 'over' | 'under' | 'draw'
/**
* 盘口目标
*/
declare type Variety = 'goal' | 'corner'
/**
* 推荐数据
*/
declare interface PromotedData {
/**
* 推荐id
*/
id: number
/**
* 时段
*/
period: Period
/**
* 盘口类型
*/
type: OddType
/**
* 盘口目标
*/
variety: Variety
/**
* 盘口条件
*/
condition: string
/**
* 比赛id
*/
match_id: number
/**
* 比赛时间
*/
match_time: string
/**
* 推荐结果
*/
result: {
result: number
score: string
score1: number
score2: number
} | null
/**
* 主队信息
*/
team1: { id: number; name: string }
/**
* 客队信息
*/
team2: { id: number; name: string }
/**
* 联赛信息
*/
tournament: { id: number; name: string }
/**
* 推荐水位
*/
value: string | null | undefined
/**
* 是否已标记
*/
marked: boolean
/**
* 皇冠比赛id
*/
crown_match_id: string
/**
* 推荐频道
*/
channel: string
crown_game_id?: string
}
/**
* 用户信息
*/
declare interface User {
/**
* 用户id
*/
id: number
/**
* 昵称
*/
nickname: string
/**
* 头像
*/
avatar: string
/**
* 状态 1-正常 0-已禁用
*/
status: number
/**
* VIP到期时间
*/
expire_time: string
/**
* 邀请码
*/
code: string
/**
* VIP是否已到期
*/
is_expired: number
/**
* 登录信息
*/
connect: UserConnect[]
/**
* 用户的客户端配置
*/
client_config?: UserClientConfig
/**
* 注销完成时间
*/
cancellation_at: string | null
}
/**
* 用户登录信息
*/
declare interface UserConnect {
/**
* 平台类型
*/
platform: string
/**
* 平台id
*/
platform_id: string
/**
* 账号
*/
account: string
}
/**
* 用户的客户端配置
*/
declare interface UserClientConfig {
/**
* 滚球筛选器
*/
rockball_filter?: UserFilter[]
[name: string]: any
}
/**
* 用户设置的筛选器
*/
declare interface UserFilter {
key: string
period: Period
variety: Variety
type: OddType
condition: string
}
/**
* 通过接口返回的原始频道信息
*/
declare interface RawChannelData {
/**
* 推荐列表
*/
list: PromotedData[]
/**
* 频道统计
*/
summary: SummaryData
/**
* 准备中的赛事信息
*/
preparing: PreparingData[]
}
/**
* 按日归类的推荐信息
*/
declare interface DatePromotedData {
/**
* 是否有新增的推荐
*/
hasNewPromoted: boolean
/**
* 推荐列表
*/
list: PromotedData[]
}
/**
* 频道
*/
declare interface Channel {
/**
* 频道标识
*/
key: string
/**
* 频道名称
*/
name: string
/**
* 此频道是否有报告
*/
report?: boolean
/**
* 过滤器键名
*/
filter?: string
/**
* 此频道是否使用收益代替胜率
*/
use_profit?: boolean
}
/**
* 频道数据
*/
declare interface ChannelData {
/**
* 测算中的赛事
*/
preparing: PreparingData[]
/**
* 统计信息
*/
summary: SummaryData
/**
* 按日归类的推荐信息
*/
dateData: Record<number, DatePromotedData> | undefined
/**
* 是否有新增的推荐
*/
hasNewPromoted: boolean
/**
* 最大数据日期
*/
maxDate: number
/**
* 经过过滤且按频道归类后的数据
*/
filteredData: Record<number, DatePromotedData>
/**
* 设置通过接口而来的数据
* @param raw 通过接口获取到的数据
* @returns 新增的推荐数据
*/
setData(raw: RawChannelData): PromotedData[]
/**
* 设置通过WS推送而来的数据
* @param promoted 新增的推荐数据
* @returns 此数据是否新增成功
*/
addData(promoted: PromotedData): boolean
}
/**
* 推荐频道的名字
*/
declare type ChannelId = 'rockball' | 'manual' | 'compare'
/// <reference path="./common.d.ts" />
/// <reference path="./crown.d.ts" />
/// <reference path="./data.d.ts" />
/// <reference path="./vip.d.ts" />
/// <reference path="./report.d.ts" />
/// <reference path="./socket.d.ts" />
{
"name": "@types/ball-predict-ai",
"description": "类型定义库",
"private": true,
"version": "1.0.0",
"typings": "index.d.ts"
}
/// <reference path="./data.d.ts" />
/**
* 收益报告
*/
declare interface DataReport {
start: string
end: string
data: DataReportRow[]
}
/**
* 收益报告行
*/
declare interface DataReportRow {
variety: Variety
period: Period
type: OddType
condition: string
win: number
win_half: number
win_all: number
win_rate: number
loss: number
draw: number
profit: string
}
/// <reference path="./data.d.ts" />
declare namespace Socket {
/**
* WS下发的消息结构
*/
interface IncomingMessageBase<T extends string, D = void> {
type: T
data: D
}
/**
* 新的推荐已下发
*/
interface PromoteMessage extends IncomingMessageBase<'promote', PromotedData> {
sub_type: ChannelId
}
/**
* 测试触发音效的消息
*/
interface SoundMessage extends IncomingMessageBase<'sound'> {}
type IncomingMessage = PromoteMessage | SoundMessage
}
/**
* VIP类型
*/
declare type VipType = 'day' | 'week' | 'month'
/**
* 支付链路
*/
declare type ChainType = 'tron' | 'ethereum' | 'bsc'
/**
* VIP配置
*/
declare type VipConfig = Record<VipType, VipBuyConfig>
/**
* VIP购买配置
*/
declare type VipBuyConfig = Record<string, VipChainBuyConfig>
/**
* 链配置
*/
declare interface VipChainBuyConfig {
price: number
currency: string
}
/**
* VIP的固定信息
*/
declare interface VipInfo {
name: string
days: number
}
declare interface ChainInfo {
name: string
token: string
}
/**
* VIP购买记录
*/
declare interface VipRecord {
id: number
amount: string
currency: string
channel: ChainType
payment_at: string
extra: {
type: VipType
}
}
declare type PaymentType = 'web' | 'iap'
declare interface OrderPaymentBase<T extends PaymentType> {
order_id: number
payment_type: PaymentType
}
declare interface WebOrderPayment extends OrderPaymentBase<'web'> {
payment_data: {
url: string
}
}
declare interface IAPOrderPayment extends OrderPaymentBase<'iap'> {}
declare type OrderPayment = WebOrderPayment | IAPOrderPayment
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment