|
|
|
@ -254,21 +254,23 @@ class TulanduoApi extends CI_Controller
|
|
|
|
|
* @date 2018-05-02
|
|
|
|
|
* @param [type] $coli_sn HT系统的订单key
|
|
|
|
|
*/
|
|
|
|
|
public function insert_HT_order_operation($coli_sn=null)
|
|
|
|
|
public function insert_HT_order_operation($coli_sn=null,$get_vendorID=null)
|
|
|
|
|
{
|
|
|
|
|
// if ($coli_sn == null) {
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
log_message('error','get_order_operation From TuLanDuo ');
|
|
|
|
|
$this->load->model('Order_update');
|
|
|
|
|
if ($coli_sn !== null) {
|
|
|
|
|
if ($coli_sn !== null && $coli_sn != 0) {
|
|
|
|
|
$to_update_list = $this->Orders_model->get_groupCombineInfo($coli_sn);
|
|
|
|
|
} elseif ($get_vendorID !== null) {
|
|
|
|
|
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, $get_vendorID);
|
|
|
|
|
} else {
|
|
|
|
|
// $startDate = ('2018-04-21');
|
|
|
|
|
// $endDate = ('2018-04-22'); // test
|
|
|
|
|
$startDate = date('Y-m-d', strtotime("-3 days"));
|
|
|
|
|
$endDate = date('Y-m-d', strtotime("+7 days"));
|
|
|
|
|
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, $startDate, $endDate);
|
|
|
|
|
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, null, $startDate, $endDate);
|
|
|
|
|
}
|
|
|
|
|
$unique_orderGroupCombine = array();
|
|
|
|
|
$unique_order = array();
|
|
|
|
@ -286,14 +288,20 @@ class TulanduoApi extends CI_Controller
|
|
|
|
|
// 判断取消
|
|
|
|
|
if ($detail_jsonResp->status !== 1) {
|
|
|
|
|
log_message('error','TulanduoApi get_orderdetail failed. Msg:' . $detail_jsonResp->errMsg . "; Request: " . $this->tld_order->getBizContent());
|
|
|
|
|
if ($detail_jsonResp->errMsg == "未查询到对应的订单") {
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
if ( $detail_jsonResp->errMsg == "未查询到对应的订单") {
|
|
|
|
|
$this->plan_cancel($order->GCI_VendorOrderId);
|
|
|
|
|
if (intval($order->COLI_OPI_ID) === 435) {
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 目的地的团已经主动取消, 只有其他渠道的团需要更新状态
|
|
|
|
|
if ( ! in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest")) && mb_strstr($detail_jsonResp->orderDetail->agcOrderNo, "取消") !== false) {
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
if (mb_strstr($detail_jsonResp->orderDetail->agcOrderNo, "取消") !== false) {
|
|
|
|
|
$this->plan_cancel($order->GCI_VendorOrderId);
|
|
|
|
|
if (intval($order->COLI_OPI_ID) === 435) {
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$allDetails_to_HT = "";
|
|
|
|
@ -328,16 +336,21 @@ class TulanduoApi extends CI_Controller
|
|
|
|
|
$coli_id = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_ID : $order->COLI_ID;
|
|
|
|
|
$coli_memo = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_Memo : $order->COLI_Memo;
|
|
|
|
|
$coli_orderdetailtext = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_OrderDetailText : $order->COLI_OrderDetailText;
|
|
|
|
|
$coli_state = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLI_State : 7;
|
|
|
|
|
$coli_state = $getInfo_byGroupCode!==null ?
|
|
|
|
|
(intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? 7 : $getInfo_byGroupCode->COLI_State)
|
|
|
|
|
: 7;
|
|
|
|
|
$cold_sn = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->COLD_SN : $order->COLD_SN;
|
|
|
|
|
// HT 订单有重复时, 以图兰朵的团号为正确的订单, 原本已录入的设为无效
|
|
|
|
|
if ($getInfo_byGroupCode === null) {
|
|
|
|
|
} elseif ($getInfo_byGroupCode->GRI_SN != $order->COLI_GRI_SN && in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) {
|
|
|
|
|
log_message('error','原订单' . $order->COLI_ID);
|
|
|
|
|
$allDetails_to_HT .= "\r\n疑似重复,请更新订单状态:" . $order->COLI_ID;
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
if ( $order->COLI_ID) {
|
|
|
|
|
$allDetails_to_HT .= "\r\n疑似重复,请更新订单状态:" . $order->COLI_ID;
|
|
|
|
|
if (intval($order->COLI_OPI_ID) === 435 ) {
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** biz_groupcombineinfo */
|
|
|
|
|
/** groupcombineinfo */
|
|
|
|
|
// $this->Order_update->gci_where_update = " GCI_VEI_SN=$vei_SN and GCI_VendorOrderId='" . $detail_jsonResp->orderDetail->orderId . "'";
|
|
|
|
|
$this->Order_update->gci_where_update = " GCI_VendorOrderId='" . $detail_jsonResp->orderDetail->orderId . "'";
|
|
|
|
|
$gci_update_column = array(
|
|
|
|
@ -597,7 +610,10 @@ class TulanduoApi extends CI_Controller
|
|
|
|
|
*/
|
|
|
|
|
public function order_cancel($COLI_ID="")
|
|
|
|
|
{
|
|
|
|
|
log_message('error','修改为不成行 order_cancel' . $COLI_ID);
|
|
|
|
|
if ($COLI_ID == '') {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
log_message('error','修改为不成行 order_cancel ' . $COLI_ID);
|
|
|
|
|
/** UPDATE HT */
|
|
|
|
|
/** BIZ_ConfirmLineInfo */
|
|
|
|
|
$this->Order_update->coli_where_update = " COLI_ID='" . $COLI_ID . "'";
|
|
|
|
@ -606,6 +622,16 @@ class TulanduoApi extends CI_Controller
|
|
|
|
|
);
|
|
|
|
|
return $this->Order_update->biz_confirmlineinfo_update($coli_update_column);
|
|
|
|
|
}
|
|
|
|
|
public function plan_cancel($vendorID=0)
|
|
|
|
|
{
|
|
|
|
|
/** groupcombineinfo */
|
|
|
|
|
$this->Order_update->gci_where_update = " GCI_VendorOrderId='" . $vendorID . "'";
|
|
|
|
|
$gci_update_column = array(
|
|
|
|
|
"GCI_combineNo" => 'cancel'
|
|
|
|
|
,"GCI_createTime" => date('Y-m-d H:i:s')
|
|
|
|
|
);
|
|
|
|
|
$this->Order_update->biz_groupcombineinfo_update($gci_update_column);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 发送预订计划到地接系统
|
|
|
|
@ -763,7 +789,7 @@ log_message('error','in GCI ' . json_decode($resp)->responseData->orderId);
|
|
|
|
|
{
|
|
|
|
|
mb_regex_encoding("UTF-8");
|
|
|
|
|
preg_match('/[\w\s\-]+/', $this->characet($groupCode, "UTF-8"), $temp_array);
|
|
|
|
|
$temp_array[0] = strrchr($temp_array[0], " ") ? strrchr($temp_array[0], " ") : $temp_array[0];
|
|
|
|
|
$temp_array[0] = strrchr($temp_array[0], " ") ? mb_strstr($temp_array[0], " ",true) : $temp_array[0];
|
|
|
|
|
$tmp_groupCode = explode("-", trim($temp_array[0]));
|
|
|
|
|
$real_groupCode = $tmp_groupCode[0] . "-";
|
|
|
|
|
$real_groupCode .= mb_strstr($tmp_groupCode[1], "(", true)!==false ? mb_strstr($tmp_groupCode[1], "(", true) : $tmp_groupCode[1];
|
|
|
|
|