From 3dd74efcd5b36407e6969041a61f1e53f3456873 Mon Sep 17 00:00:00 2001 From: lyt Date: Tue, 8 May 2018 16:50:33 +0800 Subject: [PATCH] =?UTF-8?q?trippest=20=E5=9B=A2=E5=90=8D=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/TulanduoApi.php | 31 ++++++++++--------- .../trippestOrderSync/models/orders_model.php | 4 +-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php index ac6f3bfb..f71c0893 100644 --- a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php +++ b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php @@ -76,6 +76,7 @@ class TulanduoApi extends CI_Controller */ public function get_orderlist() { + log_message('error','get_orderlist From TuLanDuo ' ); $startOrderDate = date('Y-m-d', strtotime("-2 days")); $endOrderDate = date('Y-m-d'); $this->tld_order->setUserId($this->userId) @@ -149,12 +150,12 @@ class TulanduoApi extends CI_Controller $COLD_MemoText = raw_json_encode(array("Pick up"=>$vo['toTraffic'], "Drop off"=>$vo['backTraffic'])); $this->Orders_model->BIZ_COLI_SN = $this->Orders_model->GRI_SN = $this->Orders_model->GCI_SN = null; - $tmpv = empty($this->city_info[$vo['operationDep']]) ? 1343 : $this->city_info[$vo['operationDep']]['PlanVEI_SN']; + $tmpv = $this->city_info[$vo['operationDep']]['PlanVEI_SN'] ? $this->city_info[$vo['operationDep']]['PlanVEI_SN'] : 1343; $this->Orders_model->get_SN_by_vendorOrderId($vo['orderId'], $tmpv); // 查询订单是否已经录入过 if ($this->Orders_model->BIZ_COLI_SN === null && in_array($vo['agcName'], array("D目的地桂林组"))) { $real_groupCode = $this->analysis_groupCode($vo['agcOrderNo']); // set BIZ_COLI_SN, GRI_SN at Orders_model - $this->Orders_model->get_SN_by_groupCode($real_groupCode); + $this->Orders_model->get_SN_by_groupCode($real_groupCode, mb_substr($vo["agcName"] . $vo['agcOrderNo'], 0, 19)); } /** insert HT */ if ($this->Orders_model->BIZ_COLI_SN === null) { @@ -165,9 +166,9 @@ class TulanduoApi extends CI_Controller $travelDate = new DateTime($vo['travelDate']); $leaveDate = new DateTime($vo['leaveDate']); $date_diff = $travelDate->diff($leaveDate); - $this->Orders_model->GRI_No = $vo['agcOrderNo']; + $this->Orders_model->GRI_No = mb_substr($vo['agcOrderNo'], 0, 19); $this->Orders_model->GRI_OrderType = 227002; // 商务 - $this->Orders_model->GRI_Name = $vo["agcName"] . $vo['agcOrderNo']; + $this->Orders_model->GRI_Name = mb_substr($vo["agcName"] . $vo['agcOrderNo'], 0, 19); $this->Orders_model->GRI_PersonNum = $vo['adultNum']+$vo['childNum']; $this->Orders_model->GRI_Days = intval($date_diff->format('%R%a')+1); $this->Orders_model->GRI_IsCancel = 0; @@ -184,7 +185,7 @@ class TulanduoApi extends CI_Controller $this->Orders_model->BIZ_COLI_servicetype = 'D'; $this->Orders_model->BIZ_COLI_ConfirmType = 52001; $this->Orders_model->BIZ_COLI_Memo = ""; - $this->Orders_model->BIZ_COLI_OrderDetailText = "来自图兰朵系统同步测试" . $vo["orderId"] . ";线路:" . $vo['routeName']; + $this->Orders_model->BIZ_COLI_OrderDetailText = "来自图兰朵系统同步测试" . $vo["orderId"] . ";线路:" . $vo['routeName'] . "; 团名: " . $vo['agcOrderNo']; $this->Orders_model->BIZ_COLI_GUT_SN = $this->Orders_model->BIZ_GUT_SN ? $this->Orders_model->BIZ_GUT_SN : null; $coli_sn[] = $this->Orders_model->biz_confirm_save(); /**BIZ_ConfirmLineDetail*/ @@ -199,7 +200,7 @@ class TulanduoApi extends CI_Controller $this->Orders_model->COLD_ChildNum = $vo['childNum']; $this->Orders_model->cold_state = $vo['orderStatus']==1 ? 7 : 4; // 7已确认 // 4 下计划未确认 $this->Orders_model->DeleteFlag = 0; - $this->Orders_model->COLD_PlanVEI_SN = empty($this->city_info[$vo['operationDep']]) ? 1343 : $this->city_info[$vo['operationDep']]['PlanVEI_SN']; + $this->Orders_model->COLD_PlanVEI_SN = $this->city_info[$vo['operationDep']]['PlanVEI_SN'] ? $this->city_info[$vo['operationDep']]['PlanVEI_SN'] : 1343; $this->Orders_model->COLD_MemoText = $COLD_MemoText; $this->Orders_model->biz_confirm_detail_save(); /** SP_BIZ_Arrange @@ -237,6 +238,7 @@ class TulanduoApi extends CI_Controller */ public function insert_HT_order_operation($coli_sn=null) { + log_message('error','get_order_operation From TuLanDuo '); $this->load->model('Order_update'); if ($coli_sn !== null) { $to_update_list = $this->Orders_model->get_groupCombineInfo($coli_sn); @@ -294,8 +296,8 @@ class TulanduoApi extends CI_Controller /** UPDATE */ /** BIZ_ConfirmLineInfo */ $this->Order_update->coli_where_update = " COLI_SN=" . $order->COLI_SN; - $old_memo = mb_strstr($order->COLI_Memo, "orderRemark", true) ? mb_strstr($order->COLI_Memo, "orderRemark", true) : $order->COLI_Memo; - $old_detail = mb_strstr($order->COLI_OrderDetailText, "operations", true) ? mb_strstr($order->COLI_OrderDetailText, "operations", true) : $order->COLI_OrderDetailText; + $old_memo = mb_strstr($order->COLI_Memo, "orderRemark", true)!==false ? mb_strstr($order->COLI_Memo, "orderRemark", true) : $order->COLI_Memo; + $old_detail = mb_strstr($order->COLI_OrderDetailText, "operations", true)!==false ? mb_strstr($order->COLI_OrderDetailText, "operations", true) : $order->COLI_OrderDetailText; $coli_update_column = array( "COLI_Memo" => $old_memo . "orderRemark\r\n" . $detail_jsonResp->orderDetail->orderRemark . "\r\n" ,"COLI_OrderDetailText" => $old_detail . "operations\r\n" . $allDetails_to_HT . "\r\n" @@ -304,9 +306,10 @@ class TulanduoApi extends CI_Controller /** BIZ_ConfirmLineDetail */ // nothing to update /** biz_groupcombineinfo */ $this->Order_update->gci_where_update = " GCI_SN=" . $order->GCI_SN; + $vei_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] ? $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] : 1343; $gci_update_column = array( "GCI_combineNo" => $detail_jsonResp->orderDetail->groupOrderNo - ,"GCI_VEI_SN" => $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] + ,"GCI_VEI_SN" => $vei_SN ,"GCI_travelDate" => $detail_jsonResp->orderDetail->travelDate ,"GCI_leaveDate" => $detail_jsonResp->orderDetail->leaveDate ); @@ -399,7 +402,7 @@ class TulanduoApi extends CI_Controller if (isset($detail_jsonResp->orderDetail->operationDetails->sceneryOperations)) { foreach ($detail_jsonResp->orderDetail->operationDetails->sceneryOperations as $ks => $vso) { $this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo; - $this->Orders_model->GCOD_VEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN']; + $this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_operationType = "sceneryOperations"; $this->Orders_model->GCOD_subType = $vso->type; $this->Orders_model->GCOD_title = $vso->name; @@ -421,7 +424,7 @@ class TulanduoApi extends CI_Controller if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) ) { foreach ($detail_jsonResp->orderDetail->operationDetails->restraurantOperations as $vro) { $this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ; - $this->Orders_model->GCOD_VEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN']; + $this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_operationType = "restraurantOperations"; $this->Orders_model->GCOD_subType = $vro->type; $this->Orders_model->GCOD_title = $vro->name; @@ -442,7 +445,7 @@ class TulanduoApi extends CI_Controller if (isset($detail_jsonResp->orderDetail->operationDetails->touristCarOperations)) { foreach ($detail_jsonResp->orderDetail->operationDetails->touristCarOperations as $vco) { $this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ; - $this->Orders_model->GCOD_VEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN']; + $this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_operationType = "touristCarOperations"; $this->Orders_model->GCOD_subType = $vco->type; $this->Orders_model->GCOD_title = $vco->name; @@ -463,7 +466,7 @@ class TulanduoApi extends CI_Controller if (isset($detail_jsonResp->orderDetail->operationDetails->guiderOperations) ) { foreach ($detail_jsonResp->orderDetail->operationDetails->guiderOperations as $vgo) { $this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ; - $this->Orders_model->GCOD_VEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN']; + $this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_operationType = "guiderOperations"; $this->Orders_model->GCOD_subType = ""; $this->Orders_model->GCOD_title = ""; @@ -660,7 +663,7 @@ log_message('error','in GCI ' . json_decode($resp)->responseData->orderId); $temp_array[0] = strrchr($temp_array[0], " ") ? strrchr($temp_array[0], " ") : $temp_array[0]; $tmp_groupCode = explode("-", trim($temp_array[0])); $real_groupCode = $tmp_groupCode[0] . "-"; - $real_groupCode .= mb_strstr($tmp_groupCode[1], "(", true) ? mb_strstr($tmp_groupCode[1], "(", true) : $tmp_groupCode[1]; + $real_groupCode .= mb_strstr($tmp_groupCode[1], "(", true)!==false ? mb_strstr($tmp_groupCode[1], "(", true) : $tmp_groupCode[1]; $real_groupCode = mb_ereg_replace('( )', '', trim($real_groupCode)); return $real_groupCode; } diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php index 5ac7bba3..dfed8def 100644 --- a/webht/third_party/trippestOrderSync/models/orders_model.php +++ b/webht/third_party/trippestOrderSync/models/orders_model.php @@ -480,12 +480,12 @@ class Orders_model extends CI_Model { return NULL; } - public function get_SN_by_groupCode($code) + public function get_SN_by_groupCode($code, $NoName) { $sql = "SELECT top 1 COLI_SN,GRI_SN FROM BIZ_ConfirmLineInfo coli LEFT JOIN GRoupInfo gri ON coli.COLI_GRI_SN=gri.GRI_SN - WHERE gri.GRI_No LIKE '%$code%'"; + WHERE gri.GRI_No LIKE '%$code%' and gri.GRI_No like '%$NoName%' "; $query = $this->HT->query($sql); if ($query->row()) { $this->BIZ_COLI_SN = $query->row()->COLI_SN;