deploy: auto commit repo-root changes 2026-07-13 13:26:55
This commit is contained in:
@@ -533,7 +533,11 @@ class MatchController extends BaseApiController
|
||||
$this->request->get('include_special/d', 0),
|
||||
min(max($this->request->get('limit/d', 120), 1), 300),
|
||||
$this->request->get('sport_type/d', 0),
|
||||
trim($this->request->get('league_name/s', ''))
|
||||
trim($this->request->get('league_name/s', '')),
|
||||
false,
|
||||
trim($this->request->get('home_team/s', '')),
|
||||
trim($this->request->get('away_team/s', '')),
|
||||
trim($this->request->get('match_date/s', ''))
|
||||
),
|
||||
'platform_options' => $this->getOddsPlatformOptions(),
|
||||
]);
|
||||
@@ -565,7 +569,10 @@ class MatchController extends BaseApiController
|
||||
int $limit,
|
||||
int $sportType = 0,
|
||||
string $leagueName = '',
|
||||
bool $worldCupEventOnly = false
|
||||
bool $worldCupEventOnly = false,
|
||||
string $homeTeam = '',
|
||||
string $awayTeam = '',
|
||||
string $matchDate = ''
|
||||
): array {
|
||||
$validShowTypes = ['live', 'today', 'early'];
|
||||
|
||||
@@ -601,6 +608,25 @@ class MatchController extends BaseApiController
|
||||
->whereOr('match_time_text', 'like', $likeKeyword);
|
||||
});
|
||||
}
|
||||
if ($homeTeam !== '') {
|
||||
$query->where('home_team', 'like', '%' . addcslashes($homeTeam, '\\%_') . '%');
|
||||
}
|
||||
if ($awayTeam !== '') {
|
||||
$query->where('away_team', 'like', '%' . addcslashes($awayTeam, '\\%_') . '%');
|
||||
}
|
||||
$matchDatePatterns = $this->buildOddsMatchDatePatterns($matchDate);
|
||||
if (!empty($matchDatePatterns)) {
|
||||
$query->where(function ($query) use ($matchDatePatterns) {
|
||||
foreach ($matchDatePatterns as $index => $pattern) {
|
||||
$likePattern = '%' . addcslashes($pattern, '\\%_') . '%';
|
||||
if ($index === 0) {
|
||||
$query->where('match_time_text', 'like', $likePattern);
|
||||
} else {
|
||||
$query->whereOr('match_time_text', 'like', $likePattern);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$rows = $query
|
||||
->field('id,source_site,source_url,source_match_id,source_league_id,sport_type,show_type,odds_type,league_name,match_time_text,home_team,away_team,handicap_line,handicap_home_odds,handicap_away_odds,total_line,total_over_odds,total_under_odds,home_win_odds,draw_odds,away_win_odds,update_time')
|
||||
@@ -734,6 +760,42 @@ class MatchController extends BaseApiController
|
||||
return trim($matchTimeText);
|
||||
}
|
||||
|
||||
private function buildOddsMatchDatePatterns(string $matchDate): array
|
||||
{
|
||||
$matchDate = trim($matchDate);
|
||||
if ($matchDate === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
$normalized = str_replace('/', '-', $matchDate);
|
||||
if (preg_match('/^(\d{4})-(\d{1,2})-(\d{1,2})$/', $normalized, $matches)) {
|
||||
$year = (int)$matches[1];
|
||||
$month = (int)$matches[2];
|
||||
$day = (int)$matches[3];
|
||||
return array_values(array_unique([
|
||||
sprintf('%04d-%02d-%02d', $year, $month, $day),
|
||||
sprintf('%04d/%02d/%02d', $year, $month, $day),
|
||||
sprintf('%02d-%02d', $month, $day),
|
||||
sprintf('%02d/%02d', $month, $day),
|
||||
sprintf('%d-%d', $month, $day),
|
||||
sprintf('%d/%d', $month, $day),
|
||||
]));
|
||||
}
|
||||
|
||||
if (preg_match('/^(\d{1,2})-(\d{1,2})$/', $normalized, $matches)) {
|
||||
$month = (int)$matches[1];
|
||||
$day = (int)$matches[2];
|
||||
return array_values(array_unique([
|
||||
sprintf('%02d-%02d', $month, $day),
|
||||
sprintf('%02d/%02d', $month, $day),
|
||||
sprintf('%d-%d', $month, $day),
|
||||
sprintf('%d/%d', $month, $day),
|
||||
]));
|
||||
}
|
||||
|
||||
return [$matchDate];
|
||||
}
|
||||
|
||||
private function buildTeamPairKey(string $homeTeam, string $awayTeam): string
|
||||
{
|
||||
$homeTeam = preg_replace('/\s+/u', '', trim($homeTeam));
|
||||
|
||||
Reference in New Issue
Block a user