213 lines
6.9 KiB
Go
213 lines
6.9 KiB
Go
|
|
package onexbet
|
|||
|
|
|
|||
|
|
//"time"
|
|||
|
|
|
|||
|
|
type OnexbetSport int
|
|||
|
|
|
|||
|
|
const (
|
|||
|
|
Football OnexbetSport = 1
|
|||
|
|
Handball OnexbetSport = 8
|
|||
|
|
Tennis OnexbetSport = 4
|
|||
|
|
|
|||
|
|
defaultPartnerID = "25"
|
|||
|
|
|
|||
|
|
liveSportURLPattern = "https://ua-1x-bet.com/LiveFeed/Get1x2_VZip?sports=%d&count=100&lng=en&mode=4&country=2&partner=25&getEmpty=true"
|
|||
|
|
|
|||
|
|
// Все лайв матчи
|
|||
|
|
liveURL = "https://ua-1x-bet.com/en/live/"
|
|||
|
|
|
|||
|
|
// https://ua-1x-bet.com/LiveFeed/GetGameZip?id=241215601&lng=en&cfview=0&isSubGames=true&GroupEvents=true&allEventsGroupSubGames=true&countevents=250&partner=25&marketType=1
|
|||
|
|
liveMatchURLPattern = "https://ua-1x-bet.com/LiveFeed/GetGameZip?id=%s&lng=en&cfview=0&isSubGames=true&GroupEvents=true&allEventsGroupSubGames=true&countevents=250&partner=25&marketType=1"
|
|||
|
|
|
|||
|
|
// Параметр - это поле SGI из LiveMatchURL
|
|||
|
|
// Старый URL
|
|||
|
|
//matchStatsURLPattern = "https://ua-1x-bet.com/SiteService/StatByStatGameId2?id=%s&ln=en&cfview=0"
|
|||
|
|
|
|||
|
|
// id, тот же что и для liveMatchURLPattern
|
|||
|
|
//liveMatchChronoPattern = "https://ua-1x-bet.com/LiveFeed/GetChronoOfPlay?id=%s&lng=en"
|
|||
|
|
|
|||
|
|
// gameId имеет вид "5d5447addc49007c51bd9359". Узнать можно из поля "SGI" в JSON по ссылке liveMatchURLPattern
|
|||
|
|
//liveMatchLineupsPattern = "https://ua-1x-bet.com/en/SiteService/LineUps?gameId=%s&ln=en"
|
|||
|
|
|
|||
|
|
// https://ua-1x-bet.com/LiveFeed/Web_SearchZip?text=leeds+united&limit=50&lng=en&mode=4&partner=25
|
|||
|
|
stdLiveSearchURL = "https://ua-1x-bet.com/LiveFeed/Web_SearchZip"
|
|||
|
|
|
|||
|
|
// https://ua-1x-bet.com/LineFeed/Web_SearchZip?text=leeds+united&limit=50&lng=en&mode=4&partner=25
|
|||
|
|
stdLineSearchURL = "https://ua-1x-bet.com/LineFeed/Web_SearchZip"
|
|||
|
|
|
|||
|
|
tennisLiveSearchURL = "https://lite.ua-1x-bet.com/service-api/LiveFeed/Web_SearchZip"
|
|||
|
|
tennisLineSearchURL = "https://lite.ua-1x-bet.com/service-api/LineFeed/Web_SearchZip"
|
|||
|
|
|
|||
|
|
//https://ua-1x-bet.com/SiteService/Game?gameId=60f319a7f75a663f692dc28b&ln=en&partner=25&geo=2
|
|||
|
|
matchStatsURLPattern = "https://ua-1x-bet.com/SiteService/Game?gameId=%s&ln=en&partner=25&geo=1"
|
|||
|
|
|
|||
|
|
// Mon Jan 2 15:04:05 -0700 MST 2006
|
|||
|
|
startDateLayout = "2006-01-02T15:04:05-07:00"
|
|||
|
|
|
|||
|
|
tennisMarketWinner = 1
|
|||
|
|
tennisMarketTotal = 17
|
|||
|
|
tennisMarketHandicap = 2
|
|||
|
|
|
|||
|
|
teamMarketWinner3Way = 1
|
|||
|
|
teamMarketTotal = 17
|
|||
|
|
teamMarketIndividualTotal1 = 15
|
|||
|
|
teamMarketIndividualTotal2 = 62
|
|||
|
|
|
|||
|
|
// Websocket message types
|
|||
|
|
WsMsgLiveMatches = "liveMatches"
|
|||
|
|
WsMsgTeamLiveMatchData = "teamLiveMatchData"
|
|||
|
|
WsMsgTennisLiveMatchData = "tennisLiveMatchData"
|
|||
|
|
|
|||
|
|
StatusMatchCompleted = 3
|
|||
|
|
StatusMatchInplay = 2
|
|||
|
|
StatusMatchWaiting = 1
|
|||
|
|
|
|||
|
|
TopicLive = "live"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
type WatchReq struct {
|
|||
|
|
SportID OnexbetSport
|
|||
|
|
MatchID string
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type LiveMatch struct {
|
|||
|
|
MatchID string `json:"matchID"`
|
|||
|
|
SportName string `json:"sportName"`
|
|||
|
|
ChampName string `json:"champName"`
|
|||
|
|
URL string `json:"url"`
|
|||
|
|
Home string `json:"home"`
|
|||
|
|
Away string `json:"away"`
|
|||
|
|
StartTime int64 `json:"startTime"`
|
|||
|
|
StatsMatchID string `json:"statsMatchID"`
|
|||
|
|
Score Score `json:"score"`
|
|||
|
|
ScoreByPeriods map[int]Score `json:"scoreByPeriods"`
|
|||
|
|
CurrentPeriod int `json:"currentPeriod"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Score struct {
|
|||
|
|
Home int `json:"home"`
|
|||
|
|
Away int `json:"away"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Period struct {
|
|||
|
|
PeriodNumber int `json:"periodNumber"` // 1 - 5
|
|||
|
|
Total Total `json:"total"`
|
|||
|
|
Handicap Handicap `json:"handicap"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
type TennisLiveMatchData struct {
|
|||
|
|
MatchID string `json:"matchID"`
|
|||
|
|
Winner *Winner2Way `json:"winner"`
|
|||
|
|
Total Total `json:"total"`
|
|||
|
|
Sets []TennisSet `json:"sets"`
|
|||
|
|
// Текущий сет
|
|||
|
|
CurrentSetNumber int `json:"currentSetNumber"`
|
|||
|
|
// Счет по сетам, например 1-0 или 2-1
|
|||
|
|
SetScore Score `json:"setScore"`
|
|||
|
|
// ключ - номер сета, значение - счет по геймам внутри сета
|
|||
|
|
GameScore map[int]Score `json:"gameScore"`
|
|||
|
|
}
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
type TeamLiveMatchData struct {
|
|||
|
|
MatchID string `json:"matchID"`
|
|||
|
|
HomeAttacks int `json:"homeAttacks"`
|
|||
|
|
HomeDangerousAttacks int `json:"homeDangerousAttacks"`
|
|||
|
|
HomeShotsOnTarget int `json:"homeShotsOnTarget"`
|
|||
|
|
HomeShotsOffTarget int `json:"homeShotsOffTarget"`
|
|||
|
|
AwayAttacks int `json:"awayAttacks"`
|
|||
|
|
AwayDangerousAttacks int `json:"awayDangerousAttacks"`
|
|||
|
|
AwayShotsOnTarget int `json:"awayShotsOnTarget"`
|
|||
|
|
AwayShotsOffTarget int `json:"awayShotsOffTarget"`
|
|||
|
|
CurrentTime int `json:"currentTime"`
|
|||
|
|
HomeGoals int `json:"homeGoals"`
|
|||
|
|
AwayGoals int `json:"awayGoals"`
|
|||
|
|
Winner *Winner3Way `json:"winner"`
|
|||
|
|
Total Total `json:"total"`
|
|||
|
|
Handicap Handicap `json:"handicap"`
|
|||
|
|
IndividualTotalHome Total `json:"individualTotalHome"`
|
|||
|
|
IndividualTotalAway Total `json:"individualTotalAway"`
|
|||
|
|
H1 Half `json:"h1"` // 1st half
|
|||
|
|
// tennis
|
|||
|
|
Winner2Way *Winner2Way `json:"winner2way"`
|
|||
|
|
|
|||
|
|
// score
|
|||
|
|
Score Score `json:"score"`
|
|||
|
|
ScoreByPeriods map[int]Score `json:"scoreByPeriods"`
|
|||
|
|
CurrentPeriod int `json:"currentPeriod"`
|
|||
|
|
Periods map[int]Period `json:"periods"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Бывают матчи, где перестают принимать ставки на один из исходов. Поэтому нужен флаг
|
|||
|
|
type Winner2Way struct {
|
|||
|
|
HasHome bool `json:"hasHome"`
|
|||
|
|
Home float64 `json:"home"`
|
|||
|
|
HasAway bool `json:"hasAway"`
|
|||
|
|
Away float64 `json:"away"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Winner3Way struct {
|
|||
|
|
Home float64 `json:"home"`
|
|||
|
|
Draw float64 `json:"draw"`
|
|||
|
|
Away float64 `json:"away"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Half struct {
|
|||
|
|
Total Total `json:"total"`
|
|||
|
|
IndividualTotalHome Total `json:"individualTotalHome"`
|
|||
|
|
IndividualTotalAway Total `json:"individualTotalAway"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Total struct {
|
|||
|
|
Over []ParamOffer `json:"over"`
|
|||
|
|
Under []ParamOffer `json:"under"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type Handicap struct {
|
|||
|
|
Home []ParamOffer `json:"home"`
|
|||
|
|
Away []ParamOffer `json:"away"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ParamOffer struct {
|
|||
|
|
Price float64 `json:"price"`
|
|||
|
|
Param string `json:"param"`
|
|||
|
|
ParamFloat float64 `json:"paramFloat"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type LiveMatchesMessage struct {
|
|||
|
|
SportID OnexbetSport `json:"sportID"`
|
|||
|
|
Matches []LiveMatch `json:"matches"`
|
|||
|
|
Watching []string `json:"watching"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
type LiveMatchesUpdateMessage struct {
|
|||
|
|
RemovedMatchIDs []string `json:"removedMatchIDs"`
|
|||
|
|
AddedMatches []LiveMatch `json:"addedMatches"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
type MatchCandidate struct {
|
|||
|
|
Sport string `json:"sport"`
|
|||
|
|
ChampName string `json:"champName"`
|
|||
|
|
Home string `json:"home"`
|
|||
|
|
Away string `json:"away"`
|
|||
|
|
StartTime int64 `json:"startTime"`
|
|||
|
|
MatchID string `json:"matchID"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type PeriodScore struct {
|
|||
|
|
HomePoints int `json:"homePoints"`
|
|||
|
|
AwayPoints int `json:"awayPoints"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type TeamMatchResult struct {
|
|||
|
|
Status int `json:"status"`
|
|||
|
|
HomePoints int `json:"homePoints"`
|
|||
|
|
AwayPoints int `json:"awayPoints"`
|
|||
|
|
ScoreByPeriods map[int]PeriodScore
|
|||
|
|
}
|