|
|
|
@ -6,6 +6,11 @@ class search extends CI_Controller{
|
|
|
|
|
|
|
|
|
|
public function __construct(){
|
|
|
|
|
parent::__construct();
|
|
|
|
|
header('Access-Control-Allow-Origin:*');
|
|
|
|
|
header('Access-Control-Allow-Methods:POST, GET');
|
|
|
|
|
header('Access-Control-Max-Age:0');
|
|
|
|
|
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
|
|
|
|
|
header('Access-Control-Allow-Credentials:true');
|
|
|
|
|
$this->start_time = microtime(true);
|
|
|
|
|
$this->load->model("BIZ_train_model");//加载模型
|
|
|
|
|
$this->load->model("BIZ_intel_train_model");//国际火车模型
|
|
|
|
@ -215,12 +220,6 @@ class search extends CI_Controller{
|
|
|
|
|
|
|
|
|
|
//国际火车获取
|
|
|
|
|
public function search_international_train(){
|
|
|
|
|
header('Access-Control-Allow-Origin:*');
|
|
|
|
|
header('Access-Control-Allow-Methods:POST, GET');
|
|
|
|
|
header('Access-Control-Max-Age:0');
|
|
|
|
|
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
|
|
|
|
|
header('Access-Control-Allow-Credentials:true');
|
|
|
|
|
|
|
|
|
|
$trainFrom = $this->input->get_post('trainFrom');
|
|
|
|
|
$trainTo = $this->input->get_post('trainTo');
|
|
|
|
|
$trainDate = $this->input->get_post('trainDate');
|
|
|
|
@ -330,12 +329,6 @@ class search extends CI_Controller{
|
|
|
|
|
|
|
|
|
|
//查询某一趟列车的途径站
|
|
|
|
|
public function search_train_station($train_no){
|
|
|
|
|
header('Access-Control-Allow-Origin:*');
|
|
|
|
|
header('Access-Control-Allow-Methods:POST, GET');
|
|
|
|
|
header('Access-Control-Max-Age:0');
|
|
|
|
|
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
|
|
|
|
|
header('Access-Control-Allow-Credentials:true');
|
|
|
|
|
|
|
|
|
|
if(!$train_no){
|
|
|
|
|
header("HTTP/1.1 404 Not Found");
|
|
|
|
|
exit('{"status":"404","reason":"列车编号为空"}');
|
|
|
|
@ -353,12 +346,6 @@ class search extends CI_Controller{
|
|
|
|
|
|
|
|
|
|
//获取所有的列车信息
|
|
|
|
|
public function get_all_inteltrain(){
|
|
|
|
|
header('Access-Control-Allow-Origin:*');
|
|
|
|
|
header('Access-Control-Allow-Methods:POST, GET');
|
|
|
|
|
header('Access-Control-Max-Age:0');
|
|
|
|
|
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
|
|
|
|
|
header('Access-Control-Allow-Credentials:true');
|
|
|
|
|
|
|
|
|
|
$obj = $this->BIZ_intel_train_model->get_allinteltrain();
|
|
|
|
|
|
|
|
|
|
print_r(json_encode($obj));
|
|
|
|
@ -366,12 +353,6 @@ class search extends CI_Controller{
|
|
|
|
|
|
|
|
|
|
//获取国际火车出发规则
|
|
|
|
|
public function get_station_rules(){
|
|
|
|
|
header('Access-Control-Allow-Origin:*');
|
|
|
|
|
header('Access-Control-Allow-Methods:POST, GET');
|
|
|
|
|
header('Access-Control-Max-Age:0');
|
|
|
|
|
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
|
|
|
|
|
header('Access-Control-Allow-Credentials:true');
|
|
|
|
|
|
|
|
|
|
//获取所有站点的列表
|
|
|
|
|
$return_json = array();
|
|
|
|
|
$return_json['TrainList'] = array();
|
|
|
|
@ -380,16 +361,17 @@ class search extends CI_Controller{
|
|
|
|
|
foreach($all_stations as $item){
|
|
|
|
|
$rule_arr = $this->BIZ_intel_train_model->get_train_rules($item->station_id);
|
|
|
|
|
if(!empty($rule_arr)){
|
|
|
|
|
$return_json['TrainList'][$i]['FromStation'] = $item->s_ename.','.$item->s_country;
|
|
|
|
|
$return_json['TrainList'][$i]['FromStation'] = $item->s_ename;
|
|
|
|
|
$return_json['TrainList'][$i]['FromCountry'] = $item->s_country;
|
|
|
|
|
$return_json['TrainList'][$i]['ToStations'] = array();
|
|
|
|
|
|
|
|
|
|
$j = 0;
|
|
|
|
|
foreach($rule_arr as $rule_info){
|
|
|
|
|
$return_json['TrainList'][$i]['ToStations'][$j]['Message'] = $rule_info->tsi_Message;
|
|
|
|
|
$return_json['TrainList'][$i]['ToStations'][$j]['Station'] = $rule_info->S_ename.','.$rule_info->s_country;
|
|
|
|
|
$return_json['TrainList'][$i]['ToStations'][$j]['Station'] = $rule_info->S_ename;
|
|
|
|
|
$return_json['TrainList'][$i]['ToStations'][$j]['StationCountry'] = $rule_info->s_country;
|
|
|
|
|
$j++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|