|
|
|
@ -70,6 +70,10 @@ class TulanduoApi extends CI_Controller
|
|
|
|
|
mb_regex_encoding("UTF-8");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 获取订单列表
|
|
|
|
|
* @date 2018-05-02
|
|
|
|
|
*/
|
|
|
|
|
public function get_orderlist()
|
|
|
|
|
{
|
|
|
|
|
$this->tld_order->setUserId($this->userId)
|
|
|
|
@ -221,6 +225,11 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 更新订单的详情;[客人列表, 团费, 调度信息]
|
|
|
|
|
* @date 2018-05-02
|
|
|
|
|
* @param [type] $coli_sn HT系统的订单key
|
|
|
|
|
*/
|
|
|
|
|
public function insert_HT_order_operation($coli_sn=null)
|
|
|
|
|
{
|
|
|
|
|
$this->load->model('Order_update');
|
|
|
|
@ -245,9 +254,18 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
|
|
|
|
|
->setKey($this->key);
|
|
|
|
|
$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: " . $this->tld_order->getBizContent());
|
|
|
|
|
return;
|
|
|
|
|
if ($detail_jsonResp->errMsg == "未查询到对应的订单") {
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 目的地的团已经主动取消, 只有其他渠道的团需要更新状态
|
|
|
|
|
if ($order->GCI_FromAgc != "D目的地桂林组" && mb_strstr($detail_jsonResp->orderDetail->agcOrderNo, "取消") !== false) {
|
|
|
|
|
$this->order_cancel($order->COLI_ID);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$allDetails_to_HT = "";
|
|
|
|
|
$allDetails_to_HT .= "\r\n日程: ";
|
|
|
|
@ -362,7 +380,7 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*BIZ_GroupCombineOperationDetail*/
|
|
|
|
|
if ( ! isset($detail_jsonResp->orderDetail->groupOrderNo)) {
|
|
|
|
|
if ( ! isset($detail_jsonResp->orderDetail->groupOrderNo)) { // 没有拼团团号
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (in_array($detail_jsonResp->orderDetail->groupOrderNo, $unique_orderGroupCombine)) {
|
|
|
|
@ -457,7 +475,28 @@ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function order_push($COLI_ID=0) // test
|
|
|
|
|
/*!
|
|
|
|
|
* 取消团
|
|
|
|
|
* @date 2018-05-02
|
|
|
|
|
* @param string $COLI_ID HT系统订单号
|
|
|
|
|
*/
|
|
|
|
|
public function order_cancel($COLI_ID="")
|
|
|
|
|
{
|
|
|
|
|
/** UPDATE HT */
|
|
|
|
|
/** BIZ_ConfirmLineInfo */
|
|
|
|
|
$this->Order_update->coli_where_update = " COLI_ID=" . $COLI_ID;
|
|
|
|
|
$coli_update_column = array(
|
|
|
|
|
"COLI_State" => 40
|
|
|
|
|
);
|
|
|
|
|
return $this->Order_update->biz_confirmlineinfo_update($coli_update_column);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 发送预订计划到地接系统
|
|
|
|
|
* @date 2018-05-02
|
|
|
|
|
* @param string $COLI_ID HT系统订单号
|
|
|
|
|
*/
|
|
|
|
|
public function order_push($COLI_ID="") // test
|
|
|
|
|
{
|
|
|
|
|
// exit();
|
|
|
|
|
/** 目的地 test */
|
|
|
|
@ -546,23 +585,34 @@ log_message('error','in GCI ' . json_decode($resp)->responseData->orderId);
|
|
|
|
|
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
|
|
|
|
|
}
|
|
|
|
|
// $vendorID = 29188;//29188 1343; // test
|
|
|
|
|
$vas_info = array();
|
|
|
|
|
if ($input['agcName'] == 'D目的地桂林组') {
|
|
|
|
|
$vas_info = $this->Orders_model->get_vendorarrangestate_byVendor($input['orderId'], $vendorID);
|
|
|
|
|
if (empty($vas_info) && ! empty($input['agcOrderNo'])) {
|
|
|
|
|
$real_groupCode = $this->analysis_groupCode($input['agcOrderNo']);
|
|
|
|
|
$vas_info = $this->Orders_model->get_vendorarrangestate_byGroup($real_groupCode, $vendorID);
|
|
|
|
|
}
|
|
|
|
|
} elseif ($input['agcName'] == '桂林海纳国旅') {
|
|
|
|
|
$real_groupCode = $this->analysis_groupCode($input['agcOrderNo']);
|
|
|
|
|
$vas_info = $this->Orders_model->get_vendorarrangestate_byGroup_T($real_groupCode, $vendorID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (empty($vas_info)) {
|
|
|
|
|
$ret['errMsg'] = "未找到订单.";
|
|
|
|
|
} else {
|
|
|
|
|
$vendor_manager = $this->Orders_model->get_vendorContact($vendorID);
|
|
|
|
|
/** VendorArrangeState */
|
|
|
|
|
$VAS_ConfirmInfo = $input['orderRemark'] . "\r\n======确认人: " . $input['orderDuty'] . ", 确认时间: " . $input['orderTime'];
|
|
|
|
|
$VAS_ConfirmInfo .= "\r\n" . $vas_info[0]->VAS_ConfirmInfo;
|
|
|
|
|
$update_vas = $this->Order_update->vendorStatus_update($vas_info[0]->VAS_SN, $vendor_manager->LMI_SN, $VAS_ConfirmInfo);
|
|
|
|
|
if ($input['agcName'] == 'D目的地桂林组') { // 传统团的不需要更新订单主表
|
|
|
|
|
/** BIZ_confirmlineinfo */
|
|
|
|
|
$this->Order_update->coli_where_update = " COLI_SN=" . $vas_info[0]->COLI_SN;
|
|
|
|
|
$coli_update_column = array(
|
|
|
|
|
"COLI_State" => 7
|
|
|
|
|
);
|
|
|
|
|
$update_coli = $this->Order_update->biz_confirmlineinfo_update($coli_update_column);
|
|
|
|
|
}
|
|
|
|
|
if ($update_vas === TRUE) {
|
|
|
|
|
$ret['status'] = 1;
|
|
|
|
|
$ret['errMsg'] = "";
|
|
|
|
@ -587,10 +637,17 @@ log_message('error','in GCI ' . json_decode($resp)->responseData->orderId);
|
|
|
|
|
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 目的地项目组的订单计划的团号分析
|
|
|
|
|
* 去除添加的后缀, 只保留前两部分: XXXXXX-YYYYYYYYYYYY
|
|
|
|
|
* @date 2018-05-02
|
|
|
|
|
* @param [type] $groupCode 从地接系统获取到的团号
|
|
|
|
|
*/
|
|
|
|
|
public function analysis_groupCode($groupCode)
|
|
|
|
|
{
|
|
|
|
|
mb_regex_encoding("UTF-8");
|
|
|
|
|
$tmp_groupCode = explode("-", $groupCode);
|
|
|
|
|
preg_match('^[\w\-]+^', $this->characet($groupCode, "UTF-8"), $temp_array);
|
|
|
|
|
$tmp_groupCode = explode("-", $temp_array[0]);
|
|
|
|
|
$real_groupCode = $tmp_groupCode[0] . "-";
|
|
|
|
|
$real_groupCode .= mb_strstr($tmp_groupCode[1], "(", true) ? mb_strstr($tmp_groupCode[1], "(", true) : $tmp_groupCode[1];
|
|
|
|
|
$real_groupCode = mb_ereg_replace('(\s| )', '', $real_groupCode);
|
|
|
|
|