修改判空。直接判断整个json应对php warining 错误

hotfix/远程访问多媒体中心
cyc 8 years ago
parent c2baa6dfec
commit 5f11f84d5f

@ -32,22 +32,25 @@ class search extends CI_Controller{
} }
$firstdata = $back_data; $firstdata = $back_data;
$reason = json_decode($back_data)->reason;
$return_data = new stdClass(); $return_data = new stdClass();
$cache = 'no'; $cache = 'no';
if(empty(json_decode($back_data)->result)){
if(empty($back_data)){
$obj = $this->BIZ_train_model->get_train_info($fromStation,$toStation); $obj = $this->BIZ_train_model->get_train_info($fromStation,$toStation);
if($obj){ if($obj){
$back_data = $obj->tpc_content; $back_data = $obj->tpc_content;
$cache = 'yes'; $cache = 'yes';
$this->cache = true; $this->cache = true;
$reason = '接口数据为空,调用缓存';
log_message('error','查询为空的链接:'.$url.'|出错的原因:'.$firstdata.'|调用缓存号:'.$obj->tpc_sn.'|缓存生成的时间:'.$obj->tpc_datetime); log_message('error','查询为空的链接:'.$url.'|出错的原因:'.$firstdata.'|调用缓存号:'.$obj->tpc_sn.'|缓存生成的时间:'.$obj->tpc_datetime);
}else{ }else{
log_message('error','查询为空的链接:'.$url.'|出错的原因:'.$firstdata.'|缓存为空'); log_message('error','查询为空的链接:'.$url.'|出错的原因:'.$firstdata.'|缓存为空');
} }
}else{ }else{
$reason = json_decode($back_data)->reason;
$this->BIZ_train_model->addOrUpdate($fromStation,$toStation,$back_data); $this->BIZ_train_model->addOrUpdate($fromStation,$toStation,$back_data);
} }
$return_data->httpstatus = 200; $return_data->httpstatus = 200;
$return_data->reason = $reason; $return_data->reason = $reason;
$return_data->cache = $cache; $return_data->cache = $cache;

Loading…
Cancel
Save