diff --git a/Laravel/app/Lib/Yz.php b/Laravel/app/Lib/Yz.php index b46a32b..7b12d15 100644 --- a/Laravel/app/Lib/Yz.php +++ b/Laravel/app/Lib/Yz.php @@ -63,29 +63,31 @@ class Yz{ $resdata = curl_exec($ch); - - - - - $result=""; - try { - if(curl_errno($ch)) { - $result=curl_error($ch); - // print curl_error($ch); - } else { - curl_close($ch); - - $res = explode('', $resdata)[1]; - $res = explode('', $res)[0]; - - $xmlObject = simplexml_load_string($res); - $jsonData = json_encode($xmlObject); - $result = json_decode($jsonData, true); + if(!$resdata==""){ + $result=""; + try { + if(curl_errno($ch)) { + $result=curl_error($ch); + // print curl_error($ch); + } else { + curl_close($ch); + + $res = explode('', $resdata)[1]; + $res = explode('', $res)[0]; + + $xmlObject = simplexml_load_string($res); + $jsonData = json_encode($xmlObject); + $result = json_decode($jsonData, true); + } + }catch (Exception $e) { + $result = $e->getMessage(); } - }catch (Exception $e) { - $result = $e->getMessage(); + }else{ + $result=$resdata; } + + LogService::CheckTableName(); date_default_timezone_set('PRC'); $table_name='zz_request_log_' . date('ym'); diff --git a/Laravel/app/Services/Admin/YeWu/AppointmentService.php b/Laravel/app/Services/Admin/YeWu/AppointmentService.php index ed1af3b..b50e2b7 100644 --- a/Laravel/app/Services/Admin/YeWu/AppointmentService.php +++ b/Laravel/app/Services/Admin/YeWu/AppointmentService.php @@ -99,7 +99,7 @@ class AppointmentService $result['msg']='已体检过'; $result['info']=$c; }else{ - + $gongwei= self::CheckGongWei($name,$id_card_num); if( $gongwei['status']===false) { $result['status'] = false; @@ -137,7 +137,7 @@ class AppointmentService $url = config('app.globals.GongWeiBaseUrl'); $res=\Yz::XmlHttp($SendData,$url); //如果没有返回queryCheckUp节点,返回异常 - if(!isset($res['queryCheckUp'])) { + if(!isset($res['queryCheckUp']) and $res!="") { $result['status']=false; $result['msg']='公卫接口异常'; $result['GongWeiinfo']=$res; @@ -159,7 +159,12 @@ class AppointmentService }else{ $result['status']=true; $result['msg']='公卫无记录'; - $result['GongWeiinfo']=$res['queryCheckUp']; + if( $res=="" or $res==null){ + $result['GongWeiinfo']="公卫返回空"; + }else{ + $result['GongWeiinfo']=$res['queryCheckUp']; + } + } return $result; }