|
|
@ -3,6 +3,8 @@
|
|
|
|
if (!defined('BASEPATH'))
|
|
|
|
if (!defined('BASEPATH'))
|
|
|
|
exit('No direct script access allowed');
|
|
|
|
exit('No direct script access allowed');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GLOBAL $__HAINA_VEI__;
|
|
|
|
|
|
|
|
|
|
|
|
class Tulanduo extends CI_Controller
|
|
|
|
class Tulanduo extends CI_Controller
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/** Live */
|
|
|
|
/** Live */
|
|
|
@ -56,6 +58,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
parent::__construct();
|
|
|
|
parent::__construct();
|
|
|
|
mb_regex_encoding("UTF-8");
|
|
|
|
mb_regex_encoding("UTF-8");
|
|
|
|
bcscale(4);
|
|
|
|
bcscale(4);
|
|
|
|
|
|
|
|
$GLOBALS['__HAINA_VEI__'] = 30561;
|
|
|
|
$this->load->helper('array');
|
|
|
|
$this->load->helper('array');
|
|
|
|
$this->load->library('trippest');
|
|
|
|
$this->load->library('trippest');
|
|
|
|
$this->load->model('Group_model');
|
|
|
|
$this->load->model('Group_model');
|
|
|
@ -65,7 +68,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
$this->load->model('TuLanDuo_addOrUpdateRouteOrderContentBuilder', 'tldOrderBuilder');
|
|
|
|
$this->load->model('TuLanDuo_addOrUpdateRouteOrderContentBuilder', 'tldOrderBuilder');
|
|
|
|
// $this->output->enable_profiler(TRUE);
|
|
|
|
// $this->output->enable_profiler(TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
$this->vendor_ids = $this->trippest->tulanduo_vei_sn;
|
|
|
|
$this->vendor_ids = array(1343,30548,29188);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function order_push($order=null)
|
|
|
|
public function order_push($order=null)
|
|
|
@ -243,6 +246,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function push_trippest($vas=null)
|
|
|
|
public function push_trippest($vas=null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
log_message('error',__LINE__);
|
|
|
|
// return "[Tulanduo>push_trippest] Done. "; // test
|
|
|
|
// return "[Tulanduo>push_trippest] Done. "; // test
|
|
|
|
/** 目的地 */
|
|
|
|
/** 目的地 */
|
|
|
|
$userId = $this->send_host["30"]["userId"];
|
|
|
|
$userId = $this->send_host["30"]["userId"];
|
|
|
@ -262,33 +266,63 @@ class Tulanduo extends CI_Controller
|
|
|
|
$orderinfo = $this->BIZ_order->get_orderinfo_detail($gri_sn, $vei_sn_str);
|
|
|
|
$orderinfo = $this->BIZ_order->get_orderinfo_detail($gri_sn, $vei_sn_str);
|
|
|
|
if(empty($orderinfo)) {return "[Tulanduo>push_trippest] Not found order detail. ";}
|
|
|
|
if(empty($orderinfo)) {return "[Tulanduo>push_trippest] Not found order detail. ";}
|
|
|
|
$COLI_ID = $orderinfo[0]->COLI_ID;
|
|
|
|
$COLI_ID = $orderinfo[0]->COLI_ID;
|
|
|
|
$set_pvt = strval($orderinfo[0]->COLI_PVT);
|
|
|
|
$set_pvt = strval($orderinfo[0]->is_pvt);
|
|
|
|
$travelFees = $this->BIZ_order->get_paymentDetails($COLI_ID);
|
|
|
|
// TODO 增加收款方参数, 增加代收款项
|
|
|
|
|
|
|
|
log_message('error',__LINE__);
|
|
|
|
|
|
|
|
$vei_with_haina = $GLOBALS['__HAINA_VEI__'] . "," . $vei_sn_str;
|
|
|
|
|
|
|
|
$all_payment = $this->BIZ_order->get_paymentDetails($COLI_ID, $vei_with_haina);
|
|
|
|
|
|
|
|
$travel_fees = array();
|
|
|
|
|
|
|
|
$replace_collections = array();
|
|
|
|
|
|
|
|
log_message('error',__LINE__);
|
|
|
|
|
|
|
|
foreach ($all_payment as $kall => $vall) {
|
|
|
|
|
|
|
|
if (in_array($vall->payment_vei, array($GLOBALS['__HAINA_VEI__'], 0)) ) {
|
|
|
|
|
|
|
|
$travel_fees[] = $vall;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$replace_collections[] = $vall;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log_message('error',__LINE__);
|
|
|
|
// 按产品拆分 todo:按订单类型拆分? 单团/拼团
|
|
|
|
// 按产品拆分 todo:按订单类型拆分? 单团/拼团
|
|
|
|
$fill_order = array();
|
|
|
|
$fill_order = array();
|
|
|
|
$processed_date = array();
|
|
|
|
$processed_date = array();
|
|
|
|
$processed_cold = array();
|
|
|
|
$processed_cold = array();
|
|
|
|
foreach ($orderinfo as $ko => $cold) {
|
|
|
|
foreach ($orderinfo as $ko => $cold) {
|
|
|
|
|
|
|
|
// $cold->package_info = array();
|
|
|
|
if ( ! in_array($cold->COLD_SN, $processed_cold) && $cold->pag_code != '') {
|
|
|
|
if ( ! in_array($cold->COLD_SN, $processed_cold) && $cold->pag_code != '') {
|
|
|
|
$processed_cold[] = $cold->COLD_SN;
|
|
|
|
$processed_cold[] = $cold->COLD_SN;
|
|
|
|
$all_package = $this->trippest->tour_code($cold->pag_code);
|
|
|
|
$all_package = $this->trippest->tour_code($cold->pag_code);
|
|
|
|
$pag_info = $this->BIZ_order->get_packageDetails(my_implode("'",",",$all_package));
|
|
|
|
$pag_info = $this->BIZ_order->get_packageDetails(my_implode("'",",",$all_package));
|
|
|
|
if ($set_pvt==='1') {
|
|
|
|
if ($set_pvt==='1') {
|
|
|
|
|
|
|
|
// $cold->package_info[] = $cold->pag_code;
|
|
|
|
$fill_order[0]["cold"][] = $cold;
|
|
|
|
$fill_order[0]["cold"][] = $cold;
|
|
|
|
$fill_order[0]["package_info"] = $pag_info; // todo ??? 这里是否丢失了产品
|
|
|
|
// $fill_order[0]["package_info"] = $pag_info; // todo ??? 这里是否丢失了产品
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$fill_order[$cold->pag_code]["cold"][] = $cold;
|
|
|
|
$fill_order[$cold->pag_code]["cold"][] = $cold;
|
|
|
|
$fill_order[$cold->pag_code]["package_info"] = $pag_info;
|
|
|
|
$fill_order[$cold->pag_code]["package_info"] = $pag_info;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 多产品PVT的合并
|
|
|
|
|
|
|
|
$pvt_pagcode = array();
|
|
|
|
|
|
|
|
if ($set_pvt==='1') {
|
|
|
|
|
|
|
|
foreach ($fill_order[0]['cold'] as $kcd => $vcd) {
|
|
|
|
|
|
|
|
$multi_package = $this->trippest->tour_code($vcd->pag_code);
|
|
|
|
|
|
|
|
$pvt_pagcode = array_merge($pvt_pagcode, $multi_package);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$fill_order[0]["package_info"] = $this->BIZ_order->get_packageDetails(my_implode("'",",",$pvt_pagcode));
|
|
|
|
|
|
|
|
}
|
|
|
|
// $fill_order = array_values($fill_order);
|
|
|
|
// $fill_order = array_values($fill_order);
|
|
|
|
$i=0;
|
|
|
|
$i=0;
|
|
|
|
$take_apart = count($fill_order)>1 ? true : false;
|
|
|
|
$take_apart = count($fill_order)>1 ? true : false;
|
|
|
|
foreach ($fill_order as $kf => $vf) {
|
|
|
|
foreach ($fill_order as $kf => $vf) {
|
|
|
|
$i++;
|
|
|
|
$i++;
|
|
|
|
$this->tldOrderBuilder->resetBizContent();
|
|
|
|
$this->tldOrderBuilder->resetBizContent();
|
|
|
|
$order_type = intval($vf["package_info"][0]->PAG_ExtendType)===39009 ? 1 : 2;
|
|
|
|
$order_type = $set_pvt;
|
|
|
|
|
|
|
|
if ($set_pvt==='0') {
|
|
|
|
|
|
|
|
$code_type_arr = array_map(function($pag) { return intval($pag->PAG_ExtendType); }, $vf["package_info"]);
|
|
|
|
|
|
|
|
$order_type = in_array(39009, $code_type_arr) ? 1 : 2;
|
|
|
|
|
|
|
|
// $order_type = intval($vf["package_info"][0]->PAG_ExtendType)===39009 ? 1 : 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
$last_code = count($vf["package_info"])-1;
|
|
|
|
$last_code = count($vf["package_info"])-1;
|
|
|
|
$last_date = count($vf["cold"])-1;
|
|
|
|
$last_date = count($vf["cold"])-1;
|
|
|
|
$tour_code = "";
|
|
|
|
$tour_code = "";
|
|
|
@ -306,10 +340,8 @@ class Tulanduo extends CI_Controller
|
|
|
|
$tour_code = mb_strtoupper($vf["cold"][0]->pag_code);
|
|
|
|
$tour_code = mb_strtoupper($vf["cold"][0]->pag_code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$agcOrderNo .= "(" . $vf["cold"][0]->operator . ")";
|
|
|
|
$agcOrderNo .= "(" . $vf["cold"][0]->operator . ")";
|
|
|
|
$order_remark = "";
|
|
|
|
$order_remark = ""; // todo
|
|
|
|
if (trim($vf['cold'][0]->GUT_TEL) != "") {
|
|
|
|
|
|
|
|
$order_remark = "预定人电话:" . trim($vf["cold"][0]->GUT_TEL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$COLD_SN_str = implode(',', array_map( function($element){return $element->COLD_SN;}, $vf["cold"] )) ;
|
|
|
|
$COLD_SN_str = implode(',', array_map( function($element){return $element->COLD_SN;}, $vf["cold"] )) ;
|
|
|
|
$guestlist = $this->BIZ_order->get_guestlist($COLD_SN_str);
|
|
|
|
$guestlist = $this->BIZ_order->get_guestlist($COLD_SN_str);
|
|
|
|
$this->tldOrderBuilder->setUserId($userId)
|
|
|
|
$this->tldOrderBuilder->setUserId($userId)
|
|
|
@ -329,12 +361,23 @@ class Tulanduo extends CI_Controller
|
|
|
|
// ->setToTraffic($toTraffic)
|
|
|
|
// ->setToTraffic($toTraffic)
|
|
|
|
// ->setBackTraffic($backTraffic)
|
|
|
|
// ->setBackTraffic($backTraffic)
|
|
|
|
;
|
|
|
|
;
|
|
|
|
|
|
|
|
// 客人列表
|
|
|
|
foreach ($guestlist as $key => $vg) {
|
|
|
|
foreach ($guestlist as $key => $vg) {
|
|
|
|
|
|
|
|
$this_otherinfo = "";
|
|
|
|
$this->tldOrderBuilder->setCustomersName($key, $vg->BPE_FirstName . " " . $vg->BPE_LastName )
|
|
|
|
$this->tldOrderBuilder->setCustomersName($key, $vg->BPE_FirstName . " " . $vg->BPE_LastName )
|
|
|
|
->setCustomersPeopleType($key, ($vg->BPE_GuestType==1 ? "成人" : "儿童"))
|
|
|
|
->setCustomersPeopleType($key, ($vg->BPE_GuestType==1 ? "成人" : "儿童"))
|
|
|
|
->setCustomersDocumentType($key, "护照") // Passport No.
|
|
|
|
->setCustomersDocumentType($key, "护照") // Passport No.
|
|
|
|
->setCustomersDocumentNo($key, $vg->BPE_Passport)
|
|
|
|
->setCustomersDocumentNo($key, $vg->BPE_Passport)
|
|
|
|
->setCustomersOtherInfo($key, $this->BIZ_order->GetNationalityName($vg->BPE_Nationality));
|
|
|
|
// ->setCustomersOtherInfo($key, $this->BIZ_order->GetNationalityName($vg->BPE_Nationality))
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
$this_otherinfo .= $this->BIZ_order->GetNationalityName($vg->BPE_Nationality);
|
|
|
|
|
|
|
|
if (trim($vf['cold'][0]->GUT_TEL) != "" && $key===0) {
|
|
|
|
|
|
|
|
// $order_remark = "预定人电话:" . trim($vf["cold"][0]->GUT_TEL);
|
|
|
|
|
|
|
|
$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->tldOrderBuilder->setCustomersOtherInfo($key, $this_otherinfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$scheduleDetails = $this->BIZ_order->get_scheduleDetails($COLD_SN_str);
|
|
|
|
$scheduleDetails = $this->BIZ_order->get_scheduleDetails($COLD_SN_str);
|
|
|
|
$schedule_obj = array();
|
|
|
|
$schedule_obj = array();
|
|
|
@ -363,6 +406,8 @@ class Tulanduo extends CI_Controller
|
|
|
|
if (trim($hotels[0]->POI_HotelAddress) != "") {
|
|
|
|
if (trim($hotels[0]->POI_HotelAddress) != "") {
|
|
|
|
$this_content .= "\r\n酒店地址:" . $hotels[0]->POI_HotelAddress;
|
|
|
|
$this_content .= "\r\n酒店地址:" . $hotels[0]->POI_HotelAddress;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this_content .= trim($hotels[0]->POI_HotelCheckInName)!=="" ? "\r\n入住人:".$hotels[0]->POI_HotelCheckInName : "";
|
|
|
|
|
|
|
|
$this_content .= trim($hotels[0]->POI_HotelCheckIn)!=="" ? "\r\n入住日期:".$hotels[0]->POI_HotelCheckIn : "";
|
|
|
|
if ($hotels[0]->POI_FlightsNo) {
|
|
|
|
if ($hotels[0]->POI_FlightsNo) {
|
|
|
|
$this_content .= "\r\n航/车次:" . $hotels[0]->POI_FlightsNo;
|
|
|
|
$this_content .= "\r\n航/车次:" . $hotels[0]->POI_FlightsNo;
|
|
|
|
if ($hotels[0]->POI_FromCity || $hotels[0]->POI_ToCity) {
|
|
|
|
if ($hotels[0]->POI_FromCity || $hotels[0]->POI_ToCity) {
|
|
|
@ -457,7 +502,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 拆分的订单团款录第一个
|
|
|
|
// 拆分的订单团款录第一个
|
|
|
|
if ($i===1) {
|
|
|
|
if ($i===1) {
|
|
|
|
foreach ($travelFees as $kf => $vf) {
|
|
|
|
foreach ($travel_fees as $kf => $vf) {
|
|
|
|
$this->tldOrderBuilder->setTravelFeesType($kf, "Per Group")
|
|
|
|
$this->tldOrderBuilder->setTravelFeesType($kf, "Per Group")
|
|
|
|
->setTravelFeesMoney($kf, $vf->GAI_SSJE)
|
|
|
|
->setTravelFeesMoney($kf, $vf->GAI_SSJE)
|
|
|
|
->setTravelFeesNum($kf, 1)
|
|
|
|
->setTravelFeesNum($kf, 1)
|
|
|
@ -465,32 +510,21 @@ class Tulanduo extends CI_Controller
|
|
|
|
->setTravelFeesSumMoney($kf, $vf->GAI_SSJE)
|
|
|
|
->setTravelFeesSumMoney($kf, $vf->GAI_SSJE)
|
|
|
|
->setTravelFeesRemark($kf, $vf->GAI_Memo);
|
|
|
|
->setTravelFeesRemark($kf, $vf->GAI_Memo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($replace_collections as $krc => $vrc) {
|
|
|
|
|
|
|
|
$this->tldOrderBuilder->setReplaceCollectionsType($krc, "Per Group")
|
|
|
|
|
|
|
|
->setReplaceCollectionsMoney($krc, $vrc->GAI_SSJE)
|
|
|
|
|
|
|
|
->setReplaceCollectionsRemark($krc, $vrc->GAI_Memo);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 查询是否变更
|
|
|
|
// 查询是否变更 TODO deprecated
|
|
|
|
$sync_orderstate = 10;
|
|
|
|
$sync_orderstate = 10;
|
|
|
|
$vps_sn = 0;
|
|
|
|
$vps_sn = 0;
|
|
|
|
$vendor_orderid = 0;
|
|
|
|
$vendor_orderid = 0;
|
|
|
|
$plan_detail_page_url = "http://p.mycht.cn/Cooperate/Plan_Detail.aspx?GSN=" . $gri_sn;
|
|
|
|
$this->tldOrderBuilder->clearModifyLogInfo();
|
|
|
|
$plan_detail_page = "<br>计划下载:<a href='$plan_detail_page_url'>$plan_detail_page_url</a><br>";
|
|
|
|
|
|
|
|
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_externalId;
|
|
|
|
|
|
|
|
$sync_orderstate = 11;
|
|
|
|
|
|
|
|
$modifyLogInfo = "$plan_detail_page<br>$change_info<br>";
|
|
|
|
|
|
|
|
$this->tldOrderBuilder->setOrderId($vendor_orderid)
|
|
|
|
|
|
|
|
->setModifyLogInfo($modifyLogInfo)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$modifyLogInfo = $plan_detail_page;
|
|
|
|
|
|
|
|
$this->tldOrderBuilder->clearModifyLogInfo();
|
|
|
|
|
|
|
|
$this->tldOrderBuilder->setModifyLogInfo($modifyLogInfo)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$resp = $this->excute_curl($this->neworder_url, $this->tldOrderBuilder);
|
|
|
|
$resp = $this->excute_curl($this->neworder_url, $this->tldOrderBuilder);
|
|
|
|
// $resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test
|
|
|
|
// $resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test
|
|
|
|
|
|
|
|
echo $this->tldOrderBuilder->getBizContent();
|
|
|
|
|
|
|
|
log_message('error',$resp);
|
|
|
|
$response = json_decode($resp);
|
|
|
|
$response = json_decode($resp);
|
|
|
|
if ($response->status == 1) {
|
|
|
|
if ($response->status == 1) {
|
|
|
|
/** VendorPlanSync */
|
|
|
|
/** VendorPlanSync */
|
|
|
@ -516,7 +550,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
$this->Group_model->set_plan_received($vas_sn);
|
|
|
|
$this->Group_model->set_plan_received($vas_sn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "[Tulanduo>push_trippest] Done. ";
|
|
|
|
return "[Tulanduo>push_trippest] Done. " . $COLI_ID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function tourguide_update($input, $vps, $eva)
|
|
|
|
public function tourguide_update($input, $vps, $eva)
|
|
|
|