|
@@ -41,10 +41,10 @@ class DataLogic
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
$obt = $data['data'];
|
|
$obt = $data['data'];
|
|
|
//请求 数据 为空
|
|
//请求 数据 为空
|
|
|
- if (empty($obt)) throw new \Exception(Response::generate('请求数据为空,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if(empty($obt)) throw new \Exception(Response::generate('请求数据为空,',Response::ABNORMAL));
|
|
|
$getData = $this->getAddData($obt);
|
|
$getData = $this->getAddData($obt);
|
|
|
//不是 联赛 数据
|
|
//不是 联赛 数据
|
|
|
- if ($getData['title'] != 'league') throw new \Exception(Response::generate('不是联赛数据,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if($getData['title'] != 'league') throw new \Exception(Response::generate('不是联赛数据,',Response::ABNORMAL));
|
|
|
|
|
|
|
|
//获取球类代码
|
|
//获取球类代码
|
|
|
$game_code = $getData['game_code'];
|
|
$game_code = $getData['game_code'];
|
|
@@ -59,58 +59,60 @@ class DataLogic
|
|
|
//获取 联赛 数据
|
|
//获取 联赛 数据
|
|
|
$leagueData = $getData['data'];
|
|
$leagueData = $getData['data'];
|
|
|
|
|
|
|
|
- //获取 当前请求 所有 lg_id
|
|
|
|
|
- $s_lg_ids = [];
|
|
|
|
|
- foreach ($leagueData as $k => $v) {
|
|
|
|
|
- $s_lg_ids[] = $v['lg_id'];
|
|
|
|
|
|
|
+ //获取 当前请求 所有 联赛 uuid
|
|
|
|
|
+ $identity = [];
|
|
|
|
|
+ foreach($leagueData as $k=>$v){
|
|
|
|
|
+ $identity[] = $v['uuid'];
|
|
|
}
|
|
}
|
|
|
- $s_lg_ids = array_unique($s_lg_ids);
|
|
|
|
|
- sort($s_lg_ids);
|
|
|
|
|
|
|
+ $identity = array_unique($identity);
|
|
|
|
|
+ sort($identity);
|
|
|
|
|
|
|
|
//获取 本地 已存在 联赛
|
|
//获取 本地 已存在 联赛
|
|
|
- $l_lg_data = $models['model_local_league']::whereIn('others_lg_id', $s_lg_ids)->where('source', $source)->select('others_lg_id', 'lg_id')->get()->toArray();
|
|
|
|
|
|
|
+ $l_lg_data = $models['model_local_league']::whereIn('identity',$identity)->select('identity','lg_id')->get()->toArray();
|
|
|
//二维数组去重
|
|
//二维数组去重
|
|
|
- $l_lg_data = commonFunction::uniquArr($l_lg_data, 'others_lg_id');
|
|
|
|
|
- //循环对比 请求lg_id->本地others_lg_id
|
|
|
|
|
- foreach ($l_lg_data as $k => $v) {
|
|
|
|
|
- foreach ($s_lg_ids as $kk => $s_lg_id) {
|
|
|
|
|
- if ($v['others_lg_id'] == $s_lg_id) {
|
|
|
|
|
- unset($s_lg_ids[$kk]);
|
|
|
|
|
|
|
+ $l_lg_data = commonFunction::uniquArrV2($l_lg_data,'identity');
|
|
|
|
|
+ //循环对比 请求identity->本地identity
|
|
|
|
|
+ foreach($l_lg_data as $k=>$v){
|
|
|
|
|
+ foreach($identity as $kk=> $uuid){
|
|
|
|
|
+ if($v['identity'] == $uuid){
|
|
|
|
|
+ unset($identity[$kk]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //去除本地和请求里都存在的联赛,如果还有剩余联赛id,则将其写入
|
|
|
|
|
- if (!empty($s_lg_ids)) {
|
|
|
|
|
|
|
+ //去除本地和请求里都存在的联赛,如果还有剩余联赛uuid,则将其写入
|
|
|
|
|
+ if(!empty($identity)) {
|
|
|
//没有 决赛时间 默认获取本年最后一天
|
|
//没有 决赛时间 默认获取本年最后一天
|
|
|
$last_time = date('Y-12-31 23:59:59');
|
|
$last_time = date('Y-12-31 23:59:59');
|
|
|
- foreach ($leagueData as $k => $v) {
|
|
|
|
|
- foreach ($s_lg_ids as $kk => $s_lg_id) {
|
|
|
|
|
- if ($v['lg_id'] == $s_lg_id) {
|
|
|
|
|
|
|
+ foreach($leagueData as $k=>$v){
|
|
|
|
|
+ foreach($identity as $kk=> $uuid){
|
|
|
|
|
+ if($v['uuid'] == $uuid){
|
|
|
//如有 决赛时间
|
|
//如有 决赛时间
|
|
|
- if ($v['last_time']) {
|
|
|
|
|
|
|
+ if($v['last_time']){
|
|
|
$last_time = $v['last_time'];
|
|
$last_time = $v['last_time'];
|
|
|
}
|
|
}
|
|
|
|
|
+ if(empty($v['uuid'])) throw new \Exception(Response::generate($gameName.'联赛-lg_id:'.$v['lg_id'].';',Response::LG__UUID_NULL));
|
|
|
$set_lg['name_chinese'] = $v['name_chinese'];
|
|
$set_lg['name_chinese'] = $v['name_chinese'];
|
|
|
$set_lg['kind'] = $v['kind'];
|
|
$set_lg['kind'] = $v['kind'];
|
|
|
$set_lg['match_mode'] = $v['match_mode'];
|
|
$set_lg['match_mode'] = $v['match_mode'];
|
|
|
$set_lg['if_stop'] = $v['if_stop'];
|
|
$set_lg['if_stop'] = $v['if_stop'];
|
|
|
- $set_lg['identity'] = $v['uuid'] ?: '';
|
|
|
|
|
|
|
+ $set_lg['identity'] = $v['uuid'];
|
|
|
$set_lg['last_time'] = $last_time;
|
|
$set_lg['last_time'] = $last_time;
|
|
|
$set_lg['utime'] = date('Y-m-d H:i:s');
|
|
$set_lg['utime'] = date('Y-m-d H:i:s');
|
|
|
//写入联赛
|
|
//写入联赛
|
|
|
$id = $models['model_league']::insertGetId($set_lg);
|
|
$id = $models['model_league']::insertGetId($set_lg);
|
|
|
$m_lg_id = $id;
|
|
$m_lg_id = $id;
|
|
|
- if ($m_lg_id < 1) throw new \Exception(Response::generate($gameName . '联赛-lg_id:' . $v['lg_id'] . ';', Response::INSERT_ERROR));
|
|
|
|
|
|
|
+ if($m_lg_id < 1) throw new \Exception(Response::generate($gameName.'联赛-lg_id:'.$v['lg_id'].';',Response::INSERT_ERROR));
|
|
|
|
|
|
|
|
//写入 本地 联赛记录
|
|
//写入 本地 联赛记录
|
|
|
$set_local = [
|
|
$set_local = [
|
|
|
- 'lg_id' => $id,
|
|
|
|
|
- 'others_lg_id' => $v['lg_id'],
|
|
|
|
|
- 'source' => $source,
|
|
|
|
|
- 'ctime' => date('Y-m-d H:i:s')
|
|
|
|
|
|
|
+ 'lg_id'=>$id,
|
|
|
|
|
+ 'others_lg_id'=>$v['lg_id'],
|
|
|
|
|
+ 'source'=>$source,
|
|
|
|
|
+ 'ctime'=>date('Y-m-d H:i:s'),
|
|
|
|
|
+ 'identity'=>$v['uuid'],
|
|
|
];
|
|
];
|
|
|
$ret = $models['model_local_league']::insertGetId($set_local);
|
|
$ret = $models['model_local_league']::insertGetId($set_local);
|
|
|
- if ($ret < 1) throw new \Exception(Response::generate($gameName . '联赛-lg_id:' . $data['lg_id'] . ';', Response::LOCAL_LEAGUE_ERROR));//Render([], '10017', lang('Tips','Sports')->get('local_league_error'));
|
|
|
|
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate($gameName.'联赛-lg_id:'.$data['lg_id'].';',Response::LOCAL_LEAGUE_ERROR)) ;//Render([], '10017', lang('Tips','Sports')->get('local_league_error'));
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -140,10 +142,10 @@ class DataLogic
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
$obt = $data['data'];
|
|
$obt = $data['data'];
|
|
|
//请求 数据 为空
|
|
//请求 数据 为空
|
|
|
- if (empty($obt)) throw new \Exception(Response::generate('请求数据为空,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if(empty($obt)) throw new \Exception(Response::generate('请求数据为空,',Response::ABNORMAL));
|
|
|
$getData = $this->getAddData($obt);
|
|
$getData = $this->getAddData($obt);
|
|
|
//不是 赛事 数据
|
|
//不是 赛事 数据
|
|
|
- if ($getData['title'] != 'match') throw new \Exception(Response::generate('不是赛事数据,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if($getData['title'] != 'match') throw new \Exception(Response::generate('不是赛事数据,',Response::ABNORMAL));
|
|
|
|
|
|
|
|
//获取球类代码
|
|
//获取球类代码
|
|
|
$game_code = $getData['game_code'];
|
|
$game_code = $getData['game_code'];
|
|
@@ -155,111 +157,111 @@ class DataLogic
|
|
|
$models = commonFunction::getModels($game_code, 1);
|
|
$models = commonFunction::getModels($game_code, 1);
|
|
|
//获取 赛事 数据
|
|
//获取 赛事 数据
|
|
|
$matchData = $getData['data'];
|
|
$matchData = $getData['data'];
|
|
|
-
|
|
|
|
|
- //获取 当前请求 所有 lg_id /match_id
|
|
|
|
|
- $s_lg_ids = [];
|
|
|
|
|
|
|
+ //获取 当前请求 所有 uuid /match_id
|
|
|
|
|
+ $identity = [];
|
|
|
$s_match_ids = [];
|
|
$s_match_ids = [];
|
|
|
- foreach ($matchData as $k => $v) {
|
|
|
|
|
- $s_lg_ids[] = $v['lg_id'];
|
|
|
|
|
|
|
+ foreach($matchData as $k=>$v){
|
|
|
|
|
+ $identity[] = $v['uuid'];
|
|
|
$s_match_ids[] = $v['match_id'];
|
|
$s_match_ids[] = $v['match_id'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//====验证 赛事 所属 联赛 是否存在====
|
|
//====验证 赛事 所属 联赛 是否存在====
|
|
|
- $s_lg_ids = array_unique($s_lg_ids);
|
|
|
|
|
- sort($s_lg_ids);
|
|
|
|
|
|
|
+ $identity = array_unique($identity);
|
|
|
|
|
+ sort($identity);
|
|
|
|
|
|
|
|
//获取 本地 已存在 联赛
|
|
//获取 本地 已存在 联赛
|
|
|
- $l_lg_data = $models['model_local_league']::whereIn('others_lg_id', $s_lg_ids)->where('source', $source)->select('others_lg_id', 'lg_id')->get()->toArray();
|
|
|
|
|
|
|
+ $l_lg_data = $models['model_local_league']::whereIn('identity',$identity)->select('identity','lg_id')->get()->toArray();
|
|
|
//二维数组去重
|
|
//二维数组去重
|
|
|
- $l_lg_data = commonFunction::uniquArr($l_lg_data, 'others_lg_id');
|
|
|
|
|
- //循环对比 请求lg_id->本地others_lg_id
|
|
|
|
|
- foreach ($l_lg_data as $k => $v) {
|
|
|
|
|
- foreach ($s_lg_ids as $kk => $s_lg_id) {
|
|
|
|
|
- if ($v['others_lg_id'] == $s_lg_id) {
|
|
|
|
|
- unset($s_lg_ids[$kk]);
|
|
|
|
|
|
|
+ $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,则返回异常
|
|
//去除本地和请求里都存在的联赛,如果还有剩余联赛id,则返回异常
|
|
|
- if (!empty($s_lg_ids)) throw new \Exception(Response::generate($gameName . '联赛:lg_id-' . $s_lg_ids[0] . ';', Response::LEAGUE_ERROR));
|
|
|
|
|
|
|
+ if(!empty($identity)) throw new \Exception(Response::generate($gameName.'联赛:uuid-'.$identity[0].';',Response::LEAGUE_ERROR));
|
|
|
//====end====
|
|
//====end====
|
|
|
|
|
|
|
|
//====获取 本地 已存在 赛事====
|
|
//====获取 本地 已存在 赛事====
|
|
|
$s_match_ids = array_unique($s_match_ids);
|
|
$s_match_ids = array_unique($s_match_ids);
|
|
|
sort($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 = $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::uniquArr($l_match_data, 'others_match_id');
|
|
|
|
|
|
|
+ $l_match_data = commonFunction::uniquArrV2($l_match_data,'others_match_id');
|
|
|
|
|
|
|
|
//循环对比 请求match_id->本地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) {
|
|
|
|
|
|
|
+ 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]);
|
|
unset($s_match_ids[$kk]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//剩余 赛事 数据 写入
|
|
//剩余 赛事 数据 写入
|
|
|
- if (!empty($s_match_ids)) {
|
|
|
|
|
- foreach ($matchData as $k => $v) {
|
|
|
|
|
- foreach ($s_match_ids as $kk => $s_match_id) {
|
|
|
|
|
- if ($v['match_id'] == $s_match_id) {
|
|
|
|
|
|
|
+ if(!empty($s_match_ids)){
|
|
|
|
|
+ foreach($matchData as $k=>$v){
|
|
|
|
|
+ foreach($s_match_ids as $kk=> $s_match_id){
|
|
|
|
|
+ if($v['match_id'] == $s_match_id){
|
|
|
$data = $v;
|
|
$data = $v;
|
|
|
$half_match_id = 0;
|
|
$half_match_id = 0;
|
|
|
//获取 本地 联赛 ID
|
|
//获取 本地 联赛 ID
|
|
|
- $lg_id = commonFunction::searcharray($data['lg_id'], 'others_lg_id', $l_lg_data, 'lg_id');
|
|
|
|
|
|
|
+ $lg_id = commonFunction::searcharray($data['lg_id'],'others_lg_id',$l_lg_data,'lg_id');
|
|
|
//如果有上半场赛事id 获取上半场赛事是否存在
|
|
//如果有上半场赛事id 获取上半场赛事是否存在
|
|
|
- if (!empty($data['half_match_id'])) {
|
|
|
|
|
- $half_match_id = $models['model_local_match']::where(['others_match_id' => $data['half_match_id'], 'source' => $source])
|
|
|
|
|
|
|
+ if(!empty($data['half_match_id'])){
|
|
|
|
|
+ $half_match_id = $models['model_local_match']::where(['others_match_id'=>$data['half_match_id'],'source'=>$source])
|
|
|
->value('match_id');
|
|
->value('match_id');
|
|
|
- if (empty($half_match_id)) throw new \Exception(Response::generate($gameName . '上半场赛事-match_id:' . $data['match_id'] . ';', Response::HALF_MATCH_ERROR));//Render([], '10024', lang('Tips','Sports')->get('half_match_error'));
|
|
|
|
|
|
|
+ if(empty($half_match_id)) throw new \Exception(Response::generate($gameName.'上半场赛事-match_id:'.$data['match_id'].';',Response::HALF_MATCH_ERROR)) ;//Render([], '10024', lang('Tips','Sports')->get('half_match_error'));
|
|
|
}
|
|
}
|
|
|
//如果赛事没有开始日期,则为冠军盘口赛事
|
|
//如果赛事没有开始日期,则为冠军盘口赛事
|
|
|
- if (empty($data['match_date'])) {
|
|
|
|
|
|
|
+ if(empty($data['match_date'])){
|
|
|
//冠军盘口赛事获取所属联赛结束时间
|
|
//冠军盘口赛事获取所属联赛结束时间
|
|
|
- $last_time = $models['model_league']::where(['id' => $lg_id])
|
|
|
|
|
|
|
+ $last_time = $models['model_league']::where(['id'=>$lg_id])
|
|
|
->value('last_time');
|
|
->value('last_time');
|
|
|
|
|
|
|
|
- if (empty($last_time)) throw new \Exception(Response::generate($gameName . '联赛-lg_id:' . $data['lg_id'] . ';', Response::LG_LASTTIME_ERROR));//Render([], '10023', lang('Tips','Sports')->get('lg_lastTime_error'));
|
|
|
|
|
|
|
+ if(empty($last_time)) throw new \Exception(Response::generate($gameName.'联赛-lg_id:'.$data['lg_id'].';',Response::LG_LASTTIME_ERROR)) ;//Render([], '10023', lang('Tips','Sports')->get('lg_lastTime_error'));
|
|
|
//给冠军盘口赛事 赋值时间
|
|
//给冠军盘口赛事 赋值时间
|
|
|
$time = strtotime($last_time);
|
|
$time = strtotime($last_time);
|
|
|
- $data['match_date'] = date('Y-m-d', $time);
|
|
|
|
|
- $data['match_time'] = date('H:i:s', $time);
|
|
|
|
|
|
|
+ $data['match_date'] = date('Y-m-d',$time);
|
|
|
|
|
+ $data['match_time'] = date('H:i:s',$time);
|
|
|
}
|
|
}
|
|
|
$set_match = [
|
|
$set_match = [
|
|
|
- 'ctime' => date('Y-m-d H:i:s'),
|
|
|
|
|
- 'utime' => date('Y-m-d H:i:s'),
|
|
|
|
|
- 'expire_time' => date('Y-m-d H:i:s', time() + 60),
|
|
|
|
|
- 'home_team' => $data['home_team'] ?: '',
|
|
|
|
|
- 'guest_team' => $data['guest_team'] ?: 'no_team',
|
|
|
|
|
- 'lg_id' => $lg_id,
|
|
|
|
|
- 'status' => $data['status'],
|
|
|
|
|
- 'match_date' => $data['match_date'] ?: date('Y-m-d'),
|
|
|
|
|
- 'match_time' => $data['match_time'] ?: date('H:i:s'),
|
|
|
|
|
- 'tag' => $data['tag'] ?: 0,
|
|
|
|
|
- 'is_rollball' => $data['is_rollball'] ?: 0,
|
|
|
|
|
- 'is_today' => $data['is_today'] ?: 0,
|
|
|
|
|
- 'is_morningplate' => $data['is_morningplate'] ?: 0,
|
|
|
|
|
- 'is_stringscene' => $data['is_stringscene'] ?: 0,
|
|
|
|
|
- 'us_time' => $data['us_time'] ?: commonFunction::qgmdate('Y-m-d H:i:s', '', -4),
|
|
|
|
|
- 'half_match_id' => $half_match_id ?: 0,
|
|
|
|
|
|
|
+ 'ctime'=>date('Y-m-d H:i:s'),
|
|
|
|
|
+ 'utime'=>date('Y-m-d H:i:s'),
|
|
|
|
|
+ 'expire_time'=>date('Y-m-d H:i:s',time()+60),
|
|
|
|
|
+ 'home_team'=>$data['home_team']?:'',
|
|
|
|
|
+ 'guest_team'=>$data['guest_team']?:'no_team',
|
|
|
|
|
+ 'lg_id'=>$lg_id,
|
|
|
|
|
+ 'status'=>$data['status'],
|
|
|
|
|
+ 'match_date'=>$data['match_date']?:date('Y-m-d'),
|
|
|
|
|
+ 'match_time'=>$data['match_time']?:date('H:i:s'),
|
|
|
|
|
+ // 'tag'=>$data['tag']?:0,
|
|
|
|
|
+ 'is_rollball'=>$data['is_rollball']?:0,
|
|
|
|
|
+ 'is_today'=>$data['is_today']?:0,
|
|
|
|
|
+ 'is_morningplate'=>$data['is_morningplate']?:0,
|
|
|
|
|
+ 'is_stringscene'=>$data['is_stringscene']?: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'],
|
|
'identity' => $data['uuid'],
|
|
|
];
|
|
];
|
|
|
//写入赛事 返回id
|
|
//写入赛事 返回id
|
|
|
$id = $models['model_match']::insertGetId($set_match);
|
|
$id = $models['model_match']::insertGetId($set_match);
|
|
|
- if ($id < 1) throw new \Exception(Response::generate($gameName . '赛事-match_id:' . $data['match_id'] . ';', Response::INSERT_ERROR));
|
|
|
|
|
|
|
+ if($id < 1) throw new \Exception(Response::generate($gameName.'赛事-match_id:'.$data['match_id'].';',Response::INSERT_ERROR)) ;
|
|
|
|
|
|
|
|
//写关联记录
|
|
//写关联记录
|
|
|
$set_local = [
|
|
$set_local = [
|
|
|
- 'match_id' => $id,
|
|
|
|
|
- 'others_match_id' => $data['match_id'],
|
|
|
|
|
- 'source' => $source,
|
|
|
|
|
- 'ctime' => date('Y-m-d H:i:s')
|
|
|
|
|
|
|
+ 'match_id'=>$id,
|
|
|
|
|
+ 'others_match_id'=>$data['match_id'],
|
|
|
|
|
+ 'source'=>$source,
|
|
|
|
|
+ 'ctime'=>date('Y-m-d H:i:s')
|
|
|
];
|
|
];
|
|
|
$ret = $models['model_local_match']::insertGetId($set_local);
|
|
$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)) ;//Render([], '10018', lang('Tips','Sports')->get('local_match_error'));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -289,10 +291,11 @@ class DataLogic
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
$obt = $data['data'];
|
|
$obt = $data['data'];
|
|
|
//请求 数据 为空
|
|
//请求 数据 为空
|
|
|
- if (empty($obt)) throw new \Exception(Response::generate('请求数据为空,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if(empty($obt)) throw new \Exception(Response::generate('请求数据为空,',Response::ABNORMAL));
|
|
|
$getData = $this->getAddData($obt);
|
|
$getData = $this->getAddData($obt);
|
|
|
|
|
+
|
|
|
//不是 赛事 结果 记录 数据
|
|
//不是 赛事 结果 记录 数据
|
|
|
- if ($getData['title'] != 'match_result_r') throw new \Exception(Response::generate('不是赛事结果记录数据,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if($getData['title'] != 'match_result_r') throw new \Exception(Response::generate('不是赛事结果记录数据,',Response::ABNORMAL));
|
|
|
|
|
|
|
|
//获取球类代码
|
|
//获取球类代码
|
|
|
$game_code = $getData['game_code'];
|
|
$game_code = $getData['game_code'];
|
|
@@ -305,34 +308,33 @@ class DataLogic
|
|
|
//获取 赛事 数据
|
|
//获取 赛事 数据
|
|
|
$match_r_data = $getData['data'];
|
|
$match_r_data = $getData['data'];
|
|
|
|
|
|
|
|
- //获取 当前请求 所有 lg_id /match_id
|
|
|
|
|
- $s_lg_ids = [];
|
|
|
|
|
|
|
+ //获取 当前请求 所有 uuid /match_id
|
|
|
|
|
+ $identity = [];
|
|
|
$s_match_ids = [];
|
|
$s_match_ids = [];
|
|
|
- foreach ($match_r_data as $k => $v) {
|
|
|
|
|
- $s_lg_ids[] = $v['lg_id'];
|
|
|
|
|
|
|
+ foreach($match_r_data as $k=>$v){
|
|
|
|
|
+ $identity[] = $v['uuid'];
|
|
|
$s_match_ids[] = $v['match_id'];
|
|
$s_match_ids[] = $v['match_id'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //====验证 赛事结果记录 所属 联赛 是否存在====
|
|
|
|
|
- $s_lg_ids = array_unique($s_lg_ids);
|
|
|
|
|
- sort($s_lg_ids);
|
|
|
|
|
|
|
+ //====验证 赛事 所属 联赛 是否存在====
|
|
|
|
|
+ $identity = array_unique($identity);
|
|
|
|
|
+ sort($identity);
|
|
|
|
|
|
|
|
//获取 本地 已存在 联赛
|
|
//获取 本地 已存在 联赛
|
|
|
- $l_lg_data = $models['model_local_league']::whereIn('others_lg_id', $s_lg_ids)->where('source', $source)->select('others_lg_id', 'lg_id')->get()->toArray();
|
|
|
|
|
|
|
+ $l_lg_data = $models['model_local_league']::whereIn('identity',$identity)->select('identity','lg_id')->get()->toArray();
|
|
|
//二维数组去重
|
|
//二维数组去重
|
|
|
- $l_lg_data = commonFunction::uniquArr($l_lg_data, 'others_lg_id');
|
|
|
|
|
-
|
|
|
|
|
- //循环对比 请求lg_id->本地others_lg_id
|
|
|
|
|
- foreach ($l_lg_data as $k => $v) {
|
|
|
|
|
- foreach ($s_lg_ids as $kk => $s_lg_id) {
|
|
|
|
|
- if ($v['others_lg_id'] == $s_lg_id) {
|
|
|
|
|
- unset($s_lg_ids[$kk]);
|
|
|
|
|
|
|
+ $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,则返回异常
|
|
//去除本地和请求里都存在的联赛,如果还有剩余联赛id,则返回异常
|
|
|
- if (!empty($s_lg_ids)) throw new \Exception(Response::generate($gameName . '联赛:lg_id-' . $s_lg_ids[0] . ';', Response::LEAGUE_ERROR));
|
|
|
|
|
|
|
+ if(!empty($identity)) throw new \Exception(Response::generate($gameName.'联赛:uuid-'.$identity[0].';',Response::LEAGUE_ERROR));
|
|
|
//====end====
|
|
//====end====
|
|
|
|
|
|
|
|
//====验证 赛事结果记录 所属赛事 是否存在====
|
|
//====验证 赛事结果记录 所属赛事 是否存在====
|
|
@@ -340,36 +342,36 @@ class DataLogic
|
|
|
sort($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 = $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::uniquArr($l_match_data, 'others_match_id');
|
|
|
|
|
|
|
+ $l_match_data = commonFunction::uniquArrV2($l_match_data,'others_match_id');
|
|
|
|
|
|
|
|
//循环对比 请求match_id->本地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) {
|
|
|
|
|
|
|
+ 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]);
|
|
unset($s_match_ids[$kk]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ sort($s_match_ids);
|
|
|
//去除本地和请求里都存在的赛事,如果还有剩余赛事id,则返回异常
|
|
//去除本地和请求里都存在的赛事,如果还有剩余赛事id,则返回异常
|
|
|
- if (!empty($s_match_ids)) throw new \Exception(Response::generate($gameName . '赛事-match_id' . $s_match_ids[0] . ';', Response::MATCH_ERROR));
|
|
|
|
|
|
|
+ if(!empty($s_match_ids)) throw new \Exception(Response::generate($gameName.'赛事-match_id'.$s_match_ids[0].';',Response::MATCH_ERROR));
|
|
|
//====end====
|
|
//====end====
|
|
|
|
|
|
|
|
//处理 赛事 结果记录 数据
|
|
//处理 赛事 结果记录 数据
|
|
|
- foreach ($match_r_data as $k => $v) {
|
|
|
|
|
|
|
+ foreach($match_r_data as $k=>$v){
|
|
|
$data = $v;
|
|
$data = $v;
|
|
|
//获取 本地 联赛 ID
|
|
//获取 本地 联赛 ID
|
|
|
- $lg_id = commonFunction::searcharray($data['lg_id'], 'others_lg_id', $l_lg_data, 'lg_id');
|
|
|
|
|
|
|
+ $lg_id = commonFunction::searcharray($data['lg_id'],'others_lg_id',$l_lg_data,'lg_id');
|
|
|
//获取 本地 赛事 ID
|
|
//获取 本地 赛事 ID
|
|
|
- $match_id = commonFunction::searcharray($data['match_id'], 'others_match_id', $l_match_data, 'match_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);
|
|
|
|
|
|
|
+ $set_match_r = $this->get_match_r($game_code,$lg_id,$match_id,$data);
|
|
|
//写 赛事 结果 记录
|
|
//写 赛事 结果 记录
|
|
|
$ret = $models['model_result_record']::insert($set_match_r);
|
|
$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($ret != true) throw new \Exception(Response::generate($gameName.'赛事-match_id:'.$data['match_id'].';',Response::ADD_MATCH_R_R_ERROR));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->writeLog($data,Response::success());
|
|
$this->writeLog($data,Response::success());
|
|
@@ -397,70 +399,80 @@ class DataLogic
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
$obt = $data['data'];
|
|
$obt = $data['data'];
|
|
|
//请求 数据 为空
|
|
//请求 数据 为空
|
|
|
- if (empty($obt)) throw new \Exception(Response::generate('请求数据为空,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if(empty($obt)) throw new \Exception(Response::generate('请求数据为空,',Response::ABNORMAL));
|
|
|
$getData = $this->getAddData($obt);
|
|
$getData = $this->getAddData($obt);
|
|
|
|
|
+
|
|
|
//不是 赔率 数据
|
|
//不是 赔率 数据
|
|
|
- if ($getData['title'] != 'odds') throw new \Exception(Response::generate('不是赔率数据,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if($getData['title'] != 'odds') throw new \Exception(Response::generate('不是赔率数据,',Response::ABNORMAL));
|
|
|
|
|
|
|
|
//获取球类代码
|
|
//获取球类代码
|
|
|
$game_code = $getData['game_code'];
|
|
$game_code = $getData['game_code'];
|
|
|
//获取数据源
|
|
//获取数据源
|
|
|
$source = $getData['source'];
|
|
$source = $getData['source'];
|
|
|
//获取源数据联赛ID
|
|
//获取源数据联赛ID
|
|
|
- $s_lg_id = $getData['lg_id'];
|
|
|
|
|
|
|
+ $uuid = $getData['uuid'];
|
|
|
//获取源数据赛事ID
|
|
//获取源数据赛事ID
|
|
|
$s_match_id = $getData['match_id'];
|
|
$s_match_id = $getData['match_id'];
|
|
|
|
|
+ //获取赔率所属赛事 tag 值 玩法数量
|
|
|
|
|
+ $tag = $getData['tag'];
|
|
|
|
|
|
|
|
//获取球类名称
|
|
//获取球类名称
|
|
|
$gameName = gameModel::getGameName($game_code);
|
|
$gameName = gameModel::getGameName($game_code);
|
|
|
//验证本次请求所属联赛/赛事是否存在 返回本地联赛/赛事ID
|
|
//验证本次请求所属联赛/赛事是否存在 返回本地联赛/赛事ID
|
|
|
$models = commonFunction::getModels($game_code, 1);
|
|
$models = commonFunction::getModels($game_code, 1);
|
|
|
- $lg_id = $this->leagueVerify($models, $s_lg_id, $source, $gameName);
|
|
|
|
|
- $match_id = $this->matchVerify($models, $s_match_id, $source, $gameName);
|
|
|
|
|
|
|
+ $lg_id = $this->leagueVerify($models,$uuid,$source,$gameName);
|
|
|
|
|
+ $match_id = $this->matchVerify($models,$s_match_id,$source,$gameName);
|
|
|
|
|
+
|
|
|
|
|
+ //更新赛事 tag 值
|
|
|
|
|
+ $upMatch = $models['model_match']::where(['id'=>$match_id])
|
|
|
|
|
+ ->update(['tag'=>$tag,'utime'=>date('Y-m-d H:i:s')]);
|
|
|
|
|
+ if($upMatch < 1) throw new \Exception(Response::generate($gameName.'赛事-match_id:'.$s_match_id.';',Response::UPMATCHTAG_ERROR)) ;
|
|
|
|
|
|
|
|
//获取 赔率数据
|
|
//获取 赔率数据
|
|
|
$oddsData = $getData['data'];
|
|
$oddsData = $getData['data'];
|
|
|
- //获取 当前 所有 可用 赔率 sole
|
|
|
|
|
- $odds_only = $getData['odds_only'];
|
|
|
|
|
- //更新赛事下所有 不在本次请求的赔率 状态
|
|
|
|
|
- $ret = OddsModel::getMatchSole($models, $s_match_id, '', $source, $odds_only);
|
|
|
|
|
- if ($ret != true) throw new \Exception(Response::generate($gameName, Response::ODDS_SOLE_ERR));
|
|
|
|
|
-
|
|
|
|
|
- //拼装 待写入 赔率数据
|
|
|
|
|
- foreach ($oddsData as $k => $v) {
|
|
|
|
|
- //组装数据
|
|
|
|
|
- $set_odds = [
|
|
|
|
|
- 'match_id' => $match_id ?: 0,
|
|
|
|
|
- 'others_match_id' => $v['match_id'] ?: 0,
|
|
|
|
|
- 'odds_code' => $v['odds_code'] ?: '',
|
|
|
|
|
- 'status' => $v['status'] ?: 0,
|
|
|
|
|
- 'sort' => $v['sort'] ?: 0,
|
|
|
|
|
- 'p_code' => $v['p_code'] ?: '',
|
|
|
|
|
- 'odds' => $v['odds'] ?: 0,
|
|
|
|
|
- 'condition' => $v['condition'],
|
|
|
|
|
- 'odds_only' => $v['odds_only'] ?: '',
|
|
|
|
|
- 'source' => $v['source'] ?: '',
|
|
|
|
|
- 'type' => $v['type'] ?: 0,
|
|
|
|
|
- 'team' => $v['team'] ?: '',
|
|
|
|
|
- 'lg_id' => $lg_id,
|
|
|
|
|
- 'others_lg_id' => $v['lg_id'],
|
|
|
|
|
- 'ctime' => date('Y-m-d H:i:s'),
|
|
|
|
|
- 'utime' => date('Y-m-d H:i:s'),
|
|
|
|
|
- ];
|
|
|
|
|
- //写赔率记录数据
|
|
|
|
|
- $ret = $models['model_odds_record']->updateOrCreate(
|
|
|
|
|
- ['odds_only' => $v['odds_only']], $set_odds
|
|
|
|
|
- );
|
|
|
|
|
- if (empty($ret)) throw new \Exception(Response::generate($gameName . '赔率记录-odds_only:' . $v['odds_only'] . ';', Response::ADD_ODDS_R_ERROR));
|
|
|
|
|
-
|
|
|
|
|
- //追加参数
|
|
|
|
|
- $set_odds['sole'] = $v['sole'];
|
|
|
|
|
- $set_odds['expire_time'] = date('Y-m-d H:i:s', time() + 60);
|
|
|
|
|
- //写赔率 数据
|
|
|
|
|
- $ret = $models['model_odds']->updateOrCreate(
|
|
|
|
|
- ['odds_only' => $v['odds_only']], $set_odds
|
|
|
|
|
- );
|
|
|
|
|
- if (empty($ret)) throw new \Exception(Response::generate($gameName . '赔率-odds_only:' . $v['odds_only'] . ';', Response::ADD_ODDS_ERROR));
|
|
|
|
|
|
|
+ if(!empty($oddsData)){
|
|
|
|
|
+ //获取 当前 所有 可用 赔率 sole
|
|
|
|
|
+ $odds_only = $getData['odds_only'];
|
|
|
|
|
+ //更新赛事下所有 不在本次请求的赔率 状态
|
|
|
|
|
+ $ret= OddsModel::upOddsStatus($models,$s_match_id,'',$source,$odds_only);
|
|
|
|
|
+ if($ret != true) throw new \Exception(Response::generate($gameName,Response::ODDS_SOLE_ERR));
|
|
|
|
|
+
|
|
|
|
|
+ //拼装 待写入 赔率数据
|
|
|
|
|
+ foreach($oddsData as $k=>$v){
|
|
|
|
|
+ //组装数据
|
|
|
|
|
+ $set_odds = [
|
|
|
|
|
+ 'match_id'=> $match_id?:0,
|
|
|
|
|
+ 'others_match_id'=> $v['match_id']?:0,
|
|
|
|
|
+ 'odds_code'=> $v['odds_code']?:'',
|
|
|
|
|
+ 'status'=> $v['status']?:0,
|
|
|
|
|
+ 'sort'=> $v['sort']?:0,
|
|
|
|
|
+ 'p_code'=> $v['p_code']?:'',
|
|
|
|
|
+ 'odds'=> $v['odds']?:0,
|
|
|
|
|
+ 'condition'=> $v['condition'],
|
|
|
|
|
+ 'odds_only'=> $v['odds_only']?:'',
|
|
|
|
|
+ 'source'=> $v['source']?:'',
|
|
|
|
|
+ 'type'=> $v['type']?:0,
|
|
|
|
|
+ 'team'=> $v['team']?:'',
|
|
|
|
|
+ 'lg_id'=> $lg_id,
|
|
|
|
|
+ 'others_lg_id'=> $v['lg_id'],
|
|
|
|
|
+ 'ctime'=> date('Y-m-d H:i:s'),
|
|
|
|
|
+ 'utime'=> date('Y-m-d H:i:s'),
|
|
|
|
|
+ ];
|
|
|
|
|
+ //写赔率记录数据
|
|
|
|
|
+ $ret = $models['model_odds_record']->updateOrCreate(
|
|
|
|
|
+ ['odds_only'=>$v['odds_only']],$set_odds
|
|
|
|
|
+ );
|
|
|
|
|
+ if(empty($ret)) throw new \Exception(Response::generate($gameName.'赔率记录-odds_only:'.$v['odds_only'].';',Response::ADD_ODDS_R_ERROR));
|
|
|
|
|
+
|
|
|
|
|
+ //追加参数
|
|
|
|
|
+ $set_odds['sole'] = $v['sole'];
|
|
|
|
|
+ $set_odds['expire_time'] = date('Y-m-d H:i:s',time()+60);
|
|
|
|
|
+ //写赔率 数据
|
|
|
|
|
+ $ret = $models['model_odds']->updateOrCreate(
|
|
|
|
|
+ ['odds_only'=>$v['odds_only']],$set_odds
|
|
|
|
|
+ );
|
|
|
|
|
+ if(empty($ret)) throw new \Exception(Response::generate($gameName.'赔率-odds_only:'.$v['odds_only'].';',Response::ADD_ODDS_ERROR));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->writeLog($data,Response::success());
|
|
$this->writeLog($data,Response::success());
|
|
@@ -551,10 +563,10 @@ class DataLogic
|
|
|
$obt = $data['data'];
|
|
$obt = $data['data'];
|
|
|
|
|
|
|
|
//请求 数据 为空
|
|
//请求 数据 为空
|
|
|
- if (empty($obt)) throw new \Exception(Response::generate('请求数据为空,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if(empty($obt)) throw new \Exception(Response::generate('请求数据为空,',Response::ABNORMAL));
|
|
|
$getData = $this->getAddData($obt);
|
|
$getData = $this->getAddData($obt);
|
|
|
//不是 冠军 赔率 数据
|
|
//不是 冠军 赔率 数据
|
|
|
- if ($getData['title'] != 'odds_ch') throw new \Exception(Response::generate('不是冠军赔率数据,', Response::ABNORMAL));
|
|
|
|
|
|
|
+ if($getData['title'] != 'odds_ch') throw new \Exception(Response::generate('不是冠军赔率数据,',Response::ABNORMAL));
|
|
|
|
|
|
|
|
//获取球类代码
|
|
//获取球类代码
|
|
|
$game_code = $getData['game_code'];
|
|
$game_code = $getData['game_code'];
|
|
@@ -572,70 +584,71 @@ class DataLogic
|
|
|
// $odds_only = $getData['odds_only'];
|
|
// $odds_only = $getData['odds_only'];
|
|
|
|
|
|
|
|
//====验证 请求里 所有赔率 所属联赛 是否存在 ====
|
|
//====验证 请求里 所有赔率 所属联赛 是否存在 ====
|
|
|
- //获取 当前请求 所有 lg_id
|
|
|
|
|
- foreach ($oddsData as $k => $v) {
|
|
|
|
|
- $s_lg_ids[] = $v['lg_id'];
|
|
|
|
|
|
|
+ //获取 当前请求 所有 联赛 uuid
|
|
|
|
|
+ $uuids = [];
|
|
|
|
|
+ foreach($oddsData as $k=>$v){
|
|
|
|
|
+ $uuids[] = $v['uuid'];
|
|
|
}
|
|
}
|
|
|
- $s_lg_ids = array_unique($s_lg_ids);
|
|
|
|
|
- sort($s_lg_ids);
|
|
|
|
|
|
|
+ $uuids = array_unique($uuids);
|
|
|
|
|
+ sort($uuids);
|
|
|
|
|
|
|
|
//更新赛事下所有 不在本次请求的赔率 状态
|
|
//更新赛事下所有 不在本次请求的赔率 状态
|
|
|
- // $ret= OddsModel::getMatchSole($models,'',$s_lg_ids,$source,$odds_only);
|
|
|
|
|
|
|
+ // $ret= OddsModel::upOddsStatus($models,'',$s_lg_ids,$source,$odds_only);
|
|
|
// if($ret != true) throw new \Exception(Response::generate($gameName,Response::ODDS_SOLE_ERR));
|
|
// if($ret != true) throw new \Exception(Response::generate($gameName,Response::ODDS_SOLE_ERR));
|
|
|
|
|
|
|
|
//获取 本地 已存在 联赛
|
|
//获取 本地 已存在 联赛
|
|
|
- $l_lg_data = $models['model_local_league']::whereIn('others_lg_id', $s_lg_ids)->where('source', $source)->select('others_lg_id', 'lg_id')->get()->toArray();
|
|
|
|
|
|
|
+ $l_lg_data = $models['model_local_league']::whereIn('identity',$uuids)->select('identity','lg_id')->get()->toArray();
|
|
|
//二维数组去重
|
|
//二维数组去重
|
|
|
- $l_lg_data = commonFunction::uniquArr($l_lg_data, 'others_lg_id');
|
|
|
|
|
- //循环对比 请求lg_id->本地others_lg_id
|
|
|
|
|
- foreach ($l_lg_data as $k => $v) {
|
|
|
|
|
- foreach ($s_lg_ids as $kk => $s_lg_id) {
|
|
|
|
|
- if ($v['others_lg_id'] == $s_lg_id) {
|
|
|
|
|
- unset($s_lg_ids[$kk]);
|
|
|
|
|
|
|
+ $l_lg_data = commonFunction::uniquArrV2($l_lg_data,'identity');
|
|
|
|
|
+ //循环对比 请求uuid->本地uuid
|
|
|
|
|
+ foreach($l_lg_data as $k=>$v){
|
|
|
|
|
+ foreach($uuids as $kk=> $uuid){
|
|
|
|
|
+ if($v['identity'] == $uuid){
|
|
|
|
|
+ unset($uuids[$kk]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//去除本地和请求里都存在的联赛,如果还有剩余联赛id,则返回异常;
|
|
//去除本地和请求里都存在的联赛,如果还有剩余联赛id,则返回异常;
|
|
|
- if (!empty($s_lg_ids)) throw new \Exception(Response::generate($gameName . '冠军联赛:lg_id-' . $s_lg_ids[0] . ';', Response::LEAGUE_ERROR));
|
|
|
|
|
|
|
+ if(!empty($uuids)) throw new \Exception(Response::generate($gameName.'冠军联赛:uuid-'.$uuids[0].';',Response::LEAGUE_ERROR));
|
|
|
//====end====
|
|
//====end====
|
|
|
//拼装 待写入 赔率数据
|
|
//拼装 待写入 赔率数据
|
|
|
- foreach ($oddsData as $k => $v) {
|
|
|
|
|
|
|
+ foreach($oddsData as $k=>$v){
|
|
|
//获取 本地 联赛 ID
|
|
//获取 本地 联赛 ID
|
|
|
- $lg_id = commonFunction::searcharray($v['lg_id'], 'others_lg_id', $l_lg_data, 'lg_id');
|
|
|
|
|
|
|
+ $lg_id = commonFunction::searcharray($v['lg_id'],'others_lg_id',$l_lg_data,'lg_id');
|
|
|
//组装数据
|
|
//组装数据
|
|
|
$set_odds = [
|
|
$set_odds = [
|
|
|
- 'match_id' => 0,
|
|
|
|
|
- 'others_match_id' => $v['match_id'] ?: 0,
|
|
|
|
|
- 'odds_code' => $v['odds_code'] ?: '',
|
|
|
|
|
- 'status' => $v['status'] ?: 0,
|
|
|
|
|
- 'sort' => $v['sort'] ?: 0,
|
|
|
|
|
- 'p_code' => $v['p_code'] ?: '',
|
|
|
|
|
- 'odds' => $v['odds'] ?: 0,
|
|
|
|
|
- 'condition' => $v['condition'],
|
|
|
|
|
- 'odds_only' => $v['odds_only'] ?: '',
|
|
|
|
|
- 'source' => $v['source'] ?: '',
|
|
|
|
|
- 'type' => $v['type'] ?: 1,
|
|
|
|
|
- 'team' => $v['team'] ?: '',
|
|
|
|
|
- 'lg_id' => $lg_id,
|
|
|
|
|
- 'others_lg_id' => $v['lg_id'],
|
|
|
|
|
- 'ctime' => date('Y-m-d H:i:s'),
|
|
|
|
|
- 'utime' => date('Y-m-d H:i:s'),
|
|
|
|
|
|
|
+ 'match_id'=>0,
|
|
|
|
|
+ 'others_match_id'=> $v['match_id']?:0,
|
|
|
|
|
+ 'odds_code'=> $v['odds_code']?:'',
|
|
|
|
|
+ 'status'=> $v['status']?:0,
|
|
|
|
|
+ 'sort'=> $v['sort']?:0,
|
|
|
|
|
+ 'p_code'=> $v['p_code']?:'',
|
|
|
|
|
+ 'odds'=> $v['odds']?:0,
|
|
|
|
|
+ 'condition'=> $v['condition'],
|
|
|
|
|
+ 'odds_only'=> $v['odds_only']?:'',
|
|
|
|
|
+ 'source'=> $v['source']?:'',
|
|
|
|
|
+ 'type'=> $v['type']?:1,
|
|
|
|
|
+ 'team'=> $v['team']?:'',
|
|
|
|
|
+ 'lg_id'=> $lg_id,
|
|
|
|
|
+ 'others_lg_id'=> $v['lg_id'],
|
|
|
|
|
+ 'ctime'=> date('Y-m-d H:i:s'),
|
|
|
|
|
+ 'utime'=> date('Y-m-d H:i:s'),
|
|
|
];
|
|
];
|
|
|
//写赔率记录数据
|
|
//写赔率记录数据
|
|
|
$ret = $models['model_odds_record']->updateOrCreate(
|
|
$ret = $models['model_odds_record']->updateOrCreate(
|
|
|
- ['odds_only' => $v['odds_only']], $set_odds
|
|
|
|
|
|
|
+ ['odds_only'=>$v['odds_only']],$set_odds
|
|
|
);
|
|
);
|
|
|
- if (empty($ret)) throw new \Exception(Response::generate($gameName . '赔率记录-odds_only:' . $v['odds_only'] . ';', Response::ADD_ODDS_R_ERROR));
|
|
|
|
|
|
|
+ if(empty($ret)) throw new \Exception(Response::generate($gameName.'赔率记录-odds_only:'.$v['odds_only'].';',Response::ADD_ODDS_R_ERROR));
|
|
|
|
|
|
|
|
//追加参数
|
|
//追加参数
|
|
|
$set_odds['sole'] = $v['sole'];
|
|
$set_odds['sole'] = $v['sole'];
|
|
|
- $set_odds['expire_time'] = date('Y-m-d H:i:s', time() + 60);
|
|
|
|
|
|
|
+ $set_odds['expire_time'] = date('Y-m-d H:i:s',time()+60);
|
|
|
//写赔率 数据
|
|
//写赔率 数据
|
|
|
$ret = $models['model_odds']->updateOrCreate(
|
|
$ret = $models['model_odds']->updateOrCreate(
|
|
|
- ['odds_only' => $v['odds_only']], $set_odds
|
|
|
|
|
|
|
+ ['odds_only'=>$v['odds_only']],$set_odds
|
|
|
);
|
|
);
|
|
|
- if (empty($ret)) throw new \Exception(Response::generate($gameName . '赔率-odds_only:' . $v['odds_only'] . ';', Response::ADD_ODDS_ERROR));
|
|
|
|
|
|
|
+ if(empty($ret)) throw new \Exception(Response::generate($gameName.'赔率-odds_only:'.$v['odds_only'].';',Response::ADD_ODDS_ERROR));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->writeLog($data,Response::success());
|
|
$this->writeLog($data,Response::success());
|
|
@@ -706,15 +719,15 @@ class DataLogic
|
|
|
/*
|
|
/*
|
|
|
* 验证所属 联赛 是否存在
|
|
* 验证所属 联赛 是否存在
|
|
|
*/
|
|
*/
|
|
|
- public function leagueVerify($models = [], $s_lg_id = '', $source = '', $gameName = '')
|
|
|
|
|
- {
|
|
|
|
|
- if (empty($models) || empty($s_lg_id)) throw new \Exception(Response::generate('', Response::ABNORMAL));
|
|
|
|
|
- $l_lg_id = $models['model_local_league']::where(['others_lg_id' => $s_lg_id, 'source' => $source])->value('lg_id');
|
|
|
|
|
|
|
+ public function leagueVerify($models=[],$uuid='',$source='',$gameName=''){
|
|
|
|
|
+ if(empty($models) || empty($uuid)) throw new \Exception(Response::generate('',Response::ABNORMAL));
|
|
|
|
|
+ $l_lg_id = $models['model_local_league']::where(['identity'=>$uuid])->value('lg_id');
|
|
|
|
|
|
|
|
- if ($l_lg_id < 1) throw new \Exception(Response::generate($gameName . '联赛:lg_id-' . $s_lg_id, Response::LEAGUE_ERROR));
|
|
|
|
|
|
|
+ if($l_lg_id < 1) throw new \Exception(Response::generate($gameName.'联赛:lg_id-'.$uuid,Response::LEAGUE_ERROR));
|
|
|
return $l_lg_id;
|
|
return $l_lg_id;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* 验证所属 赛事 是否存在
|
|
* 验证所属 赛事 是否存在
|
|
|
*/
|
|
*/
|
|
@@ -1134,7 +1147,7 @@ class DataLogic
|
|
|
"match_winer" => $data['match_winer'] ?: '',
|
|
"match_winer" => $data['match_winer'] ?: '',
|
|
|
"match_time" => $data['match_time'] ?: 0,
|
|
"match_time" => $data['match_time'] ?: 0,
|
|
|
"match_process" => $data['match_process'] ?: '',
|
|
"match_process" => $data['match_process'] ?: '',
|
|
|
- "tag" => $data['tag'] ?: 0,
|
|
|
|
|
|
|
+ //"tag" => $data['tag'] ?: 0,
|
|
|
"match_id" => $match_id,
|
|
"match_id" => $match_id,
|
|
|
"update_time" => date('Y-m-d H:i:s')
|
|
"update_time" => date('Y-m-d H:i:s')
|
|
|
];
|
|
];
|
|
@@ -1155,7 +1168,7 @@ class DataLogic
|
|
|
"match_winer" => $data['match_winer'] ?: '',
|
|
"match_winer" => $data['match_winer'] ?: '',
|
|
|
"match_time" => $data['match_time'] ?: 0,
|
|
"match_time" => $data['match_time'] ?: 0,
|
|
|
"match_process" => $data['match_process'] ?: '',
|
|
"match_process" => $data['match_process'] ?: '',
|
|
|
- "tag" => $data['tag'] ?: 0,
|
|
|
|
|
|
|
+ //"tag" => $data['tag'] ?: 0,
|
|
|
"match_id" => $match_id,
|
|
"match_id" => $match_id,
|
|
|
"update_time" => date('Y-m-d H:i:s')
|
|
"update_time" => date('Y-m-d H:i:s')
|
|
|
];
|
|
];
|
|
@@ -1182,7 +1195,7 @@ class DataLogic
|
|
|
"update_time" => date('Y-m-d H:i:s'),
|
|
"update_time" => date('Y-m-d H:i:s'),
|
|
|
"match_time" => $data['match_time'] ?: 0,
|
|
"match_time" => $data['match_time'] ?: 0,
|
|
|
"match_process" => $data['match_process'] ?: '',
|
|
"match_process" => $data['match_process'] ?: '',
|
|
|
- "tag" => $data['tag'] ?: 0,
|
|
|
|
|
|
|
+ //"tag" => $data['tag'] ?: 0,
|
|
|
"match_id" => $match_id,
|
|
"match_id" => $match_id,
|
|
|
"result_mark" => $data['result_mark'] ?: '',
|
|
"result_mark" => $data['result_mark'] ?: '',
|
|
|
];
|
|
];
|
|
@@ -1203,7 +1216,7 @@ class DataLogic
|
|
|
"match_winer" => $data['match_winer'] ?: '',
|
|
"match_winer" => $data['match_winer'] ?: '',
|
|
|
"match_time" => $data['match_time'] ?: 0,
|
|
"match_time" => $data['match_time'] ?: 0,
|
|
|
"match_process" => $data['match_process'] ?: '',
|
|
"match_process" => $data['match_process'] ?: '',
|
|
|
- "tag" => $data['tag'] ?: 0,
|
|
|
|
|
|
|
+ //"tag" => $data['tag'] ?: 0,
|
|
|
"match_id" => $match_id,
|
|
"match_id" => $match_id,
|
|
|
"all_inning" => $data['all_inning'] ?: 9,
|
|
"all_inning" => $data['all_inning'] ?: 9,
|
|
|
"update_time" => date('Y-m-d H:i:s'),
|
|
"update_time" => date('Y-m-d H:i:s'),
|