|
|
|
@ -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
|
|
|
|
|