|
|
@@ -2652,77 +2652,7 @@ class WriteSportsController extends BaseController
|
|
|
$models = commonFunction::getModels($game_code, 1);
|
|
|
//获取 赛事 数据
|
|
|
$match_r_data = $getData['data'];
|
|
|
- /*
|
|
|
-
|
|
|
- //获取 当前请求 所有 uuid /match_id
|
|
|
- $identity = [];//联赛uuid
|
|
|
- $s_match_ids = [];//赛事id
|
|
|
- $match_uuids = [];
|
|
|
- foreach ($match_r_data as $k => $v) {
|
|
|
- $identity[] = $v['uuid'];
|
|
|
- $s_match_ids[] = $v['match_id'];
|
|
|
- }
|
|
|
-
|
|
|
- //====验证 赛事 所属 联赛 是否存在====
|
|
|
- $identity = array_unique($identity);
|
|
|
- sort($identity);
|
|
|
-
|
|
|
- //获取 本地 已存在 联赛
|
|
|
- $l_lg_data = $models['model_local_league']::whereIn('identity', $identity)->select('identity', 'lg_id')->get()->toArray();
|
|
|
- //二维数组去重
|
|
|
- $l_lg_data = commonFunction::uniquArrV2($l_lg_data, 'identity');
|
|
|
- //循环对比 请求uuid->本地identity
|
|
|
- foreach ($l_lg_data as $k => $v) {
|
|
|
- foreach ($identity as $kk => $uuid) {
|
|
|
- if ($v['identity'] == $uuid) {
|
|
|
- unset($identity[$kk]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- sort($identity);
|
|
|
- //去除本地和请求里都存在的联赛,如果还有剩余联赛id,则返回异常
|
|
|
- if (!empty($identity)) throw new \Exception(Response::generate($gameName . '联赛:uuid-' . $identity[0] . ';', Response::LEAGUE_ERROR));
|
|
|
- //====end====
|
|
|
-
|
|
|
- //====验证 赛事结果记录 所属赛事 是否存在====$match_uuids
|
|
|
- $s_match_ids = array_unique($s_match_ids);
|
|
|
- sort($s_match_ids);
|
|
|
-
|
|
|
- //获取 本地 已存在 赛事
|
|
|
- $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 = 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]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- sort($s_match_ids);
|
|
|
- //去除本地和请求里都存在的赛事,如果还有剩余赛事id,则返回异常
|
|
|
- if (!empty($s_match_ids)) throw new \Exception(Response::generate($gameName . '赛事-match_id' . $s_match_ids[0] . ';', Response::MATCH_ERROR));
|
|
|
- //====end====
|
|
|
- //处理 赛事 结果记录 数据
|
|
|
- foreach ($match_r_data as $k => $v) {
|
|
|
- $data = $v;
|
|
|
- //获取 本地 联赛 ID
|
|
|
- $lg_id = commonFunction::searcharray($data['uuid'], 'identity', $l_lg_data, 'lg_id');
|
|
|
- //获取 本地 赛事 ID
|
|
|
- $match_id = commonFunction::searcharray($data['match_id'], 'others_match_id', $l_match_data, 'match_id');
|
|
|
-
|
|
|
- //根据球类 获取 赛事结果记录字段
|
|
|
- $set_match_r = $this->get_match_r($game_code, $lg_id, $match_id, $data);
|
|
|
-
|
|
|
- //写 赛事 结果 记录
|
|
|
- $ret = $models['model_result_record']::insert($set_match_r);
|
|
|
-
|
|
|
- if ($ret != true) throw new \Exception(Response::generate($gameName . '赛事-match_id:' . $data['match_id'] . ';', Response::ADD_MATCH_R_R_ERROR));
|
|
|
- }
|
|
|
- */
|
|
|
+
|
|
|
if(!empty($match_r_data)){
|
|
|
foreach($match_r_data as $k=>$v){
|
|
|
$del = $models['model_result_express']::where('match_id',$v['match_id'])->delete();
|