| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Jonlin
- * Date: 2019/3/21
- * Time: 14:07
- */
- namespace App\Sports\Controller;
- use BaseController\Controller;
- use \System\Model;
- class RollingBall extends Controller{
- public function init() {
- $this->commonFunction = C()->get('commonFunction');
- }
- /**
- * @throws \Exception
- * 首页足球滚球
- */
- public function zqrollingball(){
- $models = $this->commonFunction->getModels('zq',1);
- $model_result = $models['model_result'];
- $model_match = $models['model_match'];
- // $result = lm($model_result,'Sports')
- // ->leftjoin($model_match,$model_match.'.match_id',$model_result.'.match_id')
- // ->select($model_result.'.match_id',$model_result.'.home_team',$model_result.'.guest_team',$model_result.'.status',$model_result.'.home_score',$model_result.'.guest_score',$model_match.'.match_date as start_date',$model_match.'.match_time as start_time',$model_result.'.match_time',$model_result.'.match_process')
- // ->where('status',1)
- // ->orderby('match_time','desc')
- // ->get()->toArray();
- //获取 滚球查询条件
- $where = $this->commonFunction->getState('StRollBall',$model_match);
- $result =lm($model_match,"Sports")
- ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
- ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
- ->where($model_match.'.source',$this->source['source'])
- ->where($where)
- ->get()
- ->toarray();
- $da = [];
- foreach ($result as $key =>$item){
- if($item['match_process'] ==""){
- $mark = substr($item['match_time'],0,strrpos($item['match_time'],":"));
- if((int)$mark < 45){
- $item['match_process'] = '上半场';
- }else{
- $item['match_process'] = '下半场';
- }
- }
- $da[$key]= $item;
- }
- $data = [
- 'game_code'=>'zq',
- 'gameName'=>'足球',
- 'matchData'=>$da
- ];
- Render($data, '1', lang('Tips','Sports')->get('success'));
- }
- /**
- * @throws \Exception
- * 首页篮球滚球
- */
- public function lqrollingball(){
- $models = $this->commonFunction->getModels('lq',1);
- $model_result = $models['model_result'];
- $model_match = $models['model_match'];
- //获取 滚球查询条件
- $where = $this->commonFunction->getState('StRollBall',$model_match);
- $result =lm($model_match,"Sports")
- ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
- ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
- ->where($model_match.'.source',$this->source['source'])
- ->where($where)
- ->get()
- ->toarray();
- // $lq = lm($model_result,'Sports')
- // ->select('id','home_team','guest_team','home_score','guest_score','status','match_score','update_time','match_time','match_process')
- // ->where('status','1')
- // ->orderby('update_time','desc')
- // ->get()->toArray();
- $data = [
- 'game_code'=>'lq',
- 'gameName'=>'篮球',
- 'matchData'=>$result
- ];
- Render($data, '1', lang('Tips','Sports')->get('success'));
- }
- public function wqrollingball(){
- $models = $this->commonFunction->getModels('wq',1);
- $model_result = $models['model_result'];
- $model_match = $models['model_match'];
- //获取 滚球查询条件
- $where = $this->commonFunction->getState('StRollBall',$model_match);
- $result =lm($model_match,"Sports")
- ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
- ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time','home_player_name','guest_player_name','first_inning_score','second_inning_score','third_inning_score',$model_result.'.match_time','match_process')
- ->where($model_match.'.source',$this->source['source'])
- ->where($where)
- ->get()
- ->toarray();
- // $wq = lm($model_result,'Sports')
- // ->select('id','host_player_name','guest_player_name','status','first_inning_score','second_inning_score','third_inning_score','update_time','match_time','match_process')
- // ->where('status','1')
- // ->orderby('update_time','desc')
- // ->get()->toArray();
- $data = [
- 'game_code'=>'wq',
- 'gameName'=>'网球',
- 'matchData'=>$result
- ];
- Render($data, '1', lang('Tips','Sports')->get('success'));
- }
- public function bqrollingball(){
- $models = $this->commonFunction->getModels('bq',1);
- $model_result = $models['model_result'];
- $model_match = $models['model_match'];
- //获取 滚球查询条件
- $where = $this->commonFunction->getState('StRollBall',$model_match);
- $result =lm($model_match,"Sports")
- ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
- ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
- ->where($model_match.'.source',$this->source['source'])
- ->where($where)
- ->get()
- ->toarray();
- // $bq = lm($model_result,'Sports')
- // ->select('id','home_team','guest_team','home_score','guest_score','status','match_score','update_time','match_time','match_process')
- // ->where('status','1')
- // ->orderby('update_time','desc')
- // ->get()->toArray();
- $data = [
- 'game_code'=>'bq',
- 'gameName'=>'棒球',
- 'matchData'=>$result
- ];
- Render($data, '1', lang('Tips','Sports')->get('success'));
- }
- }
|