|
|
|
@ -47,7 +47,8 @@ class BIZ_train_model extends CI_Model {
|
|
|
|
|
return $query;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取价格
|
|
|
|
|
//获取缓存的火车信息
|
|
|
|
|
//如果读取到缓存是7天以前的数据就不返回任何数据,并且将其删除。
|
|
|
|
|
public function get_train_info($tpc_from_station,$tpc_to_station){
|
|
|
|
|
$sql = "SELECT
|
|
|
|
|
*
|
|
|
|
@ -57,10 +58,28 @@ class BIZ_train_model extends CI_Model {
|
|
|
|
|
tpc_from_station = '$tpc_from_station'
|
|
|
|
|
AND
|
|
|
|
|
tpc_to_station = '$tpc_to_station'";
|
|
|
|
|
$query = $this->INFO->query($sql);
|
|
|
|
|
return $query->row();
|
|
|
|
|
$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;
|
|
|
|
|
}else{
|
|
|
|
|
return $query->row();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除缓存操作
|
|
|
|
|
function delete_traincache($tpc_from_station,$tpc_to_station){
|
|
|
|
|
$sql = "DELETE FROM
|
|
|
|
|
TrainPriceCache
|
|
|
|
|
WHERE
|
|
|
|
|
tpc_from_station = '$tpc_from_station'
|
|
|
|
|
AND
|
|
|
|
|
tpc_to_station = '$tpc_to_station'";
|
|
|
|
|
$query = $this->INFO->query($sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function biz_order_detail($cold_sn) {
|
|
|
|
|
$sql = "
|
|
|
|
|