From 0c820a56549de4b9e906fa7a6082acdf50ce3eb9 Mon Sep 17 00:00:00 2001 From: lyt Date: Tue, 24 Apr 2018 17:13:39 +0800 Subject: [PATCH] =?UTF-8?q?trippest=20=E4=BF=AE=E6=AD=A3=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=AE=A2=E4=BA=BA=E9=97=AE=E9=A2=98;=20=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8C=85=E4=BB=B7=E4=BF=A1=E6=81=AF=E9=87=8D=E5=A4=8D=E5=BD=95?= =?UTF-8?q?=E5=85=A5=E9=97=AE=E9=A2=98;=20todo:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=B0=83=E5=BA=A6=E4=BF=A1=E6=81=AF;=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=9B=A2=E5=90=8D=E6=93=8D=E4=BD=9C;=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=A2=84=E5=AE=9A=E4=BC=A0=E7=9C=9F=E6=93=8D=E4=BD=9C...:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/TulanduoApi.php | 16 ++++++++------- .../trippestOrderSync/models/order_update.php | 2 +- .../trippestOrderSync/models/orders_model.php | 20 +++++++++++++++++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php index 9a1c6b59..21204a28 100644 --- a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php +++ b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php @@ -271,13 +271,15 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID); $this->Order_update->biz_groupcombineinfo_update($gci_update_column); /** INSERT */ /*BIZ_BookPeople*/ - foreach ($detail_jsonResp->orderDetail->customers as $kd => $vd) { - $this->Orders_model->BPE_FirstName = $vd->name; - $this->Orders_model->BPE_GuestType = $vd->peopleType=="成人" ? 1 : 2; - $this->Orders_model->BPE_Passport = $vd->documentNo; - $bpe_sn[] = $this->Orders_model->biz_book_people_save(); - // BIZ_BookPeopleList - $this->Orders_model->biz_bookpeople_List_save($order->COLD_SN, $this->Orders_model->BPE_SN); + if ($this->Orders_model->bookpeople_exist($order->COLD_SN) === array()) { + foreach ($detail_jsonResp->orderDetail->customers as $kd => $vd) { + $this->Orders_model->BPE_FirstName = $vd->name; + $this->Orders_model->BPE_GuestType = $vd->peopleType=="成人" ? 1 : 2; + $this->Orders_model->BPE_Passport = $vd->documentNo; + $bpe_sn[] = $this->Orders_model->biz_book_people_save(); + // BIZ_BookPeopleList + $this->Orders_model->biz_bookpeople_List_save($order->COLD_SN, $this->Orders_model->BPE_SN); + } } /*BIZ_PackageOrderInfo*/ $this->Orders_model->POI_COLD_SN = $order->COLD_SN; diff --git a/webht/third_party/trippestOrderSync/models/order_update.php b/webht/third_party/trippestOrderSync/models/order_update.php index e8e0d7b8..c454a86c 100644 --- a/webht/third_party/trippestOrderSync/models/order_update.php +++ b/webht/third_party/trippestOrderSync/models/order_update.php @@ -53,7 +53,7 @@ class Order_update extends CI_Model { public function combineoperation_exist($combineNo='', $operation="") { - if( ! $combineNo) { return false; } + if( ! $combineNo) { return array(); } $sql = "SELECT TOP 1 GCOD_GCI_combineNo FROM BIZ_GroupCombineOperationDetail WHERE GCOD_GCI_combineNo = N? and GCOD_operationType=?"; diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php index 482062aa..c412c806 100644 --- a/webht/third_party/trippestOrderSync/models/orders_model.php +++ b/webht/third_party/trippestOrderSync/models/orders_model.php @@ -283,7 +283,7 @@ class Orders_model extends CI_Model { } public function combineoperation_exist($combineNo='', $operation="") { - if( ! $combineNo) { return false; } + if( ! $combineNo) { return array(); } $sql = "SELECT TOP 1 GCOD_GCI_combineNo FROM BIZ_GroupCombineOperationDetail WHERE GCOD_GCI_combineNo = N? and GCOD_operationType=?"; @@ -765,7 +765,12 @@ class Orders_model extends CI_Model { /** 包价线路订单入库 */ public function biz_packageorder_save() { - $sql = "INSERT INTO BIZ_PackageOrderInfo + $sql = "IF NOT EXISTS( + SELECT TOP 1 1 + FROM BIZ_PackageOrderInfo + WHERE POI_COLD_SN = ? + ) + INSERT INTO BIZ_PackageOrderInfo (POI_COLD_SN ,POI_FlightsNo ,POI_AirPort @@ -794,6 +799,7 @@ class Orders_model extends CI_Model { "; $query = $this->HT->query($sql, array( $this->POI_COLD_SN + ,$this->POI_COLD_SN ,$this->POI_FlightsNo ,$this->POI_AirPort ,$this->POI_Time @@ -948,6 +954,16 @@ class Orders_model extends CI_Model { return $this->FOI_SN; } + public function bookpeople_exist($cold_sn) + { + if( ! $cold_sn) { return array(); } + $sql = "SELECT top 1 * + FROM BIZ_BookPeopleList BPL + WHERE BPL_COLD_SN=? "; + $query = $this->HT->query($sql, array($cold_sn)); + return $query->result(); + } + var $BPE_SN; var $BPE_FirstName; //客人 var $BPE_MiddleName; //客人