|
|
@ -64,7 +64,7 @@ class Tuniu_train extends CI_Controller{
|
|
|
|
$api_start_time = microtime(true);
|
|
|
|
$api_start_time = microtime(true);
|
|
|
|
|
|
|
|
|
|
|
|
$back_data = post_tuniu($url,$post_data,$method = 'POST');
|
|
|
|
$back_data = post_tuniu($url,$post_data,$method = 'POST');
|
|
|
|
|
|
|
|
$back_data = null;
|
|
|
|
//接口结束时间
|
|
|
|
//接口结束时间
|
|
|
|
$api_end_time = microtime(true);
|
|
|
|
$api_end_time = microtime(true);
|
|
|
|
|
|
|
|
|
|
|
@ -79,9 +79,6 @@ class Tuniu_train extends CI_Controller{
|
|
|
|
$retrun_code = '404';
|
|
|
|
$retrun_code = '404';
|
|
|
|
$return_msg = '途牛接口未响应';
|
|
|
|
$return_msg = '途牛接口未响应';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//记录数据格式 |出发站|到达站|发车时间|接口响应时间|接口返回代码|接口返回信息
|
|
|
|
|
|
|
|
log_message('error','tuniutrain|'.$fromStation.'|'.$toStation.'|'.$date.'|'.$api_responsive_time.'|'.$retrun_code.'|'.$return_msg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($tn_info->data)){
|
|
|
|
if(isset($tn_info->data)){
|
|
|
|
if(empty(json_decode($back_data)->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);
|
|
|
|
$trainCache = $this->tuniuprice_model->get_train_cache($fromStation,$toStation);
|
|
|
|
if(!empty($trainCache)){
|
|
|
|
if(!empty($trainCache)){
|
|
|
|
$back_data = $trainCache->tpc_content;
|
|
|
|
$back_data = $trainCache->tpc_content;
|
|
|
|
$isCache = true;
|
|
|
|
$cachedata = true;
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$back_data = null;
|
|
|
|
$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 = new stdClass();
|
|
|
|
$return_data->httpstatus = 200;
|
|
|
|
$return_data->httpstatus = 200;
|
|
|
|