diff --git a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php index c74aad8d..0a4feca3 100644 --- a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php +++ b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php @@ -50,6 +50,7 @@ class TulanduoApi extends CI_Controller public function __construct(){ parent::__construct(); $this->load->model('Orders_model'); + $this->load->model('Order_insert'); $this->load->model('TuLanDuo_queryContentBuilder', 'tld_order'); $this->load->helper('array'); @@ -74,15 +75,15 @@ class TulanduoApi extends CI_Controller ->setKey($this->key) ->setPageSize(20) ->setPageIndex(1) - ->setStartTravelDate("2018-04-19") - ->setEndTravelDate("2018-04-19") + ->setStartTravelDate("2018-04-18") + ->setEndTravelDate("2018-04-18") // ->setStartOrderDate("2018-04-13") // ->setEndOrderDate("2018-04-13") ; $resp = $this->excute_curl($this->list_url, $this->tld_order); $resp_arr = json_decode($resp, true); if ($resp_arr['status'] !== 1) { - log_message('error','TulanduoApi get_orderlist failed. Msg:' . $resp_arr['errMsg'] . "; Request: " . json_encode($this->params)); + log_message('error','TulanduoApi get_orderlist failed. Msg:' . $resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent())); return; } $all_list = $resp_arr["responseData"]["orders"]; @@ -97,7 +98,7 @@ class TulanduoApi extends CI_Controller $f_resp = $this->excute_curl($this->list_url, $this->tld_order); $f_resp_arr = json_decode($f_resp, true); if ($resp_arr['status'] !== 1) { - log_message('error','TulanduoApi get_orderlist failed. Msg:' . $f_resp_arr['errMsg'] . "; Request: " . json_encode($this->params)); + log_message('error','TulanduoApi get_orderlist failed. Msg:' . $f_resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent())); continue; } $f_order_to_HT = array_map( @@ -112,14 +113,6 @@ class TulanduoApi extends CI_Controller $cnt = 0; foreach ($all_list as $k => $vo) { $vo['agcOrderNo'] = mb_ereg_replace('(\s| )', '', $vo['agcOrderNo']); // 去掉中文的全角空格 - // get order detail - // $this->tld_order->setOrderId($vo["orderId"]); - // $detail_resp = $this->excute_curl($this->detail_url, $this->tld_order); - // $detail_jsonResp = json_decode($detail_resp); - // if ($detail_jsonResp->status !== 1) { - // log_message('error','TulanduoApi get_orderdetail failed. Msg:' . $detail_jsonResp->errMsg . "; Request: " . json_encode($this->params)); - // return; - // } $PAG_Code = $pag_sub = null; preg_match('^[a-zA-Z]+\-[0-9\-]+^', $this->characet($vo['routeName'], "UTF-8"), $temp_array); if (empty($temp_array) && isset($this->pag_no_tmp()[$vo['routeName']])) { @@ -139,7 +132,7 @@ class TulanduoApi extends CI_Controller $COLD_MemoText = 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; - $this->get_SN_by_vendorOrderId($vo['orderId']); // 查询订单是否已经录入过 + $this->Orders_model->get_SN_by_vendorOrderId($vo['orderId']); // 查询订单是否已经录入过 if ($this->Orders_model->BIZ_COLI_SN === null && in_array($vo['agcName'], array("D目的地桂林组"))) { $tmp_groupCode = explode("-", $vo['agcOrderNo']); $real_groupCode = $tmp_groupCode[0] . "-"; @@ -165,7 +158,7 @@ class TulanduoApi extends CI_Controller $this->Orders_model->GRI_IsCancel = 0; $this->Orders_model->DeleteFlag = 0; $this->Orders_model->groupinfo_save(); - /*BIZ_ConfirmLineInfo*/ + /**BIZ_ConfirmLineInfo*/ $this->Orders_model->BIZ_COLI_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null; $this->Orders_model->BIZ_COLI_GroupCode = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_No : ""; $this->Orders_model->BIZ_GUT_SN = $this->Orders_model->GUT_SN; @@ -179,7 +172,8 @@ class TulanduoApi extends CI_Controller $this->Orders_model->BIZ_COLI_OrderDetailText = "来自图兰朵系统同步测试" . $vo["orderId"] . ";线路:" . $vo['routeName']; $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*/ +log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID); + /**BIZ_ConfirmLineDetail*/ $this->Orders_model->COLD_COLI_SN = $this->Orders_model->BIZ_COLI_SN; $this->Orders_model->COLD_ServiceType = "D"; $this->Orders_model->COLD_ServiceSN = $serviceSN; @@ -193,6 +187,20 @@ class TulanduoApi extends CI_Controller $this->Orders_model->COLD_PlanVEI_SN = empty($this->city_info[$vo['operationDep']]) ? 1343 : $this->city_info[$vo['operationDep']]['PlanVEI_SN']; $this->Orders_model->COLD_MemoText = $COLD_MemoText; $this->Orders_model->biz_confirm_detail_save(); + /** VendorArrangeState */ + $vendor_contact = $this->Orders_model->get_vendorContact($this->Orders_model->COLD_PlanVEI_SN); + $this->Order_insert->VAS_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null; + $this->Order_insert->VAS_VEI_SN = $this->Orders_model->COLD_PlanVEI_SN; + $this->Order_insert->VAS_IsSendSucceed = 1; + $this->Order_insert->VAS_IsConfirm = $vo['orderStatus']; + $this->Order_insert->VAS_IsCancel = 0; + $this->Order_insert->VAS_SendTime = $vo['orderDate']; + $this->Order_insert->VAS_ConfirmTime = $vo['orderStatus'] == 1 ? $vo['orderDate'] : null; + $this->Order_insert->VAS_LMI_SN = !empty($vendor_contact) ? $vendor_contact->LMI_SN : null; + $this->Order_insert->VAS_FaxNo = !empty($vendor_contact) ? $vendor_contact->LMI_AutoFax : null; + $this->Order_insert->VAS_VendorEmail = !empty($vendor_contact) ? $vendor_contact->LMI_ListMail : null; + $this->Order_insert->vendorarrangestate_save(); + $cnt++; } if ($this->Orders_model->GCI_SN === null) { @@ -231,7 +239,7 @@ class TulanduoApi extends CI_Controller $detail_resp = $this->excute_curl($this->detail_url, $this->tld_order); $detail_jsonResp = json_decode($detail_resp); if ($detail_jsonResp->status !== 1) { - log_message('error','TulanduoApi get_orderdetail failed. Msg:' . $detail_jsonResp->errMsg . "; Request: " . json_encode($this->params)); + log_message('error','TulanduoApi get_orderdetail failed. Msg:' . $detail_jsonResp->errMsg . "; Request: " . $this->tld_order->getBizContent()); return; } $allDetails_to_HT = "日程: "; @@ -297,7 +305,7 @@ class TulanduoApi extends CI_Controller $this->Orders_model->biz_groupcombineoperationdetail_save(); } } - // 用房 + // 用房 ... // 用餐 if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) && empty($this->Orders_model->combineoperation_exist($detail_jsonResp->orderDetail->groupOrderNo, "restraurantOperations"))) { @@ -389,7 +397,7 @@ class TulanduoApi extends CI_Controller ->setOrderType(2) // todo ->setRouteName($routeName) ->setRouteType("北京目的地线路") // todo - ->setAgcOrderNo($orderinfo[0]->COLI_GroupCode) + ->setAgcOrderNo($orderinfo[0]->COLI_GroupCode) // todo 加上 -BJ,-SH, -XA ->setAdultNum($orderinfo[0]->COLD_PersonNum) ->setChildNum($orderinfo[0]->COLD_ChildNum) ->setDestination("北京") // todo diff --git a/webht/third_party/trippestOrderSync/models/order_insert.php b/webht/third_party/trippestOrderSync/models/order_insert.php index 1b8eb596..7978adaf 100644 --- a/webht/third_party/trippestOrderSync/models/order_insert.php +++ b/webht/third_party/trippestOrderSync/models/order_insert.php @@ -1,6 +1,6 @@ result(); } + public $VAS_GRI_SN; + public $VAS_VEI_SN; + public $VAS_IsSendSucceed; + public $VAS_IsConfirm; + public $VAS_SendTime; + public $VAS_ConfirmTime; + public $VAS_IsCancel; + public $VAS_LMI_SN; + public $VAS_FaxNo; + public $VAS_VendorEmail; + public function vendorarrangestate_save() + { + $sql = "INSERT INTO VendorArrangeState + (VAS_GRI_SN + ,VAS_VEI_SN + ,VAS_IsSendSucceed + ,VAS_IsConfirm + ,VAS_SendTime + ,VAS_ConfirmTime + ,VAS_IsCancel + ,VAS_LMI_SN + ,VAS_FaxNo + ,VAS_VendorEmail + ,Creator + ,LastEditTime + ,DeleteFlag + ) VALUES + (? + ,? + ,? + ,? + ,? + ,? + ,? + ,? + ,? + ,? + ,0 + ,GETDATE() + ,0 + )"; + $query = $this->HT->query($sql, array( + $this->VAS_GRI_SN + ,$this->VAS_VEI_SN + ,$this->VAS_IsSendSucceed + ,$this->VAS_IsConfirm + ,$this->VAS_SendTime + ,$this->VAS_ConfirmTime + ,$this->VAS_IsCancel + ,$this->VAS_LMI_SN + ,$this->VAS_FaxNo + ,$this->VAS_VendorEmail + )); + return $query; + } + + /** 团信息 */ public $GRI_SN=0; // 团号 public $GRI_No; // 团号 public $GRI_OrderType; // 订单类型 @@ -135,7 +192,6 @@ class Orders_model extends CI_Model { public $GRI_Days; // 行程天数 public $GRI_IsCancel=0; public $GRI_DeleteFlag=0; - /** 团信息 */ public function groupinfo_save() { $sql = "INSERT INTO GRoupInfo @@ -160,6 +216,7 @@ class Orders_model extends CI_Model { return $this->GRI_SN; } + /** 目的地订单 拼团信息 */ public $GCI_SN; public $GCI_combineNo=''; // 拼团团号 public $GCI_COLI_SN; // 订单key @@ -169,7 +226,6 @@ class Orders_model extends CI_Model { public $GCI_travelDate; public $GCI_leaveDate; public $GCI_createTime; - /** 目的地订单 拼团信息 */ public function biz_groupcombineinfo_save() { $sql = "IF NOT EXISTS( diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php index b582c746..f553ba29 100644 --- a/webht/third_party/trippestOrderSync/models/orders_model.php +++ b/webht/third_party/trippestOrderSync/models/orders_model.php @@ -397,6 +397,25 @@ class Orders_model extends CI_Model { return NULL; } + /*! + * 获取地接社接受计划的人员信息 + * @param $vendorID 地接社ID + */ + public function get_vendorContact($vendorID) + { + $sql = "SELECT top 1 lmi2.LMI2_Name, + lmi.LMI_SN, + lmi.LMI_AutoFax, + lmi.LMI_Telephone, + lmi.LMI_Mobile, + lmi.LMI_ListMail + FROM LinkmanInfo lmi + INNER JOIN LinkManInfo2 lmi2 ON lmi2.LMI2_LMI_SN=lmi.LMI_SN + WHERE LMI_Receiver='Yes' AND LMI_VEI_SN=$vendorID"; + $query = $this->HT->query($sql); + return $query->row(); + } + var $BIZ_COLI_SN; var $BIZ_COLI_ID; var $BIZ_COLI_GUT_SN; //联系人id