vali 6 years ago
parent
commit
57f6ba3489
1 changed files with 39 additions and 31 deletions
  1. 39 31
      app/Logic/DataLogic.php

+ 39 - 31
app/Logic/DataLogic.php

@@ -864,12 +864,12 @@ class DataLogic
             if ($data['title'] != 'match_status') throw new \Exception(Response::generate('不是更新赛事状态数据', Response::ABNORMAL));
             if ($data['title'] != 'match_status') throw new \Exception(Response::generate('不是更新赛事状态数据', Response::ABNORMAL));
 
 
             /*
             /*
-            //写请求数据 日志记录
-            if($this->isRecord){
-                $setSportsRecord = St_set_sports_recordModel::setSportsRecord($getData['title'],$obt,$getData);
-                if($setSportsRecord < 1) throw new \Exception(Response::generate('',Response::SPORTS_RECORD_ERR));
-            }
-            */
+           //写请求数据 日志记录
+           if($this->isRecord){
+               $setSportsRecord = St_set_sports_recordModel::setSportsRecord($getData['title'],$obt,$getData);
+               if($setSportsRecord < 1) throw new \Exception(Response::generate('',Response::SPORTS_RECORD_ERR));
+           }
+           */
 
 
             //获取 球类代码
             //获取 球类代码
             $game_code = $data['game_code'];
             $game_code = $data['game_code'];
@@ -890,34 +890,42 @@ class DataLogic
                 ->get()->toArray();
                 ->get()->toArray();
             if (empty($local_match)) throw new \Exception(Response::generate('', Response::MATCHID_NULL));
             if (empty($local_match)) throw new \Exception(Response::generate('', Response::MATCHID_NULL));
             //更新状态字段
             //更新状态字段
-            if ($game_code == 'zq') {
+            if($game_code == 'zq'){
                 foreach ($local_match as $k => $v) {
                 foreach ($local_match as $k => $v) {
-                    $set_status = [
-                        'status' => $v['status'],
-                        'is_rollball' => $v['is_rollball'],
-                        'is_today' => $v['is_today'],
-                        'is_morningplate' => $v['is_morningplate'],
-                        'is_stringscene' => $v['is_stringscene'],
-                        'is_horn' => $v['is_horn'],
-                        'utime' => date('Y-m-d H:i:s'),
-                    ];
-                    $ret = $model['model_match']::where(['id' => $v['match_id']])
-                        ->update($set_status);
-                    if ($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code) . '赛事-match_id:' . $v['others_match_id'], Response::UPSTATUS_ERROR));
+                    foreach($data['data'] as $kk =>$vv){
+                        if($v['others_match_id'] == $vv['match_id']){
+                            $set_status = [
+                                'status' => $vv['status'],
+                                'is_rollball' => $vv['is_rollball'],
+                                'is_today' => $vv['is_today'],
+                                'is_morningplate' => $vv['is_morningplate'],
+                                'is_stringscene' => $vv['is_stringscene'],
+                                'is_horn' => $vv['is_horn'],
+                                'utime' => date('Y-m-d H:i:s'),
+                            ];
+                            $ret = $model['model_match']::where(['id' => $v['match_id']])
+                                ->update($set_status);
+                            if ($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code) . '赛事-match_id:' . $v['others_match_id'], Response::UPSTATUS_ERROR));
+                        }
+                    }
                 }
                 }
-            } else {
+            }else{
                 foreach ($local_match as $k => $v) {
                 foreach ($local_match as $k => $v) {
-                    $set_status = [
-                        'status' => $v['status'],
-                        'is_rollball' => $v['is_rollball'],
-                        'is_today' => $v['is_today'],
-                        'is_morningplate' => $v['is_morningplate'],
-                        'is_stringscene' => $v['is_stringscene'],
-                        'utime' => date('Y-m-d H:i:s'),
-                    ];
-                    $ret = $model['model_match']::where(['id' => $v['match_id']])
-                        ->update($set_status);
-                    if ($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code) . '赛事-match_id:' . $v['others_match_id'], Response::UPSTATUS_ERROR));
+                    foreach($data['data'] as $kk =>$vv){
+                        if($v['others_match_id'] == $vv['match_id']){
+                            $set_status = [
+                                'status' => $vv['status'],
+                                'is_rollball' => $vv['is_rollball'],
+                                'is_today' => $vv['is_today'],
+                                'is_morningplate' => $vv['is_morningplate'],
+                                'is_stringscene' => $vv['is_stringscene'],
+                                'utime' => date('Y-m-d H:i:s'),
+                            ];
+                            $ret = $model['model_match']::where(['id' => $v['match_id']])
+                                ->update($set_status);
+                            if ($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code) . '赛事-match_id:' . $v['others_match_id'], Response::UPSTATUS_ERROR));
+                        }
+                    }
                 }
                 }
             }
             }