优化修改

mobile-first
cyc 6 years ago
parent f5448f6c72
commit da23c21279

@ -20,6 +20,35 @@ class innerTrainSearch extends CI_Controller{
exit('你走错了!');
}
//查询选择
public function search(){
//接收参数
$date = $this->input->get_post('date');
$from = $this->input->get_post('from');
$to = $this->input->get_post('to');
if(!$date || !$from || !$to){
header("HTTP/1.1 404 Not Found");
exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}');
}else{
//根据选择的接口供应商调用对应的接口,默认使用携程的接口
$supplier = $this->input->get_post('supplier');
switch ($supplier){
case 'juhe':
$this->juheApi($date,$from,$to);
break;
case 'ctrip':
$this->ctripApi($date,$from,$to);
break;
default :
$this->ctripApi($date,$from,$to);
break;
}
}
}
//聚合数据接口
public function juheApi($train_date=null,$fromStation=null,$toStation=null){
//定义一些变量
$flag = true;
@ -79,8 +108,9 @@ class innerTrainSearch extends CI_Controller{
function createTrainJson($returnjson){
$return_data = new stdClass();
$return_data->data = new stdClass();
$return_data->httpstatus = 200;
$return_data->seveth = $this->seveth;
$return_data->data->httpstatus = 200;
$return_data->data->seveth = $this->seveth;
$return_data->data->supplier = 'juhe';
$return_data->data->result = array();
$return_data->data->map = new stdClass();
$obj = array();
@ -174,16 +204,8 @@ class innerTrainSearch extends CI_Controller{
return json_encode($return_data);
}
//携程数据接口
public function ctripApi($date=null,$from=null,$to=null,$return=false){
//接收参数
if(!$date && !$from && !$to){
$date = $this->input->get_post('date');
$from = $this->input->get_post('from');
$to = $this->input->get_post('to');
}
$TrainNo = $this->input->get_post('TrainNo');
if(!$date || !$from || !$to){
header("HTTP/1.1 404 Not Found");
exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}');
@ -240,6 +262,7 @@ class innerTrainSearch extends CI_Controller{
$ReturnData->data = new stdClass();
$ReturnData->data->seven = $iseven;
$ReturnData->data->cache = $isCache;
$ReturnData->data->supplier = 'ctrip';
$ReturnData->data->result = array();
$ReturnData->data->map = new stdClass();
$obj = array();
@ -367,7 +390,6 @@ class innerTrainSearch extends CI_Controller{
}else{
echo json_encode($ReturnData);
}
}
}
@ -479,6 +501,7 @@ class innerTrainSearch extends CI_Controller{
}
}
//火车移动端数据接口
public function get_train(){
$train_date = $this->input->get('date');
$fromStation = $this->input->get('from');

Loading…
Cancel
Save