From ab0522310a7a73c60b1cbd783d47059f8ce71807 Mon Sep 17 00:00:00 2001 From: cyc Date: Fri, 5 Jul 2019 15:49:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8=E5=87=BA?= =?UTF-8?q?=E7=A5=A8=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trainsystem/controllers/addorders.php | 41 ++++++++++--------- .../trainsystem/models/BIZ_train_model.php | 6 +-- 2 files changed, 25 insertions(+), 22 deletions(-) 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 .= '汉特订单号:'.$coli_id.'('.$cold_sn.')'.$back_message.''; }else{ //单个订单提交 diff --git a/application/third_party/trainsystem/models/BIZ_train_model.php b/application/third_party/trainsystem/models/BIZ_train_model.php index 01c2ef1b..ff80ced8 100644 --- a/application/third_party/trainsystem/models/BIZ_train_model.php +++ b/application/third_party/trainsystem/models/BIZ_train_model.php @@ -253,7 +253,7 @@ class BIZ_train_model extends CI_Model { //自动获取符合自动出票要求的订单的coli_sn function auto_check_ticket(){ - $sql = "SELECT distinct top 50 COLD_SN ,coli_id,COLD_SPFS,COLI_State + $sql = "SELECT distinct top 50 COLD_SN ,coli_id,COLD_SPFS,COLI_State,GAI_Type FROM BIZ_ConfirmLineInfo bcli inner join BIZ_ConfirmLineDetail bcld on COLD_COLI_SN=COLI_SN LEFT JOIN BIZ_GroupAccountInfo bgai @@ -261,8 +261,8 @@ class BIZ_train_model extends CI_Model { WHERE bcli.COLI_ServiceType = '2' AND bcli.COLI_State in ('11','13','8','63') AND bcli.COLI_WebCode in ('cht', 'JP', 'train_it', 'VC', 'train_ru','GM-Train','SHT','CT','WebMob-biz','WeChat-biz') - AND (bcli.COLI_Price - bgai.GAI_SQJE) <= 20 - AND (bcli.COLI_Price - bgai.GAI_SQJE) >= 0 + AND (bcli.COLI_Price - bgai.GAI_Money) <= 20 + AND (bgai.GAI_Money - bcli.COLI_Price) >= 0 AND bcli.DeleteFlag = 0 AND bgai.DeleteFlag = 0 AND bcld.DeleteFlag = 0