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; //客人