From ab361415e8fe8ed4f75e4f40dbf4d1934a3e44b2 Mon Sep 17 00:00:00 2001 From: lyt Date: Thu, 18 Oct 2018 10:36:06 +0800 Subject: [PATCH] =?UTF-8?q?tracking:=20=E5=8C=97=E4=BA=AC=E4=B8=A4/?= =?UTF-8?q?=E4=B8=89=E6=97=A5=E6=B8=B8=E4=BA=A7=E5=93=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E4=BF=AE=E6=94=B9;=20=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trippestOrderSync/controllers/api.php | 18 +++++++-- .../trippestOrderSync/libraries/trippest.php | 38 +++++++++++++++++++ .../trippestOrderSync/models/orders_query.php | 1 + 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 webht/third_party/trippestOrderSync/libraries/trippest.php diff --git a/webht/third_party/trippestOrderSync/controllers/api.php b/webht/third_party/trippestOrderSync/controllers/api.php index 78f7311f..6b1dce76 100644 --- a/webht/third_party/trippestOrderSync/controllers/api.php +++ b/webht/third_party/trippestOrderSync/controllers/api.php @@ -7,6 +7,7 @@ class Api extends CI_Controller { parent::__construct(); mb_regex_encoding("UTF-8"); $this->load->helper('array'); + $this->load->library('trippest'); $this->load->model('Orders_query', 'Orders_model'); } @@ -60,6 +61,7 @@ class Api extends CI_Controller { $ret['operation'][$value->GCOD_startDate]['cardriver'][] = $tmp_car; // 出团时间 $ret['operation'][$value->GCOD_startDate]['start_date'] = $value->GCOD_startDate; + $ret['operation'][$value->GCOD_startDate]['end_date'] = $value->GCOD_endDate; } else if ($value->GCOD_operationType === 'guiderOperations') { $tmp_g = array(); @@ -72,19 +74,25 @@ class Api extends CI_Controller { $ret['operation'][$value->GCOD_startDate]['tourguide'][] = $tmp_g; // 出团时间 $ret['operation'][$value->GCOD_startDate]['start_date'] = $value->GCOD_startDate; + $ret['operation'][$value->GCOD_startDate]['end_date'] = $value->GCOD_endDate; } } // 加上行程 $num_index = 0; foreach ($ret['operation'] as $kro => &$vro) { + $vro['start_date_raw'] = $vro['start_date']; $out_datetime = strtotime($vro['start_date']); + $out_datetime2 = strtotime($vro['end_date']); $vro['dateWeek_text'] = date('D', $out_datetime); $vro['dateDay_text'] = date('d', $out_datetime); $vro['dateMonth_text'] = date('M', $out_datetime); $vro['dateYear_text'] = date('Y', $out_datetime); + if ($out_datetime !== $out_datetime2) { + $vro['start_date'] = $vro['start_date'] . " to " . $vro['end_date']; + } $poi = new stdclass(); foreach ($order_project as $kd => $poi_info) { - if (strcmp($vro['start_date'], substr($poi_info->COLD_StartDate, 0, 10) ) === 0) { + if (strcmp($vro['start_date_raw'], substr($poi_info->COLD_StartDate, 0, 10) ) === 0) { if (count((array)$poi)===0) { $poi = $poi_info; } else if ($poi->POI_Hotel == "") { @@ -104,6 +112,10 @@ class Api extends CI_Controller { $vro['cold_date'] = $poi->COLD_StartDate; $vro['cold_enddate'] = $poi->COLD_EndDate; $vro['tour_name'] = $poi->PAG2_Name; + $code_name = $this->trippest->tour_name(strtoupper($poi->pag_code)); + if ($code_name !== "") { + $vro['tour_name'] = $code_name; + } // 领队名字 $vro['leader_name'] = trim($poi->GUT_FirstName . " " . $poi->GUT_LastName); // 行程人数 @@ -155,8 +167,8 @@ class Api extends CI_Controller { $ret['operation'] = array_values($ret['operation']); $ret_operation = array(); foreach ($ret['operation'] as $ko => $vo) { - if (strtotime($vo['start_date']) >= strtotime($vo['cold_date']) - && strtotime($vo['start_date']) <= strtotime($vo['cold_enddate'])) { + if (strtotime($vo['start_date_raw']) >= strtotime($vo['cold_date']) + && strtotime($vo['start_date_raw']) <= strtotime($vo['cold_enddate'])) { unset($vo['cold_date']); unset($vo['cold_enddate']); $ret_operation[] = $vo; diff --git a/webht/third_party/trippestOrderSync/libraries/trippest.php b/webht/third_party/trippestOrderSync/libraries/trippest.php new file mode 100644 index 00000000..b53121b0 --- /dev/null +++ b/webht/third_party/trippestOrderSync/libraries/trippest.php @@ -0,0 +1,38 @@ +ci =& get_instance(); + } + + public function tour_name($pag_code) + { + $name = ""; + switch ($pag_code) { + case 'BJSIC-41': + $name = "One Day Beijing Highlights Tour"; + break; + case 'BJSIC-42': + $name = "Two-Day Beijing Boutique Small Group Tour"; + break; + case 'BJSIC-43': + $name = "Three-Day Beijing Discovery Tour"; + break; + + default: + # code... + break; + } + return $name; + } + + +} + +/* End of file trippest.php */ +/* Location: ./third_party/trippestOrderSync/libraries/trippest.php */ diff --git a/webht/third_party/trippestOrderSync/models/orders_query.php b/webht/third_party/trippestOrderSync/models/orders_query.php index 27c86be8..9cb773f3 100644 --- a/webht/third_party/trippestOrderSync/models/orders_query.php +++ b/webht/third_party/trippestOrderSync/models/orders_query.php @@ -28,6 +28,7 @@ class Orders_query extends CI_Model { { $order_info_sql = "SELECT GCI_SN,GCI_VendorOrderId,GCI_combineNo + ,(select PAG_code from biz_packageinfo where pag_sn=COLD_ServiceSN) as pag_code ,COLI_SN,COLI_ID,COLD_SN,COLI_GroupCode,COLI_OPI_ID,COLI_OrderDetailText,COLI_PriceMemo ,COLD_ServiceSN,COLD_PersonNum,COLD_ChildNum,COLD_StartDate,COLD_EndDate,cold.COLD_MemoText ,pags.PAGS_Direction,pags.PAGS_describ