|
|
|
@ -86,11 +86,11 @@ class Tulanduo
|
|
|
|
|
}
|
|
|
|
|
// 商务
|
|
|
|
|
if (strval($order->GRI_OrderType) === "227002") {
|
|
|
|
|
return $this->push_biz($order, strval($order->GRI_OrderType));
|
|
|
|
|
return $this->push_biz($order);
|
|
|
|
|
}
|
|
|
|
|
// 传统订单
|
|
|
|
|
if (strval($order->GRI_OrderType) === "227001") {
|
|
|
|
|
return $this->push_tour($order, strval($order->GRI_OrderType));
|
|
|
|
|
return $this->push_tour($order);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "[Tulanduo>order_push] No function match. ";
|
|
|
|
@ -99,7 +99,7 @@ class Tulanduo
|
|
|
|
|
/*!
|
|
|
|
|
* 发送线路订单计划
|
|
|
|
|
*/
|
|
|
|
|
public function push_tour($vas=null, $gri_ordertype='227001')
|
|
|
|
|
public function push_tour($vas=null)
|
|
|
|
|
{
|
|
|
|
|
$gri_sn = $vas->GRI_SN;
|
|
|
|
|
$vas_sn = $vas->VAS_SN;
|
|
|
|
@ -143,7 +143,7 @@ class Tulanduo
|
|
|
|
|
* @Date: 2019-05-30 16:11:34
|
|
|
|
|
* @Desc: 执行发送订单计划信息. 参数已拆分归类好的行程
|
|
|
|
|
*/
|
|
|
|
|
public function tour_apart_order_exec($group_type, $vas, $request_info, $guestlist, $grd, $total_order_index)
|
|
|
|
|
public function tour_apart_order_exec($group_type, $vas, $request_info, $guestlist=null, $grd, $total_order_index)
|
|
|
|
|
{
|
|
|
|
|
if (empty($grd)) {
|
|
|
|
|
return $total_order_index;
|
|
|
|
@ -206,6 +206,10 @@ class Tulanduo
|
|
|
|
|
// ->setRoomStandard($request_info->GCI_HotelRequest) // 住房标准
|
|
|
|
|
->setRouteStandard($request_info->GCI_Request) // 行程服务标准
|
|
|
|
|
;
|
|
|
|
|
if ($guestlist===null) {
|
|
|
|
|
$g_cold_str = array_map(function ($ele){return $ele->GRD_COLD_SN;}, $vo['details']);
|
|
|
|
|
$guestlist = $this->ci->BIZ_order->get_guestlist(implode(',',$g_cold_str));
|
|
|
|
|
}
|
|
|
|
|
foreach ($guestlist as $key => $vg) {
|
|
|
|
|
$this->ci->tldOrderBuilder->setCustomersName($key, $vg->MemberName )
|
|
|
|
|
->setCustomersPeopleType($key, (calc_age_type($vg->BirthDay)==1 ? "成人" : "儿童"))
|
|
|
|
@ -247,10 +251,19 @@ class Tulanduo
|
|
|
|
|
->setScheduleDetailsDinner($kd, (trim($vgrd->GRD_Meal_S)==="" ? 0 : 1 ))
|
|
|
|
|
->setScheduleDetailsLunch($kd, (trim($vgrd->GRD_Meal_L)==="" ? 0 : 1 ))
|
|
|
|
|
;
|
|
|
|
|
if (isset($vgrd->hotel_checkin)) {
|
|
|
|
|
$this->ci->tldOrderBuilder->setRoomStandard(trim($vgrd->hotel_checkin));
|
|
|
|
|
}
|
|
|
|
|
if (isset($vgrd->to_traffic)) {
|
|
|
|
|
$this->ci->tldOrderBuilder->setToTraffic(trim($vgrd->to_traffic));
|
|
|
|
|
}
|
|
|
|
|
if (isset($vgrd->back_traffic)) {
|
|
|
|
|
$this->ci->tldOrderBuilder->setBackTraffic(trim($vgrd->back_traffic));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 查询是否变更 TODO: deprecated at 2019-05
|
|
|
|
|
// 查询是否变更 deprecated at 2019-05
|
|
|
|
|
$sync_orderstate = 10;
|
|
|
|
|
$this->ci->tldOrderBuilder->clearModifyLogInfo();
|
|
|
|
|
$resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
|
|
|
|
@ -292,7 +305,7 @@ log_message('error',$resp);
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function tour_apart($all_pag_info)
|
|
|
|
|
public function tour_apart($all_pag_info, $need_complete=false)
|
|
|
|
|
{
|
|
|
|
|
$apart = array(); $ret = array();
|
|
|
|
|
foreach ($all_pag_info as $key => $pag) {
|
|
|
|
@ -357,21 +370,199 @@ log_message('error',$resp);
|
|
|
|
|
* @Date: 2019-06-04 11:47:38
|
|
|
|
|
* @Desc: 发送商务订单计划
|
|
|
|
|
*/
|
|
|
|
|
public function push_biz($vas=null, $gri_ordertype='227002')
|
|
|
|
|
public function push_biz($vas=null)
|
|
|
|
|
{
|
|
|
|
|
$userId = $this->send_host["1"]["userId"];
|
|
|
|
|
$userKey = $this->send_host["1"]["key"];
|
|
|
|
|
$gri_sn = $vas->GRI_SN;
|
|
|
|
|
$vas_sn = $vas->VAS_SN;
|
|
|
|
|
$vei_sn = $vas->VAS_VEI_SN;
|
|
|
|
|
$grd_info = $this->ci->Group_model->get_vendor_plan_info($gri_sn, $vei_sn);
|
|
|
|
|
$grd_info = $this->ci->Group_model->get_vendor_plan_info($gri_sn, $vei_sn, true);
|
|
|
|
|
if (empty($grd_info)) {
|
|
|
|
|
$this->ci->Group_model->set_plan_received($vas_sn);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$route_name = "";
|
|
|
|
|
$order_type = 1;
|
|
|
|
|
$COLD_SN_str = implode(',', array_map( function($element){return $element->GRD_COLD_SN;}, $grd_info )) ;
|
|
|
|
|
$all_colds = $this->ci->BIZ_order->get_all_cold($COLD_SN_str);
|
|
|
|
|
$coli_sn = $all_colds[0]->COLI_SN;
|
|
|
|
|
$train_coldsn_arr = array();$train_order = array();
|
|
|
|
|
$pag_coldsn_arr = array();$pag_order = array();
|
|
|
|
|
foreach ($all_colds as $kd => $vcold) {
|
|
|
|
|
if (strval($vcold->COLD_ServiceType)==='2') {
|
|
|
|
|
$train_coldsn_arr[] = $vcold->COLD_SN;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (strval($vcold->COLD_ServiceType)==='D') {
|
|
|
|
|
$pag_coldsn_arr[] = $vcold->COLD_SN;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( ! empty($train_coldsn_arr)) {
|
|
|
|
|
$route_name .= $route_name==="" ? "" : "+";
|
|
|
|
|
$route_name .= "火车票预订";
|
|
|
|
|
$order_type = 1;
|
|
|
|
|
$train_order = $this->ci->BIZ_order->get_train_flight_order(implode(',', $train_coldsn_arr));
|
|
|
|
|
$agcOrderNo = $vas->GRI_Name . "-" . $train_order[0]->city_code;
|
|
|
|
|
$last_date = count($train_order)-1;
|
|
|
|
|
$end_date = strstr($train_order[$last_date]->COLD_EndDate, " ", true);
|
|
|
|
|
$this->ci->tldOrderBuilder->setUserId($userId)
|
|
|
|
|
->setKey($userKey)
|
|
|
|
|
->setOrderType($order_type)
|
|
|
|
|
->setRouteName($route_name)
|
|
|
|
|
->setRouteType("火车票预订")
|
|
|
|
|
->setAgcOrderNo($agcOrderNo)
|
|
|
|
|
->setAdultNum($train_order[0]->adult_num)
|
|
|
|
|
->setChildNum($train_order[0]->child_num)
|
|
|
|
|
->setDestination($train_order[0]->city_name)
|
|
|
|
|
->setTravelDate(strstr($train_order[0]->COLD_StartDate, " ", true))
|
|
|
|
|
->setLeavedDate($end_date)
|
|
|
|
|
;
|
|
|
|
|
$train_guest_list = $this->ci->BIZ_order->get_guestlist(implode(',', $train_coldsn_arr));
|
|
|
|
|
// 客人列表
|
|
|
|
|
foreach ($train_guest_list as $key => $vg) {
|
|
|
|
|
$this_otherinfo = "";
|
|
|
|
|
$this->ci->tldOrderBuilder->setCustomersName($key, $vg->BPE_FirstName . " " . $vg->BPE_LastName )
|
|
|
|
|
->setCustomersPeopleType($key, ($vg->BPE_GuestType==1 ? "成人" : "儿童"))
|
|
|
|
|
->setCustomersDocumentType($key, "护照") // Passport No.
|
|
|
|
|
->setCustomersDocumentNo($key, $vg->BPE_Passport)
|
|
|
|
|
;
|
|
|
|
|
$this_otherinfo .= $this->ci->BIZ_order->GetNationalityName($vg->BPE_Nationality);
|
|
|
|
|
// todo:电话
|
|
|
|
|
// if (trim($vf['cold'][0]->GUT_TEL) != "" && $key===0) {
|
|
|
|
|
// $this_otherinfo .= "; 电话:";
|
|
|
|
|
// $this_otherinfo .= trim($vf["cold"][0]->GUT_POST)!=="" ? "+".trim($vf["cold"][0]->GUT_POST) : "" ;
|
|
|
|
|
// $this_otherinfo .= " " . trim($vf["cold"][0]->GUT_TEL);
|
|
|
|
|
// $this->ci->tldOrderBuilder->setCustomersOtherInfo($key, $this_otherinfo);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
$s_index = 0;
|
|
|
|
|
foreach ($train_order as $train) {
|
|
|
|
|
$this_content = '';
|
|
|
|
|
$this_content .= $train->departure_date . " " . $train->depart_station . "-" . $train->arrival_station . " " . $train->FlightsNo ;
|
|
|
|
|
$this_content .= "(" . $train->duration . ")" . " " . $train->cabin_name . " " . $train->adultcost . "元\r\n";
|
|
|
|
|
$this_content .= "请购票成功后通知外联。";
|
|
|
|
|
if (trim($train->TicketAddress) != '') {
|
|
|
|
|
$this_content .= "并于客人入住前两天,快递送达客人酒店,谢谢!\r\n";
|
|
|
|
|
$this_content .= $train->TicketAddress;
|
|
|
|
|
}
|
|
|
|
|
$this->ci->tldOrderBuilder->setScheduleDetailsTitle($s_index, $train->departure_date)
|
|
|
|
|
->setScheduleDetailsContent($s_index, $this_content)
|
|
|
|
|
;
|
|
|
|
|
$s_index++;
|
|
|
|
|
}
|
|
|
|
|
$this->ci->tldOrderBuilder->clearModifyLogInfo();
|
|
|
|
|
$resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
|
|
|
|
|
$response = json_decode($resp);
|
|
|
|
|
$sync_orderstate = 10;
|
|
|
|
|
$vps_sn = 0;
|
|
|
|
|
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" => strstr($train_order[0]->COLD_StartDate, " ", true)
|
|
|
|
|
,"VPS_endDate" => $end_date
|
|
|
|
|
,"VPS_sendHost" => $userId
|
|
|
|
|
,"VPS_externalId" => $response->responseData->orderId
|
|
|
|
|
,"VPS_externalorderType" => $order_type
|
|
|
|
|
,"VPS_externalorderState" => $sync_orderstate
|
|
|
|
|
,"VPS_sendTime" => date('Y-m-d H:i:s')
|
|
|
|
|
);
|
|
|
|
|
if ($vps_sn === 0) {
|
|
|
|
|
$sync_id = $this->ci->Group_model->insert_VendorPlanSync($sync_ret);
|
|
|
|
|
$this->ci->BIZ_order->insert_biz_order_log($coli_sn, "vendorPlanSendout_");
|
|
|
|
|
}
|
|
|
|
|
/** VendorArrangeState VAS_IsReceive */
|
|
|
|
|
$this->ci->Group_model->set_plan_received($vas_sn);
|
|
|
|
|
}
|
|
|
|
|
echo ($this->ci->tldOrderBuilder->getBizContent());
|
|
|
|
|
}
|
|
|
|
|
if ( ! empty($pag_coldsn_arr)) {
|
|
|
|
|
$this->biz_pag_order_exec($vas,$grd_info);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function biz_pag_order_exec($vas, $grd)
|
|
|
|
|
{
|
|
|
|
|
if (empty($grd)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 补全小包价的日程
|
|
|
|
|
$complete_grd = array();
|
|
|
|
|
$special_grd = array();
|
|
|
|
|
$normal_grd = array();
|
|
|
|
|
// object 在foreach中自身会被改变, 先转换成array
|
|
|
|
|
$grd = json_decode(json_encode($grd), true);
|
|
|
|
|
foreach ($grd as $kp => $vpag) {
|
|
|
|
|
$hotels_traffic = $this->ci->BIZ_order->get_package_order($vpag['GRD_COLD_SN']);
|
|
|
|
|
$vpag['GRD_Hotel'] = $hotels_traffic[0]->POI_Hotel;
|
|
|
|
|
$vpag['to_traffic'] = $hotels_traffic[0]->POI_Hotel;
|
|
|
|
|
$vpag['back_traffic'] = $hotels_traffic[0]->POI_Hotel;
|
|
|
|
|
// if (trim($hotels_traffic[0]->POI_HotelAddress) != "") {
|
|
|
|
|
// $vpag['GRD_Hotel'] .= "\r\n酒店地址:" . $hotels_traffic[0]->POI_HotelAddress;
|
|
|
|
|
// }
|
|
|
|
|
$vpag['hotel_checkin'] = trim($hotels_traffic[0]->POI_HotelCheckInName)!=="" ? "入住人:".$hotels_traffic[0]->POI_HotelCheckInName : "";
|
|
|
|
|
$vpag['hotel_checkin'] .= trim($hotels_traffic[0]->POI_HotelCheckIn)!=="" ? " 入住日期:".$hotels_traffic[0]->POI_HotelCheckIn : "";
|
|
|
|
|
if ($hotels_traffic[0]->POI_FlightsNo) {
|
|
|
|
|
$vpag['GRD_Traffic'] = $hotels_traffic[0]->POI_FlightsNo;
|
|
|
|
|
if ($hotels_traffic[0]->POI_FromCity || $hotels_traffic[0]->POI_ToCity) {
|
|
|
|
|
$vpag['GRD_Traffic'] .= ", (" . $hotels_traffic[0]->POI_FromCity . "-" . $hotels_traffic[0]->POI_ToCity . ")";
|
|
|
|
|
}
|
|
|
|
|
if ($hotels_traffic[0]->POI_Time || $hotels_traffic[0]->POI_EndTime) {
|
|
|
|
|
$vpag['GRD_Traffic'] .= ", " . $hotels_traffic[0]->POI_Time . " " . $hotels_traffic[0]->POI_EndTime;
|
|
|
|
|
}
|
|
|
|
|
if ($hotels_traffic[0]->POI_AirPort) {
|
|
|
|
|
$vpag['GRD_Traffic'] .= ", " . $hotels_traffic[0]->POI_AirPort;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($this->ci->trippest->special_route[$vpag['PAG_Code']])) {
|
|
|
|
|
$this_pag_total_day = $this->ci->trippest->special_route[$vpag['PAG_Code']]['day'];
|
|
|
|
|
$this_code = $vpag['PAG_Code'];
|
|
|
|
|
for($p=0; $p<$this_pag_total_day; $p++) {
|
|
|
|
|
$vpag['GRD_OrderDate'] = date("Y-m-d", strtotime("+$p day", strtotime($vpag['day_no_raw'])));
|
|
|
|
|
$vpag['day_no_raw'] = $vpag['GRD_OrderDate'];
|
|
|
|
|
$vpag['PAG_Code'] = $this->ci->trippest->special_route[$this_code]['code'][$p];
|
|
|
|
|
$pag_detail = $this->ci->BIZ_order->get_packageDetails("'" . $vpag['PAG_Code'] . "'", implode(",",$this->vendor_ids), false);
|
|
|
|
|
$vpag['PAG_Title'] = $pag_detail[0]->PAG2_Name;
|
|
|
|
|
$vpag['GRD_Landscape'] = $vpag['PAG_Title'];
|
|
|
|
|
$vpag['GRD_Meal_L'] = (in_array($pag_detail[0]->PAG_Meal, array('61002', '61004')) ? "1" : "");
|
|
|
|
|
$vpag['GRD_Meal_S'] = (in_array($pag_detail[0]->PAG_Meal, array('61003', '61004')) ? "1" : "");
|
|
|
|
|
$special_grd[] = $vpag;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$pag_detail = $this->ci->BIZ_order->get_packageDetails("'" . $vpag['PAG_Code'] . "'", implode(",",$this->vendor_ids), false);
|
|
|
|
|
$vpag['GRD_Meal_L'] = (in_array($pag_detail[0]->PAG_Meal, array('61002', '61004')) ? "1" : "");
|
|
|
|
|
$vpag['GRD_Meal_S'] = (in_array($pag_detail[0]->PAG_Meal, array('61003', '61004')) ? "1" : "");
|
|
|
|
|
// 接送的子订单行程
|
|
|
|
|
if (isset($vpag['PAG_sub_sn']) && $vpag['PAG_sub_sn'] != 0) {
|
|
|
|
|
$sub_pag = $this->ci->BIZ_order->get_sub_pag_info($vpag['PAG_sub_sn']);
|
|
|
|
|
if (! empty($sub_pag)) {
|
|
|
|
|
$vpag['GRD_Landscape'] = "[" . $sub_pag->PAGS_CN_Title . "] " . $vpag['GRD_Landscape'];
|
|
|
|
|
if (strval($sub_pag->PAGS_Direction) === '0') {
|
|
|
|
|
$vpag['to_traffic'] = $vpag['GRD_Traffic'];
|
|
|
|
|
} else {
|
|
|
|
|
$vpag['back_traffic'] = $vpag['GRD_Traffic'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$normal_grd[] = $vpag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$complete_grd = array_merge($special_grd, $normal_grd);
|
|
|
|
|
$complete_grd = json_decode(json_encode($complete_grd));
|
|
|
|
|
$grd_apart_info = $this->tour_apart($complete_grd);
|
|
|
|
|
// echo json_encode($grd_apart_info);exit;
|
|
|
|
|
$request_info = $this->ci->Group_model->get_plan_request($vas->GRI_SN);
|
|
|
|
|
$big_order_index = 0;
|
|
|
|
|
foreach ($grd_apart_info as $group_key => $grd_part) {
|
|
|
|
|
$big_order_index = $this->tour_apart_order_exec($group_key, $vas, $request_info, null, $grd_part, $big_order_index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 发送目的地项目组预订计划到图兰朵地接系统
|
|
|
|
|
*/
|
|
|
|
@ -427,7 +618,7 @@ log_message('error',$resp);
|
|
|
|
|
if ( ! in_array($cold->COLD_SN, $processed_cold) && $cold->pag_code != '') {
|
|
|
|
|
$processed_cold[] = $cold->COLD_SN;
|
|
|
|
|
$all_package = $this->ci->trippest->tour_code($cold->pag_code);
|
|
|
|
|
$pag_info = $this->ci->BIZ_order->get_packageDetails(my_implode("'",",",$all_package));
|
|
|
|
|
$pag_info = $this->ci->BIZ_order->get_packageDetails(my_implode("'",",",$all_package), implode(",",$this->vendor_ids));
|
|
|
|
|
if ($set_pvt==='1') {
|
|
|
|
|
$fill_order[0]["cold"][] = $cold;
|
|
|
|
|
} else {
|
|
|
|
@ -443,7 +634,7 @@ log_message('error',$resp);
|
|
|
|
|
$multi_package = $this->ci->trippest->tour_code($vcd->pag_code);
|
|
|
|
|
$pvt_pagcode = array_merge($pvt_pagcode, $multi_package);
|
|
|
|
|
}
|
|
|
|
|
$fill_order[0]["package_info"] = $this->ci->BIZ_order->get_packageDetails(my_implode("'",",",$pvt_pagcode));
|
|
|
|
|
$fill_order[0]["package_info"] = $this->ci->BIZ_order->get_packageDetails(my_implode("'",",",$pvt_pagcode), implode(",",$this->vendor_ids));
|
|
|
|
|
}
|
|
|
|
|
// $fill_order = array_values($fill_order);
|
|
|
|
|
$i=0;
|
|
|
|
@ -577,7 +768,7 @@ log_message('error',$resp);
|
|
|
|
|
$schedule_obj[$e_day]['date'] = $e_day;
|
|
|
|
|
$fill_date[] = $e_day;
|
|
|
|
|
$schedule_obj[$e_day]['code'] = $this->ci->trippest->special_route[$vs->PAG_Code]['code'][$j];
|
|
|
|
|
$pag_detail = $this->ci->BIZ_order->get_packageDetails("'" . $schedule_obj[$e_day]['code'] . "'");
|
|
|
|
|
$pag_detail = $this->ci->BIZ_order->get_packageDetails("'" . $schedule_obj[$e_day]['code'] . "'", implode(",",$this->vendor_ids));
|
|
|
|
|
$schedule_obj[$e_day]['title'] = $pag_detail[0]->PAG2_Name;
|
|
|
|
|
$schedule_obj[$e_day]['lunch'] = (in_array($pag_detail[0]->PAG_Meal, array('61002', '61004')) ? 1 : 0);
|
|
|
|
|
$schedule_obj[$e_day]['dinner'] = (in_array($pag_detail[0]->PAG_Meal, array('61003', '61004')) ? 1 : 0);
|
|
|
|
|