|
|
|
@ -391,27 +391,35 @@ class search extends CI_Controller{
|
|
|
|
|
$return_json['TrainList'] = array();
|
|
|
|
|
$all_stations = $this->BIZ_intel_train_model->ch_allstations();
|
|
|
|
|
$i = 0;
|
|
|
|
|
//print_r($all_stations);
|
|
|
|
|
$data = array();
|
|
|
|
|
|
|
|
|
|
foreach($all_stations as $item){
|
|
|
|
|
$rule_arr = array();
|
|
|
|
|
if($item->s_country == 'China'){
|
|
|
|
|
$rule_arr = $this->BIZ_intel_train_model->ch_train_rules($item->station_id);
|
|
|
|
|
$todata = new stdClass();
|
|
|
|
|
if($item->fromStationName == 'Beijing West'){
|
|
|
|
|
$item->fromStationName = 'Beijing';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!empty($rule_arr)){
|
|
|
|
|
$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;
|
|
|
|
|
$return_json['TrainList'][$i]['ToStations'][$j]['StationCountry'] = $rule_info->s_country;
|
|
|
|
|
$j++;
|
|
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
if(isset($data[$item->fromStationName])){
|
|
|
|
|
$todata->Message = $item->tsi_Message;
|
|
|
|
|
$todata->Station = $item->toStationName;
|
|
|
|
|
$todata->StationCountry = $item->toStationCountry;
|
|
|
|
|
array_push($data[$item->fromStationName]->ToStations,$todata);
|
|
|
|
|
}else{
|
|
|
|
|
$data[$item->fromStationName] = new stdClass();
|
|
|
|
|
$data[$item->fromStationName]->FromCountry = $item->fromStationName;
|
|
|
|
|
$data[$item->fromStationName]->FromStation = $item->fromStationCountry;
|
|
|
|
|
$data[$item->fromStationName]->ToStations = array();
|
|
|
|
|
$todata->Message = $item->tsi_Message;
|
|
|
|
|
$todata->Station = $item->toStationName;
|
|
|
|
|
$todata->StationCountry = $item->toStationCountry;
|
|
|
|
|
array_push($data[$item->fromStationName]->ToStations,$todata);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//print_r($return_json);
|
|
|
|
|
|
|
|
|
|
foreach ($data as $rules){
|
|
|
|
|
array_push($return_json['TrainList'],$rules);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header('Content-type: application/json');
|
|
|
|
|
print_r(json_encode($return_json));
|
|
|
|
|
}
|
|
|
|
|