|
|
@@ -13,9 +13,37 @@ class SportsTennis extends BaseModel {
|
|
|
|
|
|
function getinfo($list = 10, $page, $where = '',$orwhere = '')
|
|
|
{
|
|
|
+// $source = \App\Models\Setinfo::where('id','1000')->first();
|
|
|
+// if($source->infocontent != '混合数据'){
|
|
|
+// $where[] = array('st_wq_local_match.source', '=', $source->infocontent);
|
|
|
+// $where[] = array('st_wq_local_league.source', '=', $source->infocontent);
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (is_array ($where) && count ($where) > 0) {
|
|
|
+// $data = $this->join('st_wq_league','st_wq_competition.lg_id','=','st_wq_league.id')
|
|
|
+// ->join('st_wq_local_match','st_wq_competition.id','=','st_wq_local_match.match_id')
|
|
|
+// ->join('st_wq_local_league','st_wq_league.id','=','st_wq_local_league.lg_id')
|
|
|
+// ->select('st_wq_competition.id','st_wq_local_match.match_id','st_wq_local_league.lg_id','st_wq_league.name_chinese','st_wq_league.last_time','st_wq_competition.home_team','st_wq_competition.guest_team','st_wq_competition.match_date','st_wq_competition.match_time','st_wq_competition.status','st_wq_competition.recommend')
|
|
|
+// ->orderby('st_wq_competition.match_date','desc')
|
|
|
+// ->orderby('st_wq_competition.match_time','desc')
|
|
|
+// ->where($where)
|
|
|
+// ->orwhere($orwhere)
|
|
|
+// ->paginate ($list);
|
|
|
+// } else {
|
|
|
+// $data = $this->join('st_wq_league','st_wq_competition.lg_id','=','st_wq_league.id')
|
|
|
+// ->join('st_wq_local_match','st_wq_competition.id','=','st_wq_local_match.match_id')
|
|
|
+// ->join('st_wq_local_league','st_wq_league.id','=','st_wq_local_league.lg_id')
|
|
|
+// ->select('st_wq_competition.id','st_wq_local_match.match_id','st_wq_local_league.lg_id','st_wq_league.name_chinese','st_wq_league.last_time','st_wq_competition.home_team','st_wq_competition.guest_team','st_wq_competition.match_date','st_wq_competition.match_time','st_wq_competition.status','st_wq_competition.recommend')
|
|
|
+// ->orderby('st_wq_competition.match_date','desc')
|
|
|
+// ->orderby('st_wq_competition.match_time','desc')
|
|
|
+// ->paginate ($list);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (is_array ($where) && count ($where) > 0) {
|
|
|
$data = $this->join('st_wq_league','st_wq_competition.lg_id','=','st_wq_league.lg_id')
|
|
|
- ->select('st_wq_competition.id','st_wq_competition.match_id','st_wq_competition.lg_id','st_wq_league.name_chinese','st_wq_competition.home_team','st_wq_competition.guest_team','st_wq_competition.match_date','st_wq_competition.match_time','st_wq_competition.status','st_wq_competition.recommend')
|
|
|
+ ->select('st_wq_competition.id','st_wq_competition.match_id','st_wq_competition.lg_id','st_wq_league.name_chinese','st_wq_league.last_time','st_wq_competition.home_team','st_wq_competition.guest_team','st_wq_competition.match_date','st_wq_competition.match_time','st_wq_competition.status','st_wq_competition.recommend')
|
|
|
->orderby('st_wq_competition.match_date','desc')
|
|
|
->orderby('st_wq_competition.match_time','desc')
|
|
|
->where($where)
|
|
|
@@ -23,7 +51,7 @@ class SportsTennis extends BaseModel {
|
|
|
->paginate ($list);
|
|
|
} else {
|
|
|
$data = $this->join('st_wq_league','st_wq_competition.lg_id','=','st_wq_league.lg_id')
|
|
|
- ->select('st_wq_competition.id','st_wq_competition.match_id','st_wq_competition.lg_id','st_wq_league.name_chinese','st_wq_competition.home_team','st_wq_competition.guest_team','st_wq_competition.match_date','st_wq_competition.match_time','st_wq_competition.status','st_wq_competition.recommend')
|
|
|
+ ->select('st_wq_competition.id','st_wq_competition.match_id','st_wq_competition.lg_id','st_wq_league.name_chinese','st_wq_league.last_time','st_wq_competition.home_team','st_wq_competition.guest_team','st_wq_competition.match_date','st_wq_competition.match_time','st_wq_competition.status','st_wq_competition.recommend')
|
|
|
->orderby('st_wq_competition.match_date','desc')
|
|
|
->orderby('st_wq_competition.match_time','desc')
|
|
|
->paginate ($list);
|
|
|
@@ -31,24 +59,16 @@ class SportsTennis extends BaseModel {
|
|
|
if (!$data < 0) {
|
|
|
return -2021052003; //
|
|
|
}
|
|
|
+
|
|
|
+ //赛事结果处理状态查询
|
|
|
+ $result = \App\Models\Comendnotice::where('game_code','wq')->get();
|
|
|
+
|
|
|
for($i=0;$i<count($data);$i++){
|
|
|
- if($data[$i]->match_date < date('Y-m-d',time())){
|
|
|
- $data[$i]->status = '2';
|
|
|
- //$this->where('id', $data[$i]->id)->update(['status' => 2]);
|
|
|
- }else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time)+5400 <= strtotime(date('H:i:s',time()))){
|
|
|
- $data[$i]->status = '2';
|
|
|
- //$this->where('id', $data[$i]->id)->update(['status' => 2]);
|
|
|
- }
|
|
|
- else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time) < strtotime(date('H:i:s',time())) && strtotime(date('H:i:s',time())) < strtotime($data[$i]->match_time)+5400){
|
|
|
- $data[$i]->status = '1';
|
|
|
- //$this->where('id', $data[$i]->id)->update(['status' => 1]);
|
|
|
- }else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time) > strtotime(date('H:i:s',time()))){
|
|
|
- $data[$i]->status = '0';
|
|
|
- //$this->where('id', $data[$i]->id)->update(['status' => 0]);
|
|
|
- }
|
|
|
- else if($data[$i]->match_date > date('Y-m-d',time())){
|
|
|
- $data[$i]->status = '0';
|
|
|
- //$this->where('id', $data[$i]->id)->update(['status' => 0]);
|
|
|
+
|
|
|
+ if($data[$i]->match_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){
|
|
|
@@ -63,9 +83,21 @@ class SportsTennis extends BaseModel {
|
|
|
}else{
|
|
|
$data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
|
|
|
}
|
|
|
- $result = \App\Models\Comendnotice::where('match_id',$data[$i]->match_id)->where('game_code','wq')->first();
|
|
|
+
|
|
|
+ //赛事结果状态
|
|
|
if(!empty($result)){
|
|
|
- if($result->status == '0'){
|
|
|
+ for($j=0;$j<count($result);$j++){
|
|
|
+ if($data[$i]->match_id == $result[$j]->match_id){
|
|
|
+ $data[$i]->result_status = $result[$j]->status;
|
|
|
+ }else{
|
|
|
+ $data[$i]->result_status = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $data[$i]->result_status = null;
|
|
|
+ }
|
|
|
+ if($data[$i]->result_status != null){
|
|
|
+ if($data[$i]->result_status == '0'){
|
|
|
$data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsTennis/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsTennis/dealwith/?id='.$result->id.'\');" style="background-color: #FF5722;"> 处理 </a>';
|
|
|
}else{
|
|
|
$data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 已处理 </a>';
|