diff --git a/application/third_party/trainsystem/controllers/addorders.php b/application/third_party/trainsystem/controllers/addorders.php index 90173455..d10c8140 100644 --- a/application/third_party/trainsystem/controllers/addorders.php +++ b/application/third_party/trainsystem/controllers/addorders.php @@ -25,15 +25,17 @@ class addorders extends CI_Controller{ //log_message('error','auto ticket'); date_default_timezone_set('Asia/Shanghai'); //判断账户余额,如果小于1000自动退出。 - $post_data = array("key"=>JUHE_TRAIN_API_KEY); + /*$post_data = array("key"=>JUHE_TRAIN_API_KEY); $back_data = GetPost_http("http://op.juhe.cn/trainTickets/balance.php",$post_data); $price = json_decode($back_data)->result; print_r('账户余额:'.$price); if($price < 1000){ exit('账户余额不足'); - } + }*/ //筛选出能自动出票的订单 $auto_pool = $this->BIZ_train_model->auto_check_ticket(); + print_r($auto_pool); + die(); //创建一个不允许自动出票的国际火车票数组 $nation_train = array('K19', 'K23', 'Z8701', 'Z8702', 'Z97', 'Z98', 'Z99', 'Z100', 'K9795'); @@ -46,32 +48,32 @@ class addorders extends CI_Controller{ $back_message = ''; $cold_sn = $item->COLD_SN; $coli_id = $item->coli_id; - $back_data = 1; + $auto_flag = 1; $people_arr = $this->BIZ_train_model->biz_people($cold_sn); $train_info = $this->BIZ_train_model->get_biz_foi($cold_sn); if($item->COLD_SPFS > 1){ //寄送票 - $back_data = 0; + $auto_flag = 0; $back_message .= '-邮寄不自动出票'; } //乘客人数大于5人不出票 if(count($people_arr) > 5){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-乘客人数大于5不自动出票'; } //护照号如果在黑名单的就不自动出票 foreach($people_arr as $people_info){ if(in_array($people_info->BPE_Passport,$black_list)){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-此用户为黑名单用户,不自动出票'; } if(strlen($people_info->BPE_Passport) >= 18){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-护照位数大于18不自动出票'; } @@ -79,27 +81,29 @@ class addorders extends CI_Controller{ } $bpe_sn = substr($bpe_sn,0,strlen($bpe_sn)-1); - //单张票价不能大于1000人民币 - if($train_info[0]->adultcost > 1000){ - $back_data = 0; - $back_message .= '-单价大于1000不自动出票'; + //不是国内支付宝的付款方式的订单需要受到1000元单价限制 + if($item->GAI_Type != '15015' || $item->COLI_State != '8'){ + if($train_info[0]->adultcost > 1000){ + $auto_flag = 0; + $back_message .= '-单价大于1000不自动出票'; + } } //如果为国际火车票就不出票 if(in_array($train_info[0]->FlightsNo, $nation_train)){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-国际火车票不自动出票'; } //无座的订单不做出票 if($train_info[0]->Aircraft == 'WZ'){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-无座不自动出票'; } //香港火车不自动出票 if($train_info[0]->DepartAirport == 'XJA'){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-香港火车不自动出票'; } @@ -108,13 +112,12 @@ class addorders extends CI_Controller{ $depart_diff = ($DepartureDate - $time) / 86400; if($train_info[0]->ArrivalAirport == 'XJA' && $train_info[0]->adultcost > 500 && $depart_diff > 5){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-内地香港火车金额大于500超过五天不自动出票'; } //print_r($train_info); //如果刚好是第三十天的订单 - echo $item->COLI_State; if(($item->COLI_State == '8' || $item->COLI_State == '63')){ $this->isauto = 3; $time_obj = $this->BIZ_train_model->get_saletime($train_info['0']->DepartAirport_cn); @@ -124,16 +127,16 @@ class addorders extends CI_Controller{ //echo $saletime; $sale_diff = (time() - $saletime) / 3600; if($sale_diff > 1){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-超过抢票时间'; }else if($sale_diff <0){ - $back_data = 0; + $auto_flag = 0; $back_message .= '-未到抢票时间'; } } } - if($back_data == 0){ + if($auto_flag == 0){ $string .= '