commonFunction = C()->get('commonFunction'); } /** * @throws \Exception * 返回首页球类列表 */ public function ballList (){ $ret = lm('GameType', 'Sports')->select('id','game_name','game_code','game_ico_url')->where('status',1)->get(); if(!empty($ret)) Render($ret, '1', lang('Tips','Sports')->get('success')); } //获取各状态下所有赛事数量 public function typeList(){ //获取所有未结束赛事 $where = [ ['status','<','2'] ]; $ZQmatchData = leagueModel::getLeagueMatchData($this->commonFunction->getModels('zq'),$where); $LQmatchData = leagueModel::getLeagueMatchData($this->commonFunction->getModels('lq'),$where); $WQmatchData = leagueModel::getLeagueMatchData($this->commonFunction->getModels('wq'),$where); $BQmatchData = leagueModel::getLeagueMatchData($this->commonFunction->getModels('bq'),$where); //合并所有球类赛事 $matchAll = array_merge_recursive($ZQmatchData,$LQmatchData,$WQmatchData,$BQmatchData); //获取所有冠军盘口 $where = [ ['type','=',1], ['source','=',$this->source] ]; $select = ['match_id','type']; $ZQoddsData = ZQoddsModel::getOddsData($where,$select)->toArray(); $LQoddsData = LQoddsModel::getOddsData($where,$select)->toArray(); $WQoddsData = WQoddsModel::getOddsData($where,$select)->toArray(); $BQoddsData = BQoddsModel::getOddsData($where,$select)->toArray(); //合并所有球类关键盘口 $oddsAll = array_merge_recursive($ZQoddsData,$LQoddsData,$WQoddsData,$BQoddsData); $StRollBall = []; $StSoon = []; $StToday = []; $StMorningPlate = []; $StStringScene = []; //按状态条件分装数组 foreach ($matchAll as $kk=>$vv){ if($vv['status'] == '1'){ $StRollBall[] = $vv; } if($vv['status'] == '0' and $vv['match_date'] == date("Y-m-d") and $vv['match_time'] < date("H:i:s", strtotime("+2 hour")) and $vv['match_time'] > date("H:i:s", time())){ $StSoon[] = $vv; } if($vv['match_date'] == date("Y-m-d") and $vv['match_time'] > date("H:i:s", time())){ $StToday[] = $vv; } if($vv['is_morningplate'] == 1 and $vv['us_time'] > $this->commonFunction->qgmdate('Y-m-d H:i:s', '', -4)){ $StMorningPlate[] = $vv; } if($vv['is_stringscene'] == 1 and $vv['us_time'] > $this->commonFunction->qgmdate('Y-m-d H:i:s', '', -4)){ $StStringScene[] = $vv; } } //获取所有状态 $type = lang('GameTypes','Sports')->getAll(); foreach ($type as $k=>$v){ switch ($v['type_code']) { case 'StRollBall'://滚球 $type[$k]['matchNum'] = count($StRollBall); break; case 'StSoon'://即将 $type[$k]['matchNum'] = count($StSoon); break; case 'StToday'://今日 $type[$k]['matchNum'] = count($StToday); break; case 'StMorningPlate'://早盘 $type[$k]['matchNum'] = count($StMorningPlate); break; case 'StStringScene'://串场 $type[$k]['matchNum'] = count($StStringScene); break; case 'StChampion'://冠军 $type[$k]['matchNum'] = count($oddsAll); break; default: throw new \Exception(Render([], '10002', lang('Tips', 'Sports')->get('PARAM_ERROR'))); } } Render($type, '1', lang('Tips','Sports')->get('success')); } }