|
|
@@ -263,6 +263,7 @@ class DataLogic
|
|
|
//获取 当前请求 所有 uuid
|
|
|
$identity = [];
|
|
|
$s_match_ids = [];
|
|
|
+ $match_uuids = [];
|
|
|
foreach ($matchData as $k => $v) {
|
|
|
$identity[] = $v['uuid'];
|
|
|
$s_match_ids[] = $v['match_id'];
|
|
|
@@ -293,15 +294,17 @@ class DataLogic
|
|
|
$s_match_ids = [];
|
|
|
foreach ($matchData as $k => $v) {
|
|
|
$s_match_ids[] = $v['match_id'];
|
|
|
+ //追加获取赛事uuid
|
|
|
+ $match_uuids[] = $v['match_identity'];
|
|
|
}
|
|
|
//====获取 本地 已存在 赛事====
|
|
|
- $s_match_ids = array_unique($s_match_ids);
|
|
|
- sort($s_match_ids);
|
|
|
+ $match_uuids = array_unique($match_uuids);
|
|
|
+ sort($match_uuids);
|
|
|
|
|
|
- $l_match_data = $models['model_local_match']::whereIn('others_match_id', $s_match_ids)->where('source', $source)->select('others_match_id', 'match_id')->get()->toArray();
|
|
|
+ $l_match_data = $models['model_local_match']::whereIn('identity', $match_uuids)->where('source', $source)->select('match_id', 'identity')->get()->toArray();
|
|
|
|
|
|
//二维数组去重
|
|
|
- $l_match_data = commonFunction::uniquArrV2($l_match_data, 'others_match_id');
|
|
|
+ $l_match_data = commonFunction::uniquArrV2($l_match_data, 'identity');
|
|
|
|
|
|
//循环对比 请求match_id->本地others_match_id
|
|
|
//如果本地有 赛事,则分别获取本地已存在/不存在赛事
|
|
|
@@ -309,21 +312,21 @@ class DataLogic
|
|
|
//本地已存在赛事,用于更新
|
|
|
$matchData_y = [];
|
|
|
foreach ($l_match_data as $k => $v) {
|
|
|
- foreach ($s_match_ids as $kk => $s_match_id) {
|
|
|
- if ($v['others_match_id'] == $s_match_id) {
|
|
|
- $matchData_y[$k]['others_match_id'] = $s_match_id;
|
|
|
+ foreach ($match_uuids as $kk => $match_identity) {
|
|
|
+ if ($v['identity'] == $match_identity) {
|
|
|
+ $matchData_y[$k]['match_identity'] = $match_identity;
|
|
|
$matchData_y[$k]['match_id'] = $v['match_id'];
|
|
|
- unset($s_match_ids[$kk]);
|
|
|
+ unset($match_uuids[$kk]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- sort($s_match_ids);
|
|
|
+ sort($match_uuids);
|
|
|
}
|
|
|
//如果 请求中 有本地赛事,则执行更新
|
|
|
if (!empty($matchData_y)) {
|
|
|
foreach ($matchData as $k => $v) {
|
|
|
foreach ($matchData_y as $kk => $vv) {
|
|
|
- if ($v['match_id'] == $vv['others_match_id']) {
|
|
|
+ if ($v['match_identity'] == $vv['match_identity']) {
|
|
|
$data = $v;
|
|
|
$up_match = [];
|
|
|
$up_match['utime'] = date('Y-m-d H:i:s');
|
|
|
@@ -360,10 +363,10 @@ class DataLogic
|
|
|
}
|
|
|
}
|
|
|
//剩余 赛事 数据 写入
|
|
|
- if (!empty($s_match_ids)) {
|
|
|
+ if (!empty($match_uuids)) {
|
|
|
foreach ($matchData as $k => $v) {
|
|
|
- foreach ($s_match_ids as $kk => $s_match_id) {
|
|
|
- if ($v['match_id'] == $s_match_id) {
|
|
|
+ foreach ($match_uuids as $kk => $match_identity) {
|
|
|
+ if ($v['match_identity'] == $match_identity) {
|
|
|
$data = $v;
|
|
|
$half_match_id = $v['half_match_id'];
|
|
|
//获取 本地 联赛 ID
|
|
|
@@ -398,10 +401,11 @@ class DataLogic
|
|
|
'is_today' => $data['is_today'] ?: 0,
|
|
|
'is_morningplate' => $data['is_morningplate'] ?: 0,
|
|
|
'is_stringscene' => $data['is_stringscene'] ?: 0,
|
|
|
- 'is_horn' => $data['is_horn'] ?: 0,
|
|
|
+ 'is_horn' => $data['is_horn']?:0,
|
|
|
'us_time' => $data['us_time'] ?: commonFunction::qgmdate('Y-m-d H:i:s', '', -4),
|
|
|
'half_match_id' => $half_match_id ?: 0,
|
|
|
'identity' => $data['uuid'],
|
|
|
+ 'match_identity' => $data['match_identity'],
|
|
|
];
|
|
|
|
|
|
//如果是网球 追加rule 字段
|
|
|
@@ -417,17 +421,17 @@ class DataLogic
|
|
|
'match_id' => $id,
|
|
|
'others_match_id' => $data['match_id'],
|
|
|
'source' => $source,
|
|
|
+ 'identity' => $data['match_identity'],
|
|
|
'ctime' => date('Y-m-d H:i:s')
|
|
|
];
|
|
|
$ret = $models['model_local_match']::insertGetId($set_local);
|
|
|
- if ($ret < 1) throw new \Exception(Response::generate($gameName . '赛事-match_id:' . $data['match_id'] . ';', Response::LOCAL_MATCH_ERROR));//Render([], '10018', lang('Tips','Sports')->get('local_match_error'));
|
|
|
+ if ($ret < 1) throw new \Exception(Response::generate($gameName . '赛事-match_id:' . $data['match_id'] . ';', Response::LOCAL_MATCH_ERROR));
|
|
|
|
|
|
//追加写球队名称
|
|
|
$team = [
|
|
|
'team_h' => $data['home_team'],
|
|
|
'team_g' => $data['guest_team'],
|
|
|
];
|
|
|
-
|
|
|
StTeamModel::setTeam($game_code, $team, $source);
|
|
|
|
|
|
//追加写赛事结果
|
|
|
@@ -446,7 +450,6 @@ class DataLogic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
$this->writeLog($logdata, Response::success());
|
|
|
//提交事务
|
|
|
DB::commit();
|