From f7228512b833f659aa63e430b03e59de57b1c86f Mon Sep 17 00:00:00 2001 From: cyc Date: Fri, 15 Jun 2018 10:48:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= 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, 11 insertions(+), 4 deletions(-) diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php index e15413fe..e5bc5de0 100644 --- a/application/third_party/train/controllers/search.php +++ b/application/third_party/train/controllers/search.php @@ -47,7 +47,7 @@ class search extends CI_Controller{ //我们的接口相应时间 $responsive_time = $end_time - $this->start_time; - log_message('error','TRAINSPEED|请求url:'.$this->url.'|聚合相应时间:'.$api_responsive_time.'s|接口运行时间:'.$responsive_time.'s'); + log_message('error','TRAINSPEED|请求url:'.$this->url.'|聚合相应时间:'.$api_responsive_time.'s|接口运行时间:'.$responsive_time.'s|缓存:'.$this->cache.'|+7天:'.$this->seveth); print_r($trainjson); } @@ -72,9 +72,16 @@ class search extends CI_Controller{ //缓存处理模块(包含缓存处理) function dataOperate($search_return,$fromStation,$toStation){ - $this->reason = json_decode($search_return)->reason; - $this->cache = 'no'; - if(!empty($search_return) && !empty(json_decode($search_return)->result)){ + //首先判断聚合返回的数据是否为空 + if(empty($search_return)){ + $this->reason = '聚合接口没有响应'; + $this->cache = 'yes'; + }else{ + $this->reason = json_decode($search_return)->reason; + $this->cache = 'no'; + } + + if(!empty(json_decode($search_return)->result)){ $this->BIZ_train_model->addOrUpdate($fromStation,$toStation,$search_return); $operate_data = $search_return; }else{