|
|
@@ -1921,6 +1921,8 @@ class WriteSportsController extends BaseController
|
|
|
|
|
|
//获取 球类代码
|
|
|
$game_code = $data['game_code'];
|
|
|
+ //获取球类 名称
|
|
|
+ $gameName = gameModel::getGameName($game_code);
|
|
|
//获取 数据源
|
|
|
$source = $data['source'];
|
|
|
|
|
|
@@ -1937,54 +1939,41 @@ class WriteSportsController extends BaseController
|
|
|
->whereIn('others_match_id', $others_match_ids)
|
|
|
->get()->toArray();
|
|
|
if (empty($local_match)) throw new \Exception(Response::generate('', Response::MATCHID_NULL));
|
|
|
- //更新状态字段
|
|
|
- if($game_code == 'zq'){
|
|
|
- foreach ($local_match as $k => $v) {
|
|
|
- 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));
|
|
|
+
|
|
|
+ //取值 更新字段
|
|
|
+ foreach ($local_match as $k => $v) {
|
|
|
+ foreach($data['data'] as $kk =>$vv){
|
|
|
+ if($v['others_match_id'] == $vv['match_id']){
|
|
|
|
|
|
- //===如果赛事已结束 新增 更新 赛事结果===
|
|
|
- if($vv['status'] == 2){
|
|
|
- $this->match_result($game_code, $v['match_id']);
|
|
|
- }
|
|
|
- //===end===
|
|
|
+ $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'),
|
|
|
+ ];
|
|
|
+
|
|
|
+ //如果是足球 追加角球状态
|
|
|
+ if($game_code == 'zq'){
|
|
|
+ $set_status['is_horn'] = $vv['is_horn'];
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- foreach ($local_match as $k => $v) {
|
|
|
- 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));
|
|
|
-
|
|
|
- //===如果赛事已结束 新增 更新 赛事结果===
|
|
|
- if($vv['status'] == 2){
|
|
|
- $this->match_result($game_code, $v['match_id']);
|
|
|
- }
|
|
|
- //===end===
|
|
|
+ $ret = $model['model_match']::where(['id' => $v['match_id']])
|
|
|
+ ->update($set_status);
|
|
|
+ if ($ret < 1) throw new \Exception(Response::generate($gameName . '赛事-match_id:' . $v['others_match_id'], Response::UPSTATUS_ERROR));
|
|
|
+
|
|
|
+ //===如果赛事已结束===
|
|
|
+ if($vv['status'] == 2){
|
|
|
+ // 新增 更新 赛事结果
|
|
|
+ $this->match_result($game_code, $v['match_id']);
|
|
|
+ //获取赛事开始时间
|
|
|
+ $game_start_time = $model['model_result']::where(['match_id' => $v['match_id']])->first()->start_time;
|
|
|
+ // 写入结算通知表 用于自动结算
|
|
|
+ $Comendnotice = new \App\Models\Comendnotice();
|
|
|
+ $ret_add = $Comendnotice->addcomendnotice($v['match_id'], $game_code, 0, $game_start_time);
|
|
|
+ if ($ret_add != 1) throw new \Exception(Response::generate($gameName . '赛事-match_id:' . $v['others_match_id'], Response::ADD_NOTICE_ERR));
|
|
|
}
|
|
|
+ //===end===
|
|
|
}
|
|
|
}
|
|
|
}
|