diff --git a/server/app/api/controller/MatchController.php b/server/app/api/controller/MatchController.php index 9e479ef..5ce69e0 100644 --- a/server/app/api/controller/MatchController.php +++ b/server/app/api/controller/MatchController.php @@ -516,6 +516,8 @@ class MatchController extends BaseApiController public function worldCupOdds() { $showType = $this->request->get('show_type/s', ''); + $sourceSite = strtolower(trim($this->request->get('source_site/s', ''))); + $keyword = trim($this->request->get('keyword/s', '')); $includeSpecial = $this->request->get('include_special/d', 0); $limit = min(max($this->request->get('limit/d', 120), 1), 300); $validShowTypes = ['live', 'today', 'early']; @@ -527,6 +529,21 @@ class MatchController extends BaseApiController if (in_array($showType, $validShowTypes, true)) { $query->where('show_type', $showType); } + if ($sourceSite !== '') { + $sourceSite = preg_replace('/[^a-z0-9_-]/', '', $sourceSite); + if ($sourceSite !== '') { + $query->where('source_site', $sourceSite); + } + } + if ($keyword !== '') { + $likeKeyword = '%' . addcslashes($keyword, '\\%_') . '%'; + $query->where(function ($query) use ($likeKeyword) { + $query->where('league_name', 'like', $likeKeyword) + ->whereOr('home_team', 'like', $likeKeyword) + ->whereOr('away_team', 'like', $likeKeyword) + ->whereOr('match_time_text', 'like', $likeKeyword); + }); + } $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')