|
|
|
|
@ -37,7 +37,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
,"routeType" => "上海目的地线路"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
public $vendor_ids = array(1343,30548,29188);
|
|
|
|
|
// public $vendor_ids = array(1343,30548,29188);
|
|
|
|
|
|
|
|
|
|
// userId key
|
|
|
|
|
// 1343 2e47c3721e3ff6e816fe6b928d7acc7d
|
|
|
|
|
@ -75,24 +75,22 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
// 桂林海纳国旅
|
|
|
|
|
// $this->userId = "18";
|
|
|
|
|
// $this->key = "d05c25e6e6c5d4898161e0aaf700d9c7";
|
|
|
|
|
$this->vendor_ids = $this->trippest->tulanduo_vei_sn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function order_push($GRI_SN=null)
|
|
|
|
|
public function order_push($GRI_SN=0)
|
|
|
|
|
{
|
|
|
|
|
if ($GRI_SN !== null) {
|
|
|
|
|
return $this->push_trippest($GRI_SN);
|
|
|
|
|
}
|
|
|
|
|
$start_date = date('Y-m-d');
|
|
|
|
|
$end_date = date('Y-m-d 23:59:59', strtotime("+2 months"));
|
|
|
|
|
$vei_sn_str = implode(",", $this->vendor_ids);
|
|
|
|
|
$ready_to_send = $this->Group_model->get_plan_not_received(1, $vei_sn_str, $start_date, $end_date);
|
|
|
|
|
$ready_to_send = $this->Group_model->get_plan_not_received(1, $vei_sn_str, $GRI_SN, $start_date, $end_date);
|
|
|
|
|
if (empty($ready_to_send)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$order = $ready_to_send[0];
|
|
|
|
|
// 目的地计划
|
|
|
|
|
if (strval($order->GRI_OrderType) === "227002" && strval($order->department) === "30") {
|
|
|
|
|
return $this->push_trippest($order->GRI_SN);
|
|
|
|
|
return $this->push_trippest($order);
|
|
|
|
|
}
|
|
|
|
|
// 商务
|
|
|
|
|
if (strval($order->GRI_OrderType) === "227002") {
|
|
|
|
|
@ -101,35 +99,55 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
if (strval($order->GRI_OrderType) === "227001") {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->output->set_content_type('application/json')->set_output(json_encode($order));
|
|
|
|
|
return $this->output->set_output("not trippest");
|
|
|
|
|
// return $this->output->set_content_type('application/json')->set_output(json_encode($order));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 发送目的地项目组预订计划到图兰朵地接系统
|
|
|
|
|
* 地接社未接受的或有变更的
|
|
|
|
|
* 地接社未接收的或有变更的
|
|
|
|
|
* @date 2018-05-02
|
|
|
|
|
*/
|
|
|
|
|
public function push_trippest($gri_sn=0)
|
|
|
|
|
public function push_trippest($vas=null)
|
|
|
|
|
{
|
|
|
|
|
// exit();
|
|
|
|
|
/** 目的地 test */
|
|
|
|
|
$this->userId = "902";
|
|
|
|
|
$this->key = "f56541ff40e1afba444d831c5a666195";
|
|
|
|
|
|
|
|
|
|
$gri_sn = $vas->GRI_SN;
|
|
|
|
|
$vas_sn = $vas->VAS_SN;
|
|
|
|
|
$vei_sn = $vas->VAS_VEI_SN;
|
|
|
|
|
$is_send_vary = $vas->VAS_SendVary;
|
|
|
|
|
$change_info = $vas->VAS_ChangeText;
|
|
|
|
|
if (trim($change_info) !== "") {
|
|
|
|
|
preg_match_all('/(.*)={6}(.*)(\d{4}\-\d{2}\-\d{2})/ismU', characet($change_info,'UTF-8'), $change_arr);
|
|
|
|
|
$change_info = $change_arr[0][0];
|
|
|
|
|
}
|
|
|
|
|
$change_info = str_replace("\n", "<br>", $change_info);
|
|
|
|
|
$vei_sn_str = implode(",", $this->vendor_ids);
|
|
|
|
|
$this->load->model('TuLanDuo_addOrUpdateRouteOrderContentBuilder', 'tldOrderBuilder');
|
|
|
|
|
$orderinfo = $this->BIZ_order->get_orderinfo_detail($gri_sn);
|
|
|
|
|
$orderinfo = $this->BIZ_order->get_orderinfo_detail($gri_sn, $vei_sn_str);
|
|
|
|
|
if(empty($orderinfo)) {return;}
|
|
|
|
|
$COLI_ID = $orderinfo[0]->COLI_ID;
|
|
|
|
|
$set_pvt = strval($orderinfo[0]->COLI_PVT);
|
|
|
|
|
$travelFees = $this->BIZ_order->get_paymentDetails($COLI_ID);
|
|
|
|
|
// 按产品拆分 todo:按订单类型拆分? 单团/拼团
|
|
|
|
|
$fill_order = array();
|
|
|
|
|
$processed_date = array();
|
|
|
|
|
$processed_cold = array();
|
|
|
|
|
foreach ($orderinfo as $ko => $cold) {
|
|
|
|
|
if ( ! in_array($cold->COLD_SN, $processed_cold)) {
|
|
|
|
|
if ( ! in_array($cold->COLD_SN, $processed_cold) && $cold->pag_code != '') {
|
|
|
|
|
$processed_cold[] = $cold->COLD_SN;
|
|
|
|
|
$all_package = $this->trippest->tour_code($cold->pag_code);
|
|
|
|
|
$pag_info = $this->BIZ_order->get_packageDetails(my_implode("'",",",$all_package));
|
|
|
|
|
$fill_order[$cold->pag_code]["cold"][] = $cold;
|
|
|
|
|
$fill_order[$cold->pag_code]["package_info"] = $pag_info;
|
|
|
|
|
if ($set_pvt==='1') {
|
|
|
|
|
$fill_order[0]["cold"][] = $cold;
|
|
|
|
|
$fill_order[0]["package_info"] = $pag_info;
|
|
|
|
|
} else {
|
|
|
|
|
$fill_order[$cold->pag_code]["cold"][] = $cold;
|
|
|
|
|
$fill_order[$cold->pag_code]["package_info"] = $pag_info;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// $fill_order = array_values($fill_order);
|
|
|
|
|
@ -141,8 +159,10 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
$order_type = intval($vf["package_info"][0]->PAG_ExtendType)===39009 ? 1 : 2;
|
|
|
|
|
$last_code = count($vf["package_info"])-1;
|
|
|
|
|
$last_date = count($vf["cold"])-1;
|
|
|
|
|
$routeName = $vf["package_info"][0]->PAG2_Name . mb_strtoupper($vf["cold"][0]->pag_code);
|
|
|
|
|
$end_date = strstr($vf["cold"][$last_date]->COLD_StartDate, " ", true);
|
|
|
|
|
$tour_code = mb_strtoupper($vf["cold"][0]->pag_code);
|
|
|
|
|
$routeName = $vf["package_info"][0]->PAG2_Name . "(" . mb_strtoupper($vf["cold"][0]->pag_code) . ")";
|
|
|
|
|
$first_date = strstr($vf["cold"][0]->COLD_StartDate, " ", true);
|
|
|
|
|
$end_date = strstr($vf["cold"][$last_date]->COLD_EndDate, " ", true);
|
|
|
|
|
if (isset($this->trippest->special_route[$vf["cold"][0]->pag_code])) {
|
|
|
|
|
$routeName = $this->trippest->special_route[$vf["cold"][0]->pag_code]["name"];
|
|
|
|
|
$extra_day = $this->trippest->special_route[$vf["cold"][0]->pag_code]["day"]-1;
|
|
|
|
|
@ -181,7 +201,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
->setCustomersPeopleType($key, ($vg->BPE_GuestType==1 ? "成人" : "儿童"))
|
|
|
|
|
->setCustomersDocumentType($key, "护照") // Passport No.
|
|
|
|
|
->setCustomersDocumentNo($key, $vg->BPE_Passport)
|
|
|
|
|
->setCustomersOtherInfo($key, $this->BIZ_order->GetNationalityName($orderinfo[0]->GUT_NationalityID));
|
|
|
|
|
->setCustomersOtherInfo($key, $this->BIZ_order->GetNationalityName($vg->BPE_Nationality));
|
|
|
|
|
}
|
|
|
|
|
$scheduleDetails = $this->BIZ_order->get_scheduleDetails($COLD_SN_str);
|
|
|
|
|
$schedule_obj = array();
|
|
|
|
|
@ -254,9 +274,20 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
if ( ! in_array(substr($vs->COLD_StartDate, 0, 10), $fill_date)) {
|
|
|
|
|
$schedule_obj[substr($vs->COLD_StartDate, 0, 10)]['content'] .= $this_title . $this_content;
|
|
|
|
|
}
|
|
|
|
|
// 当前产品连续日期的补充
|
|
|
|
|
$date_s = new DateTime(strstr($vs->COLD_StartDate, " ", TRUE));
|
|
|
|
|
$date_e = new DateTime(strstr($vs->COLD_EndDate, " ", TRUE));
|
|
|
|
|
$date_d = $date_e->diff($date_s);
|
|
|
|
|
$d_t = ($date_d->format("%d"));
|
|
|
|
|
if ($d_t > 0) {
|
|
|
|
|
for ($d_i=0; $d_i < ($d_t+1); $d_i++) {
|
|
|
|
|
$f_d = date('Y-m-d', strtotime("+$d_i day", strtotime(substr($vs->COLD_StartDate, 0, 10))));
|
|
|
|
|
$schedule_obj[$f_d] = $schedule_obj[substr($vs->COLD_StartDate, 0, 10)];
|
|
|
|
|
$schedule_obj[$f_d]['date'] = $f_d;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 补全空的日期
|
|
|
|
|
$first_date = strstr($vf["cold"][0]->COLD_StartDate, " ", true);
|
|
|
|
|
$date1 = new DateTime($first_date);
|
|
|
|
|
$date_end = new DateTime($end_date);
|
|
|
|
|
$date_diff = $date_end->diff($date1);
|
|
|
|
|
@ -302,22 +333,55 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
->setTravelFeesRemark($kf, $vf->GAI_Memo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo(($this->tldOrderBuilder->getBizContent()));
|
|
|
|
|
// 查询是否变更
|
|
|
|
|
$sync_orderstate = 1;
|
|
|
|
|
$vps_sn = 0;
|
|
|
|
|
$vendor_orderid = 0;
|
|
|
|
|
if (intval($is_send_vary)===1) {
|
|
|
|
|
$vps = $this->Group_model->get_sync_info($vas_sn, $tour_code);
|
|
|
|
|
if ( ! empty($vps)) {
|
|
|
|
|
$vps_sn = $vps->VPS_SN;
|
|
|
|
|
$vendor_orderid = $vps->VPS_sync_id;
|
|
|
|
|
$sync_orderstate = 11;
|
|
|
|
|
$modifyLogInfo = "<br>$change_info<br>";
|
|
|
|
|
// $modifyLogInfo = "<br><a href='https://www.trippest.com'>https://www.trippest.com</a><br>";
|
|
|
|
|
$this->tldOrderBuilder->setOrderId($vendor_orderid)
|
|
|
|
|
->setModifyLogInfo($modifyLogInfo)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$this->tldOrderBuilder->clearModifyLogInfo();
|
|
|
|
|
// $this->tldOrderBuilder->setModifyLogInfo($modifyLogInfo)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
// echo(($this->tldOrderBuilder->getBizContent()));
|
|
|
|
|
// $this->output->set_content_type('application/json')->set_output($this->tldOrderBuilder->getBizContent());
|
|
|
|
|
// $resp = $this->excute_curl($this->neworder_url, $this->tldOrderBuilder);
|
|
|
|
|
$resp = $this->excute_curl($this->neworder_url, $this->tldOrderBuilder);
|
|
|
|
|
// var_dump($resp);
|
|
|
|
|
|
|
|
|
|
/** BIZ_GroupCombineInfo */
|
|
|
|
|
// if (json_decode($resp)->status == 1) {
|
|
|
|
|
// log_message('error','in GCI ' . json_decode($resp)->responseData->orderId);
|
|
|
|
|
// $this->BIZ_order->GCI_COLI_SN = $orderinfo[0]->COLI_SN;
|
|
|
|
|
// $this->BIZ_order->GCI_GRI_SN = $orderinfo[0]->COLI_GRI_SN;
|
|
|
|
|
// $this->BIZ_order->GCI_VendorOrderId = json_decode($resp)->responseData->orderId;
|
|
|
|
|
// $this->BIZ_order->GCI_FromAgc = "D目的地桂林组";
|
|
|
|
|
// $this->BIZ_order->biz_groupcombineinfo_save();
|
|
|
|
|
// }
|
|
|
|
|
$response = json_decode($resp);
|
|
|
|
|
if ($response->status == 1) {
|
|
|
|
|
/** VendorPlanSync */
|
|
|
|
|
$sync_ret = array(
|
|
|
|
|
"VPS_VAS_SN" => $vas_sn
|
|
|
|
|
,"VPS_GRI_SN" => $gri_sn
|
|
|
|
|
,"VPS_VEI_SN" => $vei_sn
|
|
|
|
|
,"VPS_startDate" => $first_date
|
|
|
|
|
,"VPS_endDate" => $end_date
|
|
|
|
|
,"VPS_tourCode" => $tour_code
|
|
|
|
|
,"VPS_sync_id" => $response->responseData->orderId
|
|
|
|
|
,"VPS_sync_orderType" => $order_type
|
|
|
|
|
,"VPS_sync_orderState" => $sync_orderstate
|
|
|
|
|
,"VPS_syncTime" => date('Y-m-d H:i:s')
|
|
|
|
|
);
|
|
|
|
|
if ($vps_sn === 0) {
|
|
|
|
|
$sync_id = $this->Group_model->insert_VendorPlanSync($sync_ret);
|
|
|
|
|
} else {
|
|
|
|
|
$update = $this->Group_model->update_VendorPlanSync($vps_sn, $sync_ret);
|
|
|
|
|
}
|
|
|
|
|
/** VendorArrangeState VAS_IsReceive */
|
|
|
|
|
$this->Group_model->set_plan_received($vas_sn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// email 供应商 todo
|
|
|
|
|
echo "Order Push done.";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -332,7 +396,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
$ret['status'] = -1;
|
|
|
|
|
$ret['errMsg'] = "未知错误";
|
|
|
|
|
$input = $this->input->post();
|
|
|
|
|
$vendorID = $input['userId'];
|
|
|
|
|
$vendorID = $input['openId'];
|
|
|
|
|
$validate = $this->calc_key($vendorID, $input['key']);
|
|
|
|
|
if ($validate !== TRUE) {
|
|
|
|
|
$ret['errMsg'] = "身份验证失败.";
|
|
|
|
|
@ -484,4 +548,5 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
return $ret===$key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|