From f67786c967863c84d0f33d8e07d7e889621ac553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Thu, 25 Apr 2024 09:23:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E5=94=AE=E6=97=A5=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=87=BA=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trainsystem/controllers/addorders.php | 57 ++++++++++++++----- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/application/third_party/trainsystem/controllers/addorders.php b/application/third_party/trainsystem/controllers/addorders.php index 7d23b3bc..b55013ff 100644 --- a/application/third_party/trainsystem/controllers/addorders.php +++ b/application/third_party/trainsystem/controllers/addorders.php @@ -173,6 +173,13 @@ class addorders extends CI_Controller{ //筛选出能自动出票的订单 $auto_pool = $this->BIZ_train_model->auto_check_ticket_2(); + + // $DepartureDate = strtotime(date('Y-m-d',strtotime("2024-5-9"))); //只取日期部分 + // $now = strtotime(date('Y-m-d')); + // $depart_diff = ($DepartureDate - $now) / 86400; + // $saletime = strtotime("17:00"); + // $sale_diff = (time() - $saletime) / 3600; + //创建一个不允许自动出票的国际火车票数组 $nation_train = array('K19', 'K23', 'Z8701', 'Z8702', 'Z97', 'Z98', 'Z99', 'Z100', 'K9795','D87'); @@ -237,24 +244,44 @@ class addorders extends CI_Controller{ $now = strtotime(date('Y-m-d')); $depart_diff = ($DepartureDate - $now) / 86400; - //如果刚好是第15天的订单 - if($depart_diff==15 && 1==2){ + //如果刚好是第15天的订单(12306的15天预售是算当天的,所以时间差是14天) + if($depart_diff==14){ //$this->isauto = 1; - $time = strtotime(time()); - $autolasttime = $item->ts_autolasttime; - if(($timestamp = strtotime($autolasttime)) !== false) { - $time_diff = ($time - strtotime($autolasttime)) / 3600; - if ($time_diff < 1){ - $auto_flag = 0; - $back_message .= '-预售期每小时只能提交一次'; - } + $time_obj = $this->BIZ_train_model->get_saletime($train_info->DepartAirport_cn); + //print_r($time_obj); + if(!empty($time_obj)){ + $saletime = strtotime($time_obj->TST_saletime); + }else{ + $saletime = strtotime("8:00"); //如果没有设置预售时间,默认8点 } - }else{ //不是预售期的,只能3次抢票 - if ($item->ts_autotimes > 3){ + //echo $saletime; + $sale_diff = (time() - $saletime) / 3600; + if($sale_diff > 1){ $auto_flag = 0; - $back_message .= '-抢票次数已到3次'; - } + $back_message .= '-超过抢票时间'; + }else if($sale_diff <0){ + $auto_flag = 0; + $back_message .= '-未到抢票时间'; + } + + //$time = strtotime(time()); + // $autolasttime = $item->ts_autolasttime; + // if(($timestamp = strtotime($autolasttime)) !== false) { + // $time_diff = ($time - strtotime($autolasttime)) / 3600; + // if ($time_diff < 1){ + // $auto_flag = 0; + // $back_message .= '-预售期每小时只能提交一次'; + // } + // } } + + + //只能3次抢票 + if ($item->ts_autotimes > 3){ + $auto_flag = 0; + $back_message .= '-抢票次数已到3次'; + } + if($auto_flag == 0){ $string .= '汉特订单号:'.$coli_id.'('.$cold_sn.')'.$back_message.''; @@ -263,7 +290,7 @@ class addorders extends CI_Controller{ }else{ //单个订单提交 echo $cold_sn.'
'; - $this->booktickets($cold_sn,$bpe_sn,'','ctrip'); + $this->booktickets($cold_sn,$bpe_sn,'','ctrip'); //调用出票 //$string .= '汉特订单号:'.$coli_id.'('.$cold_sn.')可以自动出票'; } }