|
@@ -26,6 +26,7 @@ use App\Http\Model\StZqOdds as OddsModel;
|
|
|
use App\Http\Model\StZqOddsRecord as OddsRecordModel;
|
|
use App\Http\Model\StZqOddsRecord as OddsRecordModel;
|
|
|
use App\Http\Model\StZqResult as ZqResultModel;
|
|
use App\Http\Model\StZqResult as ZqResultModel;
|
|
|
use App\Http\Model\St_area_country as StAreaCountryModel;
|
|
use App\Http\Model\St_area_country as StAreaCountryModel;
|
|
|
|
|
+use App\Http\Model\St_set_sports_record as St_set_sports_recordModel;
|
|
|
|
|
|
|
|
class DataLogic
|
|
class DataLogic
|
|
|
{
|
|
{
|
|
@@ -183,7 +184,7 @@ class DataLogic
|
|
|
sort($identity);
|
|
sort($identity);
|
|
|
|
|
|
|
|
//获取 本地 已存在 联赛
|
|
//获取 本地 已存在 联赛
|
|
|
- $l_lg_data = $models['model_local_league']::whereIn('identity',$identity)->select('identity','lg_id')->get()->toArray();
|
|
|
|
|
|
|
+ $l_lg_data = $models['model_local_league']::whereIn('identity',$identity)->select('identity','lg_id','others_lg_id')->get()->toArray();
|
|
|
//二维数组去重
|
|
//二维数组去重
|
|
|
$l_lg_data = commonFunction::uniquArrV2($l_lg_data,'identity');
|
|
$l_lg_data = commonFunction::uniquArrV2($l_lg_data,'identity');
|
|
|
//循环对比 请求uuid->本地identity
|
|
//循环对比 请求uuid->本地identity
|
|
@@ -208,12 +209,16 @@ class DataLogic
|
|
|
$l_match_data = commonFunction::uniquArrV2($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){
|
|
|
|
|
- unset($s_match_ids[$kk]);
|
|
|
|
|
|
|
+ //如果本地有 赛事,则取出本地不存在赛事
|
|
|
|
|
+ if(!empty($l_match_data)){
|
|
|
|
|
+ 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);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//剩余 赛事 数据 写入
|
|
//剩余 赛事 数据 写入
|
|
@@ -224,12 +229,17 @@ class DataLogic
|
|
|
$data = $v;
|
|
$data = $v;
|
|
|
$half_match_id = 0;
|
|
$half_match_id = 0;
|
|
|
//获取 本地 联赛 ID
|
|
//获取 本地 联赛 ID
|
|
|
|
|
+ //验证本赛事是否有数据源lg_id
|
|
|
|
|
+ if(empty($data['lg_id'])) throw new \Exception(Response::generate($gameName.'赛事-match_id:'.$data['match_id'].';',Response::S_LG_ID_NULL));
|
|
|
$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');
|
|
|
|
|
+ //验证 本赛事是否获取到本地lg_id
|
|
|
|
|
+ if(empty($lg_id)) throw new \Exception(Response::generate($gameName.'赛事-match_id:'.$data['match_id'].';',Response::L_LG_ID_NULL));
|
|
|
//如果有上半场赛事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])
|
|
|
|
|
- ->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($l_match_data) and $data['half_match_id'] > 0){
|
|
|
|
|
+ $half_match_id = -1;
|
|
|
|
|
+ // $half_match_id = $models['model_local_match']::where(['others_match_id'=>$data['half_match_id'],'source'=>$source])
|
|
|
|
|
+ // ->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($data['match_date'])){
|
|
if(empty($data['match_date'])){
|