diff --git a/application/third_party/ctrip/controllers/ctrip_train.php b/application/third_party/ctrip/controllers/ctrip_train.php index 0262da0e..ee7b6dbb 100644 --- a/application/third_party/ctrip/controllers/ctrip_train.php +++ b/application/third_party/ctrip/controllers/ctrip_train.php @@ -43,7 +43,8 @@ class ctrip_train extends CI_Controller{ $TrainNo = $this->input->get_post('TrainNo'); if(!$date || !$from || !$to){ - exit('传参错误!'); + header("HTTP/1.1 404 Not Found"); + exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}'); }else{ $isCache = false; $iseven = false; @@ -55,10 +56,19 @@ class ctrip_train extends CI_Controller{ $iseven = true; } - //转换三字码为中文 - $from = $this->ctrip_model->ReplaceCodeToName($from)->station_name; - $to = $this->ctrip_model->ReplaceCodeToName($to)->station_name; - + //转换三字码为中文 + $FromCode = $this->ctrip_model->ReplaceCodeToName($from); + $ToCode = $this->ctrip_model->ReplaceCodeToName($to); + + + if(!$FromCode || !$ToCode){ + header("HTTP/1.1 404 Not Found"); + exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}'); + }else{ + $from = $FromCode->station_name; + $to = $ToCode->station_name; + } + //生成请求链接 $TimeStamp = time(); $Sign = md5($TimeStamp.DATAKEY); @@ -74,8 +84,14 @@ class ctrip_train extends CI_Controller{ $ResponseData = json_decode($ResponseJson); $api_responsive_time = $api_end_time - $api_start_time; + //print_r($ResponseData);die(); + + if(empty($ResponseData->Trains)){ + log_message('error','ctrip_trian|status:trains is empty |相应时间:'.$api_responsive_time); + }else{ + log_message('error','ctrip_trian|status:'.$ResponseData->ResponseStatus->Ack.'|相应时间:'.$api_responsive_time); + } - log_message('error','ctrip_trian|status:'.$ResponseData->ResponseStatus->Ack.'|相应时间:'.$api_responsive_time); //定义返回的json $ReturnData = new stdClass();