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;