|
|
@@ -34,26 +34,34 @@ class MatchListWeb extends Controller{
|
|
|
$game_code = $_REQUEST['game_code'];//球类代码
|
|
|
$p_code = $_REQUEST['p_code'];//父级玩法代码
|
|
|
$time = $_REQUEST['match_date'];//时间条件
|
|
|
-
|
|
|
+ $lg_ids = $_REQUEST['lg_id'];//联赛筛选
|
|
|
+ $search = $_REQUEST['search'];//球队搜索
|
|
|
+ //如果有lg_id,则将其转为数组
|
|
|
+ if(strstr($lg_ids,',') != false){
|
|
|
+ $pizza = $lg_ids;
|
|
|
+ $lg_ids = explode(",", $pizza);
|
|
|
+ }else{
|
|
|
+ $lg_ids = [$lg_ids];
|
|
|
+ }
|
|
|
try {
|
|
|
if(empty($type) ){
|
|
|
throw new \Exception(Render([], '10001', lang('Tips','Sports')->get('PARAM_ERROR')));
|
|
|
}
|
|
|
switch ($type){
|
|
|
case 'StRollBall'://滚球
|
|
|
- $this->getRollBall($type,$game_code,$p_code);
|
|
|
+ $this->getRollBall($type,$game_code,$p_code,$lg_ids,$search);
|
|
|
break;
|
|
|
case 'StSoon'://即将
|
|
|
- $this->Other($type,$game_code,$p_code,$time);
|
|
|
+ $this->Other($type,$game_code,$p_code,$time,$lg_ids,$search);
|
|
|
break;
|
|
|
case 'StToday'://今日
|
|
|
- $this->Other($type,$game_code,$p_code,$time);
|
|
|
+ $this->Other($type,$game_code,$p_code,$time,$lg_ids,$search);
|
|
|
break;
|
|
|
case 'StMorningPlate'://早盘
|
|
|
- $this->Other($type,$game_code,$p_code,$time);
|
|
|
+ $this->Other($type,$game_code,$p_code,$time,$lg_ids,$search);
|
|
|
break;
|
|
|
case 'StStringScene'://串场
|
|
|
- $this->Other($type,$game_code,$p_code,$time);
|
|
|
+ $this->Other($type,$game_code,$p_code,$time,$lg_ids,$search);
|
|
|
break;
|
|
|
default:
|
|
|
throw new \Exception(Render([], '10002', lang('Tips','Sports')->get('PARAM_ERROR')));
|
|
|
@@ -65,10 +73,10 @@ class MatchListWeb extends Controller{
|
|
|
}
|
|
|
|
|
|
//获取滚球
|
|
|
- public function getRollBall($type,$game_code,$p_code){
|
|
|
+ public function getRollBall($type,$game_code,$p_code,$lg_ids=[],$search=''){
|
|
|
//根据球类代码及玩法代码 获取相关赛事赔率数据
|
|
|
if(!empty($game_code)){
|
|
|
- $matchData = $this->getMatchData($type,$game_code,$p_code);
|
|
|
+ $matchData = $this->getMatchData($type,$game_code,$p_code,'',$lg_ids,$search);
|
|
|
|
|
|
Render($matchData, '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
@@ -101,10 +109,10 @@ class MatchListWeb extends Controller{
|
|
|
Render($gameData, '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
//获取非滚球数据
|
|
|
- public function Other($type,$game_code,$p_code,$time=''){
|
|
|
+ public function Other($type,$game_code,$p_code,$time='',$lg_ids=[],$search=''){
|
|
|
//根据球类代码及玩法代码 获取相关赛事赔率数据
|
|
|
if(!empty($game_code) and !empty($p_code)){
|
|
|
- $matchData = $this->getMatchData($type,$game_code,$p_code,$time);
|
|
|
+ $matchData = $this->getMatchData($type,$game_code,$p_code,$time,$lg_ids,$search);
|
|
|
|
|
|
Render($matchData, '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
@@ -128,7 +136,7 @@ class MatchListWeb extends Controller{
|
|
|
}
|
|
|
|
|
|
//获取赛事数据
|
|
|
- public function getMatchData($type,$game_code,$p_code='',$time=''){
|
|
|
+ public function getMatchData($type,$game_code,$p_code='',$time='',$lg_ids=[],$search=''){
|
|
|
//$p_code 获取具体玩法下的赛事数据
|
|
|
$models = $this->commonFunction->getModels($game_code,1);
|
|
|
$where = $this->commonFunction->getState($type,$models['model_match']);
|
|
|
@@ -155,13 +163,21 @@ class MatchListWeb extends Controller{
|
|
|
if($type == 'StRollBall'){
|
|
|
$select = [$models['model_league'].'.lg_id',$models['model_league'].'.name_chinese as leagueName',$models['model_match'].'.match_id','home_team','guest_team','match_date','match_time','tag','country_id','area_id'];
|
|
|
}
|
|
|
+ $model_match = $models['model_match'];
|
|
|
//赛事数据
|
|
|
$matchNum = lm($models['model_league'],"Sports")
|
|
|
->join($models['model_match'],$models['model_match'].'.lg_id',$models['model_league'].'.lg_id')
|
|
|
->select($select)
|
|
|
->where($models['model_match'].'.source',$this->source['source'])
|
|
|
->where($where)
|
|
|
- ->where($timeWhere)
|
|
|
+ ->whereIn($models['model_league'].'.lg_id',$lg_ids)//联赛id筛选
|
|
|
+ ->where($timeWhere)//时间条件
|
|
|
+ ->where(function($query)use ($model_match,$search){//追加 球队搜索
|
|
|
+ $query->where($model_match.'.home_team','like','%'.$search.'%')
|
|
|
+ ->orWhere(function($query)use ($model_match,$search) {
|
|
|
+ $query->where($model_match . '.guest_team', 'like', '%' . $search . '%');
|
|
|
+ });
|
|
|
+ })
|
|
|
->get()->toArray();
|
|
|
if(empty($matchNum)) return $matchNum;
|
|
|
|