From 6b0bb394432bf5b6a9827222268b280167369745 Mon Sep 17 00:00:00 2001 From: cyc Date: Thu, 22 Mar 2018 13:37:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=81=AB=E8=BD=A6=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/train/controllers/search.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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){