get(); for($b=0;$bstatus == 0 || $bqmatch[$b]->status == 1){ if($bqmatch[$b]->match_date < date("Y-m-d",time()) && strtotime($bqmatch[$b]->match_time.' '.$bqmatch[$b]->match_time)+10800 < time()){ \App\Models\SportsBase::where('match_id',$bqmatch[$b]->match_id)->update(['status'=>'2']); \App\Models\Stbqresultrecord::where('match_id',$bqmatch[$b]->match_id)->update(['status'=>'2']); // $comendnotice = \App\Model\Comendnotice::where('match_id',$bqmatch[$b]->match_id)->first(); // if(empty($comendnotice)){ // $db = new \App\Model\Comendnotice(); // $db->status = 0; // $db->game_code = 'bq'; // $db->match_id = $bqmatch[$b]->match_id; // $db->done_time = date("Y-m-d h:i:s", time()); // $db->ctime = date("Y-m-d h:i:s", time()); // $db->save(); // } } if($bqmatch[$b]->match_date == date("Y-m-d",time()) && strtotime($bqmatch[$b]->match_date.' '.$bqmatch[$b]->match_time)+10800 < time()){ \App\Models\SportsBase::where('match_id',$bqmatch[$b]->match_id)->update(['status'=>'2']); \App\Models\Stbqresultrecord::where('match_id',$bqmatch[$b]->match_id)->update(['status'=>'2']); // $comendnotice = \App\Model\Comendnotice::where('match_id',$bqmatch[$b]->match_id)->first(); // if(empty($comendnotice)){ // $db = new \App\Model\Comendnotice(); // $db->status = 0; // $db->game_code = 'bq'; // $db->match_id = $bqmatch[$b]->match_id; // $db->done_time = date("Y-m-d h:i:s", time()); // $db->ctime = date("Y-m-d h:i:s", time()); // $db->save(); // } } } } $where[] = array('st_bq_league.name_chinese','<>',''); // $source = \App\Model\Setinfo::where('id','1000')->first(); // if($source->infocontent != '混合数据'){ // $where[] = array('st_bq_local_match.source', '=', $source->infocontent); // $where[] = array('st_bq_local_league.source', '=', $source->infocontent); // } // // if (is_array ($where) && count ($where) > 0) { // $data = $this->join('st_bq_league','st_bq_competition.lg_id','=','st_bq_league.id') // ->join('st_bq_local_match','st_bq_competition.id','=','st_bq_local_match.match_id') // ->join('st_bq_local_league','st_bq_league.id','=','st_bq_local_league.lg_id') // ->select('st_bq_competition.id','st_bq_local_match.match_id','st_bq_local_league.lg_id','st_bq_league.name_chinese','st_bq_league.last_time','st_bq_competition.home_team','st_bq_competition.guest_team','st_bq_competition.match_date','st_bq_competition.match_time','st_bq_competition.status','st_bq_competition.recommend') // ->orderby('st_bq_competition.match_date','desc') // ->orderby('st_bq_competition.match_time','desc') // ->where($where) // ->orwhere($orwhere) // ->paginate ($list); // } else { // $data = $this->join('st_bq_league','st_bq_competition.lg_id','=','st_bq_league.id') // ->join('st_bq_local_match','st_bq_competition.id','=','st_bq_local_match.match_id') // ->join('st_bq_local_league','st_bq_league.id','=','st_bq_local_league.lg_id') // ->select('st_bq_competition.id','st_bq_local_match.match_id','st_bq_local_league.lg_id','st_bq_league.name_chinese','st_bq_league.last_time','st_bq_competition.home_team','st_bq_competition.guest_team','st_bq_competition.match_date','st_bq_competition.match_time','st_bq_competition.status','st_bq_competition.recommend') // ->orderby('st_bq_competition.match_date','desc') // ->orderby('st_bq_competition.match_time','desc') // ->paginate ($list); // } if (is_array ($where) && count ($where) > 0) { $data = $this->join('st_bq_league','st_bq_competition.lg_id','=','st_bq_league.lg_id') ->select('st_bq_competition.id','st_bq_competition.match_id','st_bq_competition.lg_id','st_bq_league.name_chinese','st_bq_league.last_time','st_bq_competition.home_team','st_bq_competition.guest_team','st_bq_competition.match_date','st_bq_competition.match_time','st_bq_competition.status','st_bq_competition.recommend') ->orderby('st_bq_competition.match_date','desc') ->orderby('st_bq_competition.match_time','desc') ->where($where) ->orwhere($orwhere) ->paginate ($list); } else { $data = $this->join('st_bq_league','st_bq_competition.lg_id','=','st_bq_league.lg_id') ->select('st_bq_competition.id','st_bq_competition.match_id','st_bq_competition.lg_id','st_bq_league.name_chinese','st_bq_league.last_time','st_bq_competition.home_team','st_bq_competition.guest_team','st_bq_competition.match_date','st_bq_competition.match_time','st_bq_competition.status','st_bq_competition.recommend') ->orderby('st_bq_competition.match_date','desc') ->orderby('st_bq_competition.match_time','desc') ->paginate ($list); } if (!$data < 0) { return -2021052003; // } //赛事结果处理状态查询 $result = \App\Models\Comendnotice::where('game_code','bq')->get(); for($i=0;$imatch_date == '' && $data[$i]->last_time != ''){ $datetime = explode(' ',$data[$i]->last_time); $data[$i]->match_date = $datetime[0]; $data[$i]->match_time = $datetime[1]; } if($data[$i]->status==0){ $data[$i]->status = '未开始'; }else if($data[$i]->status==1){ $data[$i]->status = '正在进行'; }else if($data[$i]->status==2){ $data[$i]->status = '已结束'; } if($data[$i]->guest_team == ''){ $data[$i]->home_guest = $data[$i]->home_team; }else{ $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team; } //赛事结果状态 $data[$i]->result_status = -1; $data[$i]->result_id = -1; if(!empty($result)){ for($j=0;$jmatch_id == $result[$j]->match_id){ $data[$i]->result_status = $result[$j]->status; $data[$i]->result_id = $result[$j]->id; } } } if($data[$i]->result_status != -1){ if($data[$i]->result_status == 0){ $data[$i]->result = ' 处理 '; }else{ $data[$i]->result = ' 已处理 '; } }else{ $data[$i]->result = ' 处理 '; } } return $data->toArray(); } //更新设置 function updateInfos($data,$id){ $res=$this->where('id',$id)->update($data); if(!$res) { return -7020050022;//更新失败 } return 1; } function getmatchid($id){ $res=$this->where('id',$id)->first(); if(!$res){ return -2021052003; } return $res->match_id; } }