|
|
|
@ -5,39 +5,38 @@ if (!defined('BASEPATH'))
|
|
|
|
|
|
|
|
|
|
class Tulanduo extends CI_Controller
|
|
|
|
|
{
|
|
|
|
|
// public $special_route = array(
|
|
|
|
|
// "BJSIC-42" => "'BJSIC-41','BJSIC-42'"
|
|
|
|
|
// ,"BJSIC-43" => "'BJSIC-41','BJSIC-42','BJSIC-43'"
|
|
|
|
|
// ,"XASIC-42" => "'XASIC-41','XASIC-42'"
|
|
|
|
|
// );
|
|
|
|
|
// public $special_route_name = array(
|
|
|
|
|
// "BJSIC-42" => "北京精品两日游(目的地BJSIC-42)"
|
|
|
|
|
// ,"BJSIC-43" => "北京精品三日游(目的地BJSIC-43)"
|
|
|
|
|
// ,"XASIC-42" => "西安精品两日游(目的地XASIC-42)"
|
|
|
|
|
/** Live */
|
|
|
|
|
/**
|
|
|
|
|
目的地
|
|
|
|
|
$this->userId = "1134";
|
|
|
|
|
$this->key = "73d180d05d425fd192e1c5b3097e75ff";
|
|
|
|
|
桂林海纳国旅
|
|
|
|
|
$this->userId = "18";
|
|
|
|
|
$this->key = "d05c25e6e6c5d4898161e0aaf700d9c7";
|
|
|
|
|
*/
|
|
|
|
|
// private $send_host = array(
|
|
|
|
|
// "30" => array(
|
|
|
|
|
// "userId" => 1134
|
|
|
|
|
// ,"key" => "73d180d05d425fd192e1c5b3097e75ff"
|
|
|
|
|
// )
|
|
|
|
|
// ,"1" => array(
|
|
|
|
|
// "userId" => 18
|
|
|
|
|
// ,"key" => "d05c25e6e6c5d4898161e0aaf700d9c7"
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
public $city_info = array(
|
|
|
|
|
"北京分公司" => array(
|
|
|
|
|
"PlanVEI_SN" => 1343
|
|
|
|
|
,"COLI_sourcetype" => 32090
|
|
|
|
|
,"routeType" => "北京目的地线路"
|
|
|
|
|
),
|
|
|
|
|
"总部" => array(
|
|
|
|
|
"PlanVEI_SN" => 1343
|
|
|
|
|
,"COLI_sourcetype" => 32090
|
|
|
|
|
,"routeType" => "北京目的地线路"
|
|
|
|
|
),
|
|
|
|
|
"西安分公司" => array(
|
|
|
|
|
"PlanVEI_SN" => 30548
|
|
|
|
|
,"COLI_sourcetype" => 32116
|
|
|
|
|
,"routeType" => "西安目的地线路"
|
|
|
|
|
),
|
|
|
|
|
"上海分公司" => array(
|
|
|
|
|
"PlanVEI_SN" => 29188
|
|
|
|
|
,"COLI_sourcetype" => 32112
|
|
|
|
|
,"routeType" => "上海目的地线路"
|
|
|
|
|
/** test
|
|
|
|
|
* 902 key:f56541ff40e1afba444d831c5a666195
|
|
|
|
|
*/
|
|
|
|
|
private $send_host = array(
|
|
|
|
|
"30" => array(
|
|
|
|
|
"userId" => 902
|
|
|
|
|
,"key" => "f56541ff40e1afba444d831c5a666195"
|
|
|
|
|
)
|
|
|
|
|
,"1" => array(
|
|
|
|
|
"userId" => 902
|
|
|
|
|
,"key" => "f56541ff40e1afba444d831c5a666195"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
// public $vendor_ids = array(1343,30548,29188);
|
|
|
|
|
|
|
|
|
|
// userId key
|
|
|
|
|
// 1343 2e47c3721e3ff6e816fe6b928d7acc7d
|
|
|
|
@ -49,8 +48,8 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
// public $detail_url = "http://dj.ltsoftware.net:9901/action/api/detailRouteOrder/";
|
|
|
|
|
public $neworder_url = "http://ltdj.ltsoftware.net:19919/action/api/addOrUpdateRouteOrder/";
|
|
|
|
|
// Live
|
|
|
|
|
// public $list_url = "http://djb3c.ltsoftware.net:9921/action/api/searchRouteOrder/";
|
|
|
|
|
// public $detail_url = "http://djb3c.ltsoftware.net:9921/action/api/detailRouteOrder/";
|
|
|
|
|
public $list_url = "http://djb3c.ltsoftware.net:9921/action/api/searchRouteOrder/";
|
|
|
|
|
public $detail_url = "http://djb3c.ltsoftware.net:9921/action/api/detailRouteOrder/";
|
|
|
|
|
// public $neworder_url = "http://djb3c.ltsoftware.net:9921/action/api/addOrUpdateRouteOrder/";
|
|
|
|
|
|
|
|
|
|
public function __construct(){
|
|
|
|
@ -61,20 +60,10 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
$this->load->library('trippest');
|
|
|
|
|
$this->load->model('Group_model');
|
|
|
|
|
$this->load->model('BIZ_orders_model', 'BIZ_order');
|
|
|
|
|
// $this->load->model('TuLanDuo_queryContentBuilder', 'tld_order');
|
|
|
|
|
$this->load->model('TuLanDuo_queryContentBuilder', 'tld_order');
|
|
|
|
|
$this->load->model('TuLanDuo_addOrUpdateRouteOrderContentBuilder', 'tldOrderBuilder');
|
|
|
|
|
// $this->output->enable_profiler(TRUE);
|
|
|
|
|
/** test
|
|
|
|
|
902 key:f56541ff40e1afba444d831c5a666195
|
|
|
|
|
*/
|
|
|
|
|
$this->userId = "902";
|
|
|
|
|
$this->key = "f56541ff40e1afba444d831c5a666195";
|
|
|
|
|
/** Live */
|
|
|
|
|
// 目的地
|
|
|
|
|
// $this->userId = "1134";
|
|
|
|
|
// $this->key = "73d180d05d425fd192e1c5b3097e75ff";
|
|
|
|
|
// 桂林海纳国旅
|
|
|
|
|
// $this->userId = "18";
|
|
|
|
|
// $this->key = "d05c25e6e6c5d4898161e0aaf700d9c7";
|
|
|
|
|
|
|
|
|
|
$this->vendor_ids = $this->trippest->tulanduo_vei_sn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -112,8 +101,8 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
{
|
|
|
|
|
// exit();
|
|
|
|
|
/** 目的地 test */
|
|
|
|
|
$this->userId = "902";
|
|
|
|
|
$this->key = "f56541ff40e1afba444d831c5a666195";
|
|
|
|
|
$userId = $this->send_host["30"]["userId"];
|
|
|
|
|
$userKey = $this->send_host["30"]["key"];
|
|
|
|
|
|
|
|
|
|
$gri_sn = $vas->GRI_SN;
|
|
|
|
|
$vas_sn = $vas->VAS_SN;
|
|
|
|
@ -126,7 +115,6 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
}
|
|
|
|
|
$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, $vei_sn_str);
|
|
|
|
|
if(empty($orderinfo)) {return;}
|
|
|
|
|
$COLI_ID = $orderinfo[0]->COLI_ID;
|
|
|
|
@ -143,7 +131,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
$pag_info = $this->BIZ_order->get_packageDetails(my_implode("'",",",$all_package));
|
|
|
|
|
if ($set_pvt==='1') {
|
|
|
|
|
$fill_order[0]["cold"][] = $cold;
|
|
|
|
|
$fill_order[0]["package_info"] = $pag_info;
|
|
|
|
|
$fill_order[0]["package_info"] = $pag_info; // todo ??? 这里是否丢失了产品
|
|
|
|
|
} else {
|
|
|
|
|
$fill_order[$cold->pag_code]["cold"][] = $cold;
|
|
|
|
|
$fill_order[$cold->pag_code]["package_info"] = $pag_info;
|
|
|
|
@ -159,7 +147,7 @@ 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;
|
|
|
|
|
$tour_code = mb_strtoupper($vf["cold"][0]->pag_code);
|
|
|
|
|
$tour_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);
|
|
|
|
@ -171,6 +159,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
$agcOrderNo = $vf["cold"][0]->COLI_GroupCode . "-" . $vf["package_info"][0]->city_code;
|
|
|
|
|
if ($take_apart===true) {
|
|
|
|
|
$agcOrderNo .= "-" . $i;
|
|
|
|
|
$tour_code = mb_strtoupper($vf["cold"][0]->pag_code);
|
|
|
|
|
}
|
|
|
|
|
$agcOrderNo .= "(" . $vf["cold"][0]->operator . ")";
|
|
|
|
|
$order_remark = "";
|
|
|
|
@ -179,8 +168,8 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
}
|
|
|
|
|
$COLD_SN_str = implode(',', array_map( function($element){return $element->COLD_SN;}, $vf["cold"] )) ;
|
|
|
|
|
$guestlist = $this->BIZ_order->get_guestlist($COLD_SN_str);
|
|
|
|
|
$this->tldOrderBuilder->setUserId($this->userId)
|
|
|
|
|
->setKey($this->key)
|
|
|
|
|
$this->tldOrderBuilder->setUserId($userId)
|
|
|
|
|
->setKey($userKey)
|
|
|
|
|
->setOrderType($order_type)
|
|
|
|
|
->setRouteName($routeName)
|
|
|
|
|
->setRouteType($vf["package_info"][0]->city_chinese . "目的地线路")
|
|
|
|
@ -341,7 +330,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
$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;
|
|
|
|
|
$vendor_orderid = $vps->VPS_externalId;
|
|
|
|
|
$sync_orderstate = 11;
|
|
|
|
|
$modifyLogInfo = "<br>$change_info<br>";
|
|
|
|
|
// $modifyLogInfo = "<br><a href='https://www.trippest.com'>https://www.trippest.com</a><br>";
|
|
|
|
@ -368,10 +357,11 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
,"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')
|
|
|
|
|
,"VPS_sendHost" => $userId
|
|
|
|
|
,"VPS_externalId" => $response->responseData->orderId
|
|
|
|
|
,"VPS_externalorderType" => $order_type
|
|
|
|
|
,"VPS_externalorderState" => $sync_orderstate
|
|
|
|
|
,"VPS_latestTime" => date('Y-m-d H:i:s')
|
|
|
|
|
);
|
|
|
|
|
if ($vps_sn === 0) {
|
|
|
|
|
$sync_id = $this->Group_model->insert_VendorPlanSync($sync_ret);
|
|
|
|
@ -386,6 +376,68 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function tourguide_update($input, $vps, $eva)
|
|
|
|
|
{
|
|
|
|
|
$ret['status'] = -1;
|
|
|
|
|
$ret['errMsg'] = "未知错误";
|
|
|
|
|
$eva_g_sn = $eva[0]->has_tourguide;
|
|
|
|
|
if (strval($vps->department)==="30") {
|
|
|
|
|
$userId = $this->send_host["30"]['userId'];
|
|
|
|
|
$userKey = $this->send_host["30"]['key'];
|
|
|
|
|
} else {
|
|
|
|
|
$userId = $this->send_host["1"]['userId'];
|
|
|
|
|
$userKey = $this->send_host["1"]['key'];
|
|
|
|
|
}
|
|
|
|
|
$this->tld_order->setOrderId($vps->VPS_externalId)
|
|
|
|
|
->setUserId($userId)
|
|
|
|
|
->setKey($userKey);
|
|
|
|
|
$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());
|
|
|
|
|
$ret['errMsg'] = "查询失败";
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
// 导游信息
|
|
|
|
|
$tourguige_name = "";
|
|
|
|
|
$tourguide_mobile = null;
|
|
|
|
|
if (isset($detail_jsonResp->orderDetail->operationDetails->guiderOperations) ) {
|
|
|
|
|
$tourguige_name = $detail_jsonResp->orderDetail->operationDetails->guiderOperations[0]->name;
|
|
|
|
|
$tourguide_mobile = real_phone_number($detail_jsonResp->orderDetail->operationDetails->guiderOperations[0]->mobelPhone, 86);
|
|
|
|
|
}
|
|
|
|
|
if ($tourguige_name === "") {
|
|
|
|
|
$ret['errMsg'] = "未查询到导游";
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
preg_match_all('/[^\w\s\-]+/', characet($tourguige_name, "UTF-8"), $cn_name_arr); // 取中文
|
|
|
|
|
$tourguige_name_cn = preg_replace('/^(上海|北京|西安)/', '', characet($cn_name_arr[0][0],'UTF-8'));
|
|
|
|
|
preg_match_all('/[a-zA-Z]+/', characet($tourguige_name, "UTF-8"), $en_name_arr); // 取英文
|
|
|
|
|
$tourguige_name_en = characet($en_name_arr[0][0],'UTF-8');
|
|
|
|
|
$ht_tourguide = $this->Group_model->search_tourguide($input['openId'], $tourguige_name_cn, $tourguige_name_en, $tourguide_mobile);
|
|
|
|
|
if (empty($ht_tourguide)) {
|
|
|
|
|
$ret['errMsg'] = "导游信息未录入";
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
$eva_tgi_column = array(
|
|
|
|
|
"EOI_Type" => 3
|
|
|
|
|
,"EOI_GRI_SN" => $eva->EOI_GRI_SN
|
|
|
|
|
,"EOI_VEI_SN" => $eva->EOI_ObjSN
|
|
|
|
|
,"EOI_ObjSN" => $ht_tourguide->TGI_SN
|
|
|
|
|
,"EOI_CII_SN" => $eva->EOI_CII_SN
|
|
|
|
|
,"EOI_GetDate" => $eva->EOI_GetDate
|
|
|
|
|
,"EOI_Date" => $eva->EOI_Date
|
|
|
|
|
,"EOI_Cancel" => $eva->EOI_Cancel
|
|
|
|
|
,"EOI_GroupType" => $eva->EOI_GroupType
|
|
|
|
|
,"EOI_FillWorkers_SN" => 0 // todo
|
|
|
|
|
,"EOI_FWks_LastEditTime" => date('Y-m-d H:i:s')
|
|
|
|
|
);
|
|
|
|
|
$this->Group_model->set_plan_tourguide($eva_g_sn, $eva_tgi_column);
|
|
|
|
|
$ret['status'] = 1;
|
|
|
|
|
$ret['errMsg'] = "";
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* 订单状态变更,调度变更
|
|
|
|
|
* (地接社调用, 并邮件通知外联)
|
|
|
|
@ -456,7 +508,7 @@ class Tulanduo extends CI_Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function excute_curl($url, $content_builder) {
|
|
|
|
|
private function excute_curl($url, $content_builder) {
|
|
|
|
|
$ch = curl_init();
|
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
|
|
curl_setopt($ch, CURLOPT_FAILONERROR, false);
|
|
|
|
|