diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php index 4a3bfe8f..a14a54a0 100644 --- a/application/third_party/train/controllers/search.php +++ b/application/third_party/train/controllers/search.php @@ -14,6 +14,7 @@ class search extends CI_Controller{ //定义一些变量 $flag = true; $juheTrainInfo = ''; + set_time_limit(0); //判断数据是否合法 @@ -46,10 +47,11 @@ class search extends CI_Controller{ $this->train_date = $train_date; $now_time = time(); $differ_time = (strtotime($train_date) - $now_time) / 86400; + $this->seveth = 'no'; //屏蔽掉超过预售期的搜索,提高速度 if($differ_time > 29){ $train_date = date('Y-m-d',strtotime('+7day')); - $this->seventh = true; + $this->seveth = 'yes'; } $url = 'http://139.129.246.118:12309/trainTickets/ticketsAvailable?key='.JUHE_TRAIN_API_KEY.'&train_date='.$train_date.'&from_station='.$fromStation.'&to_station='.$toStation; $this->url = $url; @@ -98,6 +100,7 @@ class search extends CI_Controller{ $return_data->httpstatus = 200; $return_data->reason = $this->reason; $return_data->cache = $this->cache; + $return_data->seveth = $this->seveth; $return_data->data->result = array(); $return_data->data->map = new stdClass(); $obj = array(); @@ -212,14 +215,8 @@ class search extends CI_Controller{ //余票转换 function ticket_exchange($num){ - if($this->cache == 'yes'){ - $time = strtotime($this->train_date) - time(); - $day = $time / 86400; - if($day > 15){ - return '有'; - }else{ - return $num; - } + if($this->cache == 'yes' || $this->seveth == 'yes'){ + return '有'; }else{ if(is_numeric($num)){ if($num == 0){