diff --git a/application/third_party/ctrip/controllers/ctrip_train.php b/application/third_party/ctrip/controllers/ctrip_train.php index d6456d3e..a45257d0 100644 --- a/application/third_party/ctrip/controllers/ctrip_train.php +++ b/application/third_party/ctrip/controllers/ctrip_train.php @@ -57,16 +57,16 @@ class ctrip_train extends CI_Controller{ } //转换三字码为中文 - $FromCode = $this->ctrip_model->ReplaceCodeToName($from); - $ToCode = $this->ctrip_model->ReplaceCodeToName($to); + $FromName = $this->ctrip_model->ReplaceCodeToName($from); + $ToName = $this->ctrip_model->ReplaceCodeToName($to); - if(!$FromCode || !$ToCode){ + if(!$FromName || !$ToName){ 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; + $from = $FromName->station_name; + $to = $ToName->station_name; } //生成请求链接 @@ -204,7 +204,7 @@ class ctrip_train extends CI_Controller{ } //查询经停站 - public function GetStopStation(){ + public function getstopstation(){ //接收参数 $DepartDate = $this->input->get_post('DepartDate'); $TrainNo = $this->input->get_post('TrainNo'); @@ -250,7 +250,7 @@ class ctrip_train extends CI_Controller{ } //获取所有站点信息 - public function GetAllStation(){ + public function getallstation(){ //生成请求参数 $TimeStamp = time(); $Sign = md5($TimeStamp.DATAKEY); @@ -272,20 +272,31 @@ class ctrip_train extends CI_Controller{ } } - //获取回调信息 - public function receiveinfo(){ - echo ' - - - - hainatravel123 - - - - '; - $back_xml = file_get_contents('php://input'); - $xml = simplexml_load_string($back_xml); - $json = json_encode($xml); - log_message('error','携程回调信息:'.$json); + //查询中转方案 + public function gettraintrainsfer(){ + $FromCode = $this->input->get_post('FromCode'); + $ToCode = $this->input->get_post('ToCode'); + $DepartDate = $this->input->get_post('DepartDate'); + + if(!$FromCode || !$ToCode || !$DepartDate){ + exit('传参错误!'); + }else{ + $TimeStamp = time(); + $Sign = md5($TimeStamp.DATAKEY); + + $FromName = $this->ctrip_model->ReplaceCodeToName($FromCode); + $ToName = $this->ctrip_model->ReplaceCodeToName($ToCode); + + $From = $FromName->station_name; + $To = $ToName->station_name; + + $url = JSONRETURN.'GetTrainTransfer?User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign.'&From='.$From.'&To='.$To.'&DepartDate='.$DepartDate; + + echo $url; + + $ResponseJson = post_ctrip($url,'','GET'); + $ResponseData = json_decode($ResponseJson); + print_r($ResponseData); + } } } \ No newline at end of file