From 8774adaf1fd55bcc5929481306608b262633cf78 Mon Sep 17 00:00:00 2001 From: lyt Date: Wed, 22 Aug 2018 11:53:42 +0800 Subject: [PATCH] =?UTF-8?q?trippest=20=E6=9F=A5=E8=AF=A2:=E6=8E=A5?= =?UTF-8?q?=E9=80=81=E4=BF=A1=E6=81=AF=E8=A1=A5=E5=85=85,=20=E4=BB=8EHT?= =?UTF-8?q?=E5=AD=90=E8=AE=A2=E5=8D=95=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trippestOrderSync/controllers/api.php | 41 +++++++++++++++---- .../trippestOrderSync/models/orders_model.php | 21 ++++++---- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/webht/third_party/trippestOrderSync/controllers/api.php b/webht/third_party/trippestOrderSync/controllers/api.php index e196c767..668bdda4 100644 --- a/webht/third_party/trippestOrderSync/controllers/api.php +++ b/webht/third_party/trippestOrderSync/controllers/api.php @@ -74,19 +74,32 @@ class Api extends CI_Controller { } } // 加上行程 + $num_index = 0; foreach ($ret['operation'] as $kro => &$vro) { $out_datetime = strtotime($vro['start_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); - $poi = $order_project[0]; + $poi = new stdclass(); foreach ($order_project as $kd => $poi_info) { if (strcmp($vro['start_date'], substr($poi_info->COLD_StartDate, 0, 10) ) === 0) { - $poi = $poi_info; - break; + if (count((array)$poi)===0) { + $poi = $poi_info; + } else if ($poi->POI_Hotel == "") { + $poi->POI_Hotel = $poi_info->POI_Hotel; + $poi->POI_HotelAddress = $poi_info->POI_HotelAddress; + $poi->POI_HotelPhone = $poi_info->POI_HotelPhone; + // } else if ($poi->POI_FlightsNo == "") { + } else if ($poi_info->POI_FlightsNo != "" && $poi_info->COLD_SN != $poi->COLD_SN) { + $poi->POI_FlightsNo .= "; " . $poi_info->POI_FlightsNo; + // $poi->POI_AirPort .= "; " . $poi_info->POI_AirPort; + } } } + if (count((array)$poi)===0) { + $poi = $order_project[0]; + } $vro['cold_date'] = $poi->COLD_StartDate; $vro['cold_enddate'] = $poi->COLD_EndDate; $vro['tour_name'] = $poi->PAG2_Name; @@ -113,14 +126,26 @@ class Api extends CI_Controller { $vro['pick_up'] = ""; $vro['drop_off'] = ""; $decode_MemoText = $memo_text_tmp = ""; - if ($poi->COLD_MemoText != null && json_decode($poi->COLD_MemoText) != null) { - $decode_MemoText = json_decode($poi->COLD_MemoText, true); - $vro['pick_up'] = $decode_MemoText['Pick up']; - $vro['drop_off'] = $decode_MemoText['Drop off']; - } else { + if ($num_index == 0) { $vro['pick_up'] = trim(substr(strstr(strstr($poi->COLI_OrderDetailText, "Pick Up From:"), "\n", true), 13)); $vro['drop_off'] = trim(substr(strstr(strstr($poi->COLI_OrderDetailText, "Drop Off:"), "\n" , true), 9)); } + // if ($vro['pick_up'] === "") { + if (strval($poi->PAGS_Direction) === '0') { + $vro['pick_up'] .= $poi->POI_FlightsNo . " " . $poi->POI_AirPort; + $vro['drop_off'] .= $poi->POI_Hotel; + } else if (strval($poi->PAGS_Direction) === '1') { + $vro['pick_up'] .= $poi->POI_Hotel; + $vro['drop_off'] .= $poi->POI_FlightsNo . " " . $poi->POI_AirPort; + } else { // if ($poi->POI_FlightsNo != "") + $vro['pick_up'] .= $poi->POI_Hotel; + // $vro['drop_off'] .= $poi->POI_FlightsNo . " " . $poi->POI_AirPort; // 结束后送机 + } + // } + // if ($vro['pick_up'] === "" && $poi->POI_FlightsNo == '') { + // $vro['pick_up'] = $vro['drop_off'] = $poi->POI_Hotel; + // } + $num_index++; } unset($vro); } diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php index 71515311..579f3fb8 100644 --- a/webht/third_party/trippestOrderSync/models/orders_model.php +++ b/webht/third_party/trippestOrderSync/models/orders_model.php @@ -1303,6 +1303,7 @@ class Orders_model extends CI_Model { GCI_SN,GCI_VendorOrderId,GCI_combineNo ,COLI_SN,COLI_ID,COLD_SN,COLI_GroupCode,COLI_OPI_ID,COLI_OrderDetailText ,COLD_ServiceSN,COLD_PersonNum,COLD_ChildNum,COLD_StartDate,COLD_EndDate,cold.COLD_MemoText + ,pags.PAGS_Direction,pags.PAGS_describ ,pag2.PAG2_Name ,poi.POI_Hotel,poi.POI_HotelAddress,poi.POI_HotelPhone ,poi.POI_AirPort,poi.POI_FlightsNo @@ -1313,19 +1314,21 @@ class Orders_model extends CI_Model { inner join BIZ_PackageOrderInfo poi on poi.POI_COLD_SN=COLD_SN inner join BIZ_GUEST g on g.GUT_SN=COLI_GUT_SN inner join BIZ_PackageInfo2 pag2 on pag2.PAG2_PAG_SN=COLD_ServiceSN and pag2.PAG2_LGC=1 + left join BIZ_PackageInfoSub pags on pags.PAGS_SN=cold.COLD_ServiceSN2 where COLI_GroupCode like '%" . $this->HT->escape_like_str($COLI_ID) . "%' - OR COLI_ID like '%" . $this->HT->escape_like_str($COLI_ID) . "%'"; + OR COLI_ID like '%" . $this->HT->escape_like_str($COLI_ID) . "%' + order by COLD_StartDate asc"; // OR COLI_ID like '%" . $this->HT->escape_like_str($COLI_ID) . "%' $order_info_query = $this->HT->query($order_info_sql); $ret = $order_info_query->result(); - if ($order_info_query->num_rows() > 0) { - // $operation_sql = "SELECT gcod.* - // from GroupCombineOperationDetail gcod - // where GCOD_GCI_combineNo=? - // and gcod.GCOD_operationType in ('touristCarOperations','guiderOperations')"; - // $operation_info = $this->HT->query($operation_sql, array($ret['order_info'][0]->GCI_combineNo)); - // $ret['operation_info'] = $operation_info->result(); - } + // if ($order_info_query->num_rows() > 0) { + // $operation_sql = "SELECT gcod.* + // from GroupCombineOperationDetail gcod + // where GCOD_GCI_combineNo=? + // and gcod.GCOD_operationType in ('touristCarOperations','guiderOperations')"; + // $operation_info = $this->HT->query($operation_sql, array($ret['order_info'][0]->GCI_combineNo)); + // $ret['operation_info'] = $operation_info->result(); + // } return $ret; }