From 5f11f84d5f93359d928d7add00a920c3b579150b Mon Sep 17 00:00:00 2001 From: cyc Date: Tue, 2 Jan 2018 15:43:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E7=A9=BA=E3=80=82?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=88=A4=E6=96=AD=E6=95=B4=E4=B8=AAjson?= =?UTF-8?q?=E5=BA=94=E5=AF=B9php=20warining=20=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/third_party/train/controllers/search.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php index 2fa87347..a286b08c 100644 --- a/application/third_party/train/controllers/search.php +++ b/application/third_party/train/controllers/search.php @@ -32,22 +32,25 @@ class search extends CI_Controller{ } $firstdata = $back_data; - $reason = json_decode($back_data)->reason; $return_data = new stdClass(); $cache = 'no'; - if(empty(json_decode($back_data)->result)){ + + if(empty($back_data)){ $obj = $this->BIZ_train_model->get_train_info($fromStation,$toStation); if($obj){ $back_data = $obj->tpc_content; $cache = 'yes'; $this->cache = true; + $reason = '接口数据为空,调用缓存'; log_message('error','查询为空的链接:'.$url.'|出错的原因:'.$firstdata.'|调用缓存号:'.$obj->tpc_sn.'|缓存生成的时间:'.$obj->tpc_datetime); }else{ log_message('error','查询为空的链接:'.$url.'|出错的原因:'.$firstdata.'|缓存为空'); } }else{ + $reason = json_decode($back_data)->reason; $this->BIZ_train_model->addOrUpdate($fromStation,$toStation,$back_data); } + $return_data->httpstatus = 200; $return_data->reason = $reason; $return_data->cache = $cache;