diff --git a/application/third_party/train/models/BIZ_train_model.php b/application/third_party/train/models/BIZ_train_model.php index 004208cc..e7908e4e 100644 --- a/application/third_party/train/models/BIZ_train_model.php +++ b/application/third_party/train/models/BIZ_train_model.php @@ -59,15 +59,21 @@ class BIZ_train_model extends CI_Model { AND tpc_to_station = '$tpc_to_station'"; $query = $this->INFO->query($sql); - $cache_time = strtotime($query->row()->tpc_datetime); - $now_time = time(); - $differ_time = ($now_time - $cache_time) / 86400; - if($differ_time >= 7){ - $this->delete_traincache($tpc_from_station,$tpc_to_station); - return null; + + if($query->row()){ + $cache_time = strtotime($query->row()->tpc_datetime); + $now_time = time(); + $differ_time = ($now_time - $cache_time) / 86400; + if($differ_time >= 7){ + $this->delete_traincache($tpc_from_station,$tpc_to_station); + return null; + }else{ + return $query->row(); + } }else{ - return $query->row(); + return null; } + } //删除缓存操作