彭俊 6 жил өмнө
parent
commit
1a268d0f55

+ 9 - 5
app/Http/Controllers/Api/WriteSportsController.php

@@ -270,14 +270,18 @@ class WriteSportsController extends BaseController{
             $l_match_data = commonFunction::uniquArrV2($l_match_data,'others_match_id');
         
             //循环对比 请求match_id->本地others_match_id 
-            foreach($l_match_data as $k=>$v){
-                foreach($s_match_ids as $kk=> $s_match_id){
-                    if($v['others_match_id'] == $s_match_id){
-                        unset($s_match_ids[$kk]);
+            //如果本地有 赛事,则取出本地不存在赛事
+            if(!empty($l_match_data)){
+                foreach($l_match_data as $k=>$v){
+                    foreach($s_match_ids as $kk=> $s_match_id){
+                        if($v['others_match_id'] == $s_match_id){
+                            unset($s_match_ids[$kk]);
+                        }
                     }
                 }
+                sort($s_match_ids);
             }
-
+           
             //剩余 赛事 数据 写入
             if(!empty($s_match_ids)){
                 foreach($matchData as $k=>$v){

+ 5 - 5
app/Models/SportsSoccer.php

@@ -27,11 +27,11 @@ class SportsSoccer extends BaseModel {
         
         $where[] = array('st_zq_league.name_chinese','<>','');
 
-        $source = \App\Models\Setinfo::where('id','1000')->first();
-        if($source->infocontent != '混合数据'){
-            $where[] = array('st_zq_local_match.source', '=', $source->infocontent);
-            $where[] = array('st_zq_local_league.source', '=', $source->infocontent);
-        }
+        // $source = \App\Models\Setinfo::where('id','1000')->first();
+        // if($source->infocontent != '混合数据'){
+        //     $where[] = array('st_zq_local_match.source', '=', $source->infocontent);
+        //     $where[] = array('st_zq_local_league.source', '=', $source->infocontent);
+        // }
         if (is_array ($where) && count ($where) > 0) {
             $data = $this->join('st_zq_league','st_zq_competition.lg_id','=','st_zq_league.id')
 //                ->join('st_zq_local_match','st_zq_competition.id','=','st_zq_local_match.match_id')