From a3380a68c953bf11700aff2fd43d31b57d7e7097 Mon Sep 17 00:00:00 2001 From: cyc Date: Wed, 17 Oct 2018 16:32:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=94=E7=89=9B=E6=97=A5=E5=BF=97=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=AE=B0=E5=BD=95=E7=BC=93=E5=AD=98=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tuniu/controllers/tuniu_train.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/application/third_party/tuniu/controllers/tuniu_train.php b/application/third_party/tuniu/controllers/tuniu_train.php index 56556403..c8f64aeb 100644 --- a/application/third_party/tuniu/controllers/tuniu_train.php +++ b/application/third_party/tuniu/controllers/tuniu_train.php @@ -64,7 +64,7 @@ class Tuniu_train extends CI_Controller{ $api_start_time = microtime(true); $back_data = post_tuniu($url,$post_data,$method = 'POST'); - + $back_data = null; //接口结束时间 $api_end_time = microtime(true); @@ -79,9 +79,6 @@ class Tuniu_train extends CI_Controller{ $retrun_code = '404'; $return_msg = '途牛接口未响应'; } - //记录数据格式 |出发站|到达站|发车时间|接口响应时间|接口返回代码|接口返回信息 - log_message('error','tuniutrain|'.$fromStation.'|'.$toStation.'|'.$date.'|'.$api_responsive_time.'|'.$retrun_code.'|'.$return_msg); - if(isset($tn_info->data)){ if(empty(json_decode($back_data)->data)){ @@ -100,13 +97,23 @@ class Tuniu_train extends CI_Controller{ $trainCache = $this->tuniuprice_model->get_train_cache($fromStation,$toStation); if(!empty($trainCache)){ $back_data = $trainCache->tpc_content; - $isCache = true; + $cachedata = true; }else{ $back_data = null; + $cachedata = false; } } } + if($cachedata){ + $cacheuse = '使用缓存'; + }else{ + $cacheuse = '缓存为空'; + } + + //记录数据格式 |出发站|到达站|发车时间|接口响应时间|接口返回代码|接口返回信息|是否调用缓存 + log_message('error','tuniutrain|'.$fromStation.'|'.$toStation.'|'.$date.'|'.$api_responsive_time.'|'.$retrun_code.'|'.$return_msg.'|'.$cacheuse); + //途牛数据格式转换 $return_data = new stdClass(); $return_data->httpstatus = 200;