Merge branch 'feature/plan-auto-send-Trippest'

hotfix/远程访问多媒体中心
lyt 6 years ago
commit 4bba9f3a00

@ -32,11 +32,9 @@ class Index extends CI_Controller {
public function push($GRI_SN=0, $vendor_str=null)
{
// log_message('error',"\n\n---------------------------------------------------PUSH------------------------------------------------------------\n");
$start_date = date('Y-m-d');
$end_date = date('Y-m-d 23:59:59', strtotime("+2 months"));
$ready_to_send = $this->Group_model->get_plan_not_received(1, $GRI_SN, $vendor_str, $start_date, $end_date);
// log_message('error',var_export($ready_to_send, 1));
if (empty($ready_to_send)) {
return $this->output->set_output("empty");
}
@ -54,6 +52,7 @@ class Index extends CI_Controller {
public function verify_user()
{
return false;
$open_id = $this->input->post('openId');
$open_key = $this->input->post('key');
$match = $this->UserAuth_model->if_user_key($open_id, $open_key, 1);
@ -80,6 +79,7 @@ class Index extends CI_Controller {
*/
public function uploadOperation()
{
return false;
$input = $this->input->post();
log_message('error',"Call [Tulanduo>uploadOperation]: " . json_encode($input));
$ret['status'] = -1;
@ -123,6 +123,7 @@ class Index extends CI_Controller {
public function plan_confirm($input, $vps)
{
return false;
$ret['status'] = -1;
$ret['errMsg'] = "";
$vendor_manager = $this->Group_model->get_vendorContact($input['openId']);
@ -160,6 +161,7 @@ class Index extends CI_Controller {
public function fill_tourguide($input, $vps)
{
return false;
$ret['status'] = -1;
$ret['errMsg'] = "";
$eva = $this->Group_model->get_plan_eva($vps->VAS_SN);
@ -198,6 +200,7 @@ class Index extends CI_Controller {
public function calc_key($userId, $key)
{
return false;
$default = "b825e39422a54875a95752fc7ed6f5d2";
$ret = md5(hash("sha256", $userId.$default));
return $ret;

@ -54,6 +54,9 @@ class Tulanduo
public $detail_url = "http://djb3c.ltsoftware.net:9921/action/api/detailRouteOrder/";
public $neworder_url = "http://djb3c.ltsoftware.net:9921/action/api/addOrUpdateRouteOrder/";
private $tulanduo_trippest_pag = array();
private $tulanduo_trippest_code = array();
public function __construct(){
$this->ci =& get_instance();
mb_regex_encoding("UTF-8");
@ -72,6 +75,11 @@ class Tulanduo
public function order_push($order=null)
{
// 初始化所有Trippest合作项目的包价产品
$this->tulanduo_trippest_pag = $this->ci->BIZ_order->get_packageDetails('', implode(',', $this->vendor_ids));
$this->tulanduo_trippest_code = array_map(function($ele){return mb_strtoupper($ele->PAG_Code);}, $this->tulanduo_trippest_pag);
$this->tulanduo_trippest_pag = array_combine($this->tulanduo_trippest_code, $this->tulanduo_trippest_pag);
// 目的地计划
if (strval($order->GRI_OrderType) === "227002" && strval($order->department) === "30") {
return $this->push_trippest($order);
@ -79,12 +87,12 @@ class Tulanduo
// 商务
if (strval($order->GRI_OrderType) === "227002") {
return false; // for Trippest deploy
return $this->push_tour($order);
return $this->push_biz($order, strval($order->GRI_OrderType));
}
// 传统订单
if (strval($order->GRI_OrderType) === "227001") {
return false; // for Trippest deploy
return $this->push_tour($order);
return $this->push_tour($order, strval($order->GRI_OrderType));
}
return "[Tulanduo>order_push] No function match. ";
@ -92,147 +100,283 @@ class Tulanduo
/*!
* 发送线路订单计划
* @date 2018-11-22
*/
public function push_tour($vas=null)
public function push_tour($vas=null, $gri_ordertype='227001')
{
return false; // for Trippest deploy
$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;
$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);
$grd_info = $this->ci->Group_model->get_vendor_plan_info($gri_sn, $vei_sn);
if (empty($grd_info)) {
$this->ci->Group_model->set_plan_received($vas_sn);
return false;
}
$all_day_no = array_map(function($ele){return $ele->GRD_DayNo;}, $grd_info);
$arrange_info = $this->ci->Group_model->get_arrange_info($gri_sn, $vei_sn);
$routeName = "中华游" . $arrange_info[0]->tocity . "线路"; // TODO 线路名称
$routeType = "桂林海纳国旅"; // TODO 线路类型
$agcOrderNo = $vas->GRI_Name . "-" . $arrange_info[0]->citycode;
$agcOrderNo .= "(" . $vas->operator . ")";
$first_date = $grd_info[0]->day_no_raw;
$last_date = count($grd_info)-1;
$end_date = $grd_info[$last_date]->day_no_raw;
$request_info = $this->ci->Group_model->get_plan_request($gri_sn);
$order_type = 1;
$this->ci->tldOrderBuilder->setUserId($userId)
->setKey($userKey)
->setOrderType($order_type)
->setRouteName($routeName)
->setRouteType($routeType)
->setAgcOrderNo($agcOrderNo)
->setAdultNum(intval($arrange_info[0]->ACI_PersonNum))
->setChildNum(intval(bcadd($arrange_info[0]->ACI_ChildNum, $arrange_info[0]->ACI_BabyNum)))
->setDestination($arrange_info[0]->tocity)
->setTravelDate($first_date)
->setLeavedDate($end_date)
// ->setOrderRemark($order_remark) // 订单备注 TODO
->setRoomStandard($request_info->GCI_HotelRequest) // 住房标准
->setRouteStandard($request_info->GCI_Request) // 行程服务标准
;
$guestlist = $this->ci->orders_model->get_customer_list($gri_sn);
foreach ($guestlist as $key => $vg) {
$this->ci->tldOrderBuilder->setCustomersName($key, $vg->MemberName )
->setCustomersPeopleType($key, (calc_age_type($vg->BirthDay)==1 ? "成人" : "儿童"))
->setCustomersDocumentType($key, "护照") // Passport No.
->setCustomersDocumentNo($key, $vg->PassportNo)
->setCustomersOtherInfo($key, $vg->Country);
$request_info = $this->ci->Group_model->get_plan_request($vas->GRI_SN);
/**
* TODO:团队类型? 先写2
* ??是否同一天含多个包价项目
*/
/*!
// 同一天含多个包价产品时, 需要先合并.避免丢失
$all_trippest_package = array_filter(array_map(function ($ele){return $ele->pag_code_arr;}, $grd_info));
$reduce_package_code = array();
foreach ($all_trippest_package as $ktp => $vtp) {
$reduce_package_code = array_merge($reduce_package_code, $vtp);
}
// $travel_fee = 0;
// foreach ($arrange_info as $kaci => $vaci) {
// $travel_fee = bcadd($travel_fee, $vaci->ACI_Amount);
// }
// // TODO 是否需要travelFee
// $this->ci->tldOrderBuilder->setTravelFeesType(0, "Per Group")
// ->setTravelFeesMoney(0, $travel_fee)
// ->setTravelFeesNum(0, 1)
// ->setTravelFeesUnit(0, 1)
// ->setTravelFeesSumMoney(0, $travel_fee)
// ->setTravelFeesRemark(0, "");
// 补全空的日期,行程为空
$date1 = new DateTime($first_date);
$date_end = new DateTime($end_date);
$date_diff = $date_end->diff($date1);
$d = ($date_diff->format("%a"));
$all_date = array();
for ($j=0; $j < ($d+1); $j++) {
$all_date[] = date('Y-m-d', strtotime("+$j day", strtotime($first_date)));
$reduce_package_code = array_filter($reduce_package_code);
*/
$grd_apart_info = $this->tour_apart($grd_info);
$big_order_index = 0;
$expect_order_cnt = count($grd_apart_info['com'])+intval(!empty($grd_apart_info['big_pvt']))+intval(!empty($grd_apart_info['pvt']));
// echo json_encode($grd_info);exit;
foreach ($grd_apart_info as $group_key => $grd_a) {
$big_order_index = $this->tour_apart_order_exec($group_key, $vas, $request_info, $guestlist, $grd_a, $big_order_index);
}
$real_date = array_map(function ($ele){return $ele->day_no_raw;}, $grd_info);
foreach ($all_date as $kd => $vd) {
if ( ! in_array($vd, $real_date)) {
$this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, "无")
->setScheduleDetailsContent($kd, "无")
->setScheduleDetailsAccommodation($kd, "")
// ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
->setScheduleDetailsBreakFirst($kd, 0 )
->setScheduleDetailsDinner($kd, 0)
->setScheduleDetailsLunch($kd, 0)
;
continue;
if ($big_order_index === $expect_order_cnt) {
/** VendorArrangeState VAS_IsReceive */
$this->ci->Group_model->set_plan_received($vas_sn);
}
return "[Tulanduo>push_tour] Done. ";
}
/*!
* @Author: LYT
* @Date: 2019-05-30 16:11:34
* @Desc: 执行发送订单计划信息. 参数已拆分归类好的行程
*/
public function tour_apart_order_exec($group_type, $vas, $request_info, $guestlist, $grd, $total_order_index)
{
if (empty($grd)) {
return $total_order_index;
}
$userId = $this->send_host["1"]["userId"];
$userKey = $this->send_host["1"]["key"];
switch ($group_type) {
case 'big_pvt':
$total_order_index ++;
$all_grd = array($grd);
$routeName = "中华游" . $grd['details'][0]->tocity . "常规线路";
$routeType = $routeName;
$agcOrderNo = $vas->GRI_Name . "-" . $grd['details'][0]->citycode . "-" . $total_order_index;
$agcOrderNo .= "(" . $vas->operator . ")";
$order_type = 1;
break;
case 'pvt':
$total_order_index ++;
$all_grd = array($grd);
$routeName = empty($grd['details'][0]->GRD_Landscape) ? $grd['details'][0]->PAG_Title : $grd['details'][0]->GRD_Landscape;
$routeName .= "(" . $grd['details'][0]->PAG_Code . ")";
$routeType = $grd['details'][0]->tocity . "目的地线路";
$agcOrderNo = $vas->GRI_Name . "-" . $grd['details'][0]->citycode . "-" . $total_order_index;
$agcOrderNo .= "(" . $vas->operator . ")";
$order_type = 1;
break;
case 'com':
default:
$all_grd = ($grd);
$order_type = 2;
break;
}
foreach ($all_grd as $ko => $vo) {
if ($order_type === 2) {
$total_order_index ++;
$routeName = $vo['PAG_Name'];
if (empty($routeName)) {
$routeName = $vo['details'][0]->GRD_Landscape . "(" . $vo['details'][0]->PAG_Code . ")";
}
$routeType = $vo['details'][0]->tocity . "目的地线路";
$agcOrderNo = $vas->GRI_Name . "-" . $vo['details'][0]->citycode . "-" . $total_order_index;
$agcOrderNo .= "(" . $vas->operator . ")";
}
foreach ($grd_info as $kgrd => $vgrd) {
if ($vd==$vgrd->day_no_raw) {
$this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, $vgrd->GRD_OrderDate)
->setScheduleDetailsContent($kd, $vgrd->GRD_Landscape)
->setScheduleDetailsAccommodation($kd, $vgrd->GRD_Hotel)
->setScheduleDetailsTraffic($kd, ($vgrd->GRD_Traffic))
->setScheduleDetailsBreakFirst($kd, 0 )
->setScheduleDetailsDinner($kd, (trim($vgrd->GRD_Meal_S)==="" ? 0 : 1 ))
->setScheduleDetailsLunch($kd, (trim($vgrd->GRD_Meal_L)==="" ? 0 : 1 ))
;
$first_date = $vo['details'][0]->day_no_raw;
$last_date = COUNT($vo['details'])-1;
$end_date = $vo['details'][$last_date]->day_no_raw;
$this->ci->tldOrderBuilder->resetBizContent();
$this->ci->tldOrderBuilder->setUserId($userId)
->setKey($userKey)
->setOrderType($order_type)
->setRouteName($routeName)
->setRouteType($routeType)
->setAgcOrderNo($agcOrderNo)
->setAdultNum(intval($vo['details'][0]->ACI_PersonNum))
->setChildNum(intval(bcadd($vo['details'][0]->ACI_ChildNum, $vo['details'][0]->ACI_BabyNum)))
->setDestination($vo['details'][0]->tocity)
->setTravelDate($first_date)
->setLeavedDate($end_date)
// ->setOrderRemark($order_remark) // 订单备注 TODO:
// ->setRoomStandard($request_info->GCI_HotelRequest) // 住房标准
->setRouteStandard($request_info->GCI_Request) // 行程服务标准
;
foreach ($guestlist as $key => $vg) {
$this->ci->tldOrderBuilder->setCustomersName($key, $vg->MemberName )
->setCustomersPeopleType($key, (calc_age_type($vg->BirthDay)==1 ? "成人" : "儿童"))
->setCustomersDocumentType($key, "护照") // Passport No.
->setCustomersDocumentNo($key, $vg->PassportNo)
->setCustomersOtherInfo($key, $vg->Country . "; " . $vg->phone);
}
// 补全空的日期,行程为空
$date1 = new DateTime($first_date);
$date_end = new DateTime($end_date);
$date_diff = $date_end->diff($date1);
$d = ($date_diff->format("%a"));
$all_date = array();
for ($j=0; $j < ($d+1); $j++) {
$all_date[] = date('Y-m-d', strtotime("+$j day", strtotime($first_date)));
}
$real_date = array_map(function ($ele){return $ele->day_no_raw;}, $vo['details']);
foreach ($all_date as $kd => $vd) {
if ( ! in_array($vd, $real_date)) {
$this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, "无")
->setScheduleDetailsContent($kd, "无")
->setScheduleDetailsAccommodation($kd, "")
// ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
->setScheduleDetailsBreakFirst($kd, 0 )
->setScheduleDetailsDinner($kd, 0)
->setScheduleDetailsLunch($kd, 0)
;
continue;
}
foreach ($vo['details'] as $kgrd => $vgrd) {
if ($vd==$vgrd->day_no_raw) {
$this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, $vgrd->GRD_OrderDate)
->setScheduleDetailsContent($kd,
$vgrd->GRD_LeaveCity . "-" . $vgrd->GRD_ServiceCity . "\r\n" .
$vgrd->GRD_Landscape . "\r\n" . $vgrd->GRD_Traffic)
->setScheduleDetailsAccommodation($kd, $vgrd->GRD_Hotel)
->setScheduleDetailsTraffic($kd, ($vgrd->GRD_Traffic))
->setScheduleDetailsBreakFirst($kd, 0 )
->setScheduleDetailsDinner($kd, (trim($vgrd->GRD_Meal_S)==="" ? 0 : 1 ))
->setScheduleDetailsLunch($kd, (trim($vgrd->GRD_Meal_L)==="" ? 0 : 1 ))
;
}
}
}
}
// 查询是否变更 TODO deprecated
$sync_orderstate = 10;
$vps_sn = 0;
$vendor_orderid = 0;
$this->ci->tldOrderBuilder->clearModifyLogInfo();
// $resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
$resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test
// 查询是否变更 TODO: deprecated at 2019-05
$sync_orderstate = 10;
$this->ci->tldOrderBuilder->clearModifyLogInfo();
$resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
// $resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test:
echo $this->ci->tldOrderBuilder->getBizContent();
log_message('error',$resp);
$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_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) {
$response = json_decode($resp);
if ($response->status == 1) {
/** VendorPlanSync */
$sync_ret = array(
"VPS_VAS_SN" => $vas->VAS_SN
,"VPS_GRI_SN" => $vas->GRI_SN
,"VPS_VEI_SN" => $vas->VAS_VEI_SN
,"VPS_startDate" => $first_date
,"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')
);
$sync_id = $this->ci->Group_model->insert_VendorPlanSync($sync_ret);
}
}
return $total_order_index;
}
/*!
* @Author: LYT
* @Date: 2019-05-29 14:54:17
* @Desc: 线路订单计划拆分.
* 合并同样的行程
* 根据行程类型拆分
* @return $ret = array(
* 'big_pvt'=>array(), // 不是合作项目的产品
* 'pvt'=>array(), // 合作项目中的pvt
* 'com'=>array( // 合作项目中的拼团
* 'details' => [],'PAG_Code'=> 'XXX'
* )
* )
*/
public function tour_apart($all_pag_info)
{
$apart = array(); $ret = array();
foreach ($all_pag_info as $key => $pag) {
// CH下的产品编号修正
if (intval($pag->PAG_DEI_SN)===1 && ! empty($pag->PAG_Code)) {
$pag->PAG_Code = $this->ci->trippest->ch_code_transfer( mb_strtoupper($pag->PAG_Code));
$pag->PAG_ExtendType = $this->tulanduo_trippest_pag[$pag->PAG_Code]->PAG_ExtendType;
}
if (empty($pag->PAG_Code)) // 已在grd查询中增加是否目的地产品的判断
{
$apart['big_pvt']['details'][] = $pag;
continue;
}
if (empty($pag->PAG_Title) ) {
$pag->PAG_Title = $this->tulanduo_trippest_pag[$pag->PAG_Code]->PAG_Title;
}
// 合作的产品
if ($this->ci->trippest->if_tour_pvt(array($pag))===1) {
$apart["pvt"]['details'][] = $pag;
} else {
$update = $this->ci->Group_model->update_VendorPlanSync($vps_sn, $sync_ret);
$apart["com"]['details'][$pag->PAG_Code][] = $pag;
}
/** VendorArrangeState VAS_IsReceive */
}
$apart_com = array();
if ( ! empty($apart['com'])) {
$all_com_pag = array_keys($apart['com']['details']);
$full_pag = array();
$process_pag = array();
foreach ($all_com_pag as $kp => $vp) {
$apart_com[$vp]['details'] = array();
$this_include_pags = $this->ci->trippest->tour_code($vp);
if( isset($this->ci->trippest->special_route[$vp]) ) {
$full_pag = array_diff($this_include_pags, array_merge($full_pag,$process_pag));
foreach ($this_include_pags as $vi) {
if ($vi !== $vp) {
unset($apart_com[$vi]);
}
// $apart_com[$vp]['details'][] = $apart['com']['details'][$vi];
$apart_com[$vp]['details'] = array_merge($apart_com[$vp]['details'], $apart['com']['details'][$vi]);
$apart_com[$vp]['PAG_Code'] = $vp;
$apart_com[$vp]['PAG_Name'] = $this->ci->trippest->special_route[$vp]['name'];
}
} else {
$full_pag = array_merge($full_pag, $this_include_pags);
// $apart_com[$vp]['details'][] = $apart['com']['details'][$vp];
$apart_com[$vp]['details'] = array_merge($apart_com[$vp]['details'], $apart['com']['details'][$vp]);
$apart_com[$vp]['PAG_Code'] = $vp;
$apart_com[$vp]['PAG_Name'] = "";
}
$process_pag[] = $vp;
$this_include_pags = array();
}
}
$ret['big_pvt'] = empty($apart['big_pvt']) ? null : $apart['big_pvt'];
$ret['pvt'] = empty($apart['pvt']['details']) ? null : ($apart['pvt']);
$ret['com'] = array_values($apart_com);
return $ret;
}
/*!
* @Author: LYT
* @Date: 2019-06-04 11:47:38
* @Desc: 发送商务订单计划
*/
public function push_biz($vas=null, $gri_ordertype='227002')
{
$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);
if (empty($grd_info)) {
$this->ci->Group_model->set_plan_received($vas_sn);
return false;
}
// return $this->ci->tldOrderBuilder->getBizContent() . "[Tulanduo>push_tour] Done. ";
return "[Tulanduo>push_tour] Done. ";
$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);
return false;
}
/*!
* 发送目的地项目组预订计划到图兰朵地接系统
* 地接社未接收的或有变更的
* @date 2018-10-26
*/
public function push_trippest($vas=null)
{
@ -243,13 +387,6 @@ log_message('error',$resp);
$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);
$orderinfo = $this->ci->BIZ_order->get_orderinfo_detail($gri_sn, $vei_sn_str);
if(empty($orderinfo)) {return "[Tulanduo>push_trippest] Not found order detail. ";}
@ -321,8 +458,7 @@ log_message('error',$resp);
$this->ci->tldOrderBuilder->resetBizContent();
$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 = $this->ci->trippest->if_tour_pvt($vf["package_info"]);
}
$last_code = count($vf["package_info"])-1;
$last_date = count($vf["cold"])-1;
@ -361,7 +497,7 @@ log_message('error',$resp);
->setTravelDate(strstr($vf["cold"][0]->COLD_StartDate, " ", true))
->setLeavedDate($end_date)
->setOrderRemark($order_remark)
// todo 抵离交通
// todo: 抵离交通
// ->setToTraffic($toTraffic)
// ->setBackTraffic($backTraffic)
;
@ -408,8 +544,17 @@ log_message('error',$resp);
if (trim($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 (trim($hotels[0]->POI_Hotel) != '') {
$this->ci->tldOrderBuilder->setToTraffic($hotels[0]->POI_Hotel);
$this->ci->tldOrderBuilder->setBackTraffic($hotels[0]->POI_Hotel);
}
$checkin_name = trim($hotels[0]->POI_HotelCheckInName)!=="" ? "\r\n入住人:".$hotels[0]->POI_HotelCheckInName : "";
$checkin_date = trim($hotels[0]->POI_HotelCheckIn)!=="" ? "\r\n入住日期:".$hotels[0]->POI_HotelCheckIn : "";
$this_content .= $checkin_name;
$this_content .= $checkin_date;
if ($checkin_name!=='' || $checkin_date!=='') {
$this->ci->tldOrderBuilder->setRoomStandard(trim($checkin_name) . ", " . trim($checkin_date));
}
if ($hotels[0]->POI_FlightsNo) {
$this_content .= "\r\n航/车次:" . $hotels[0]->POI_FlightsNo;
if ($hotels[0]->POI_FromCity || $hotels[0]->POI_ToCity) {
@ -458,7 +603,7 @@ log_message('error',$resp);
$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"));
$d_t = ($date_d->format("%a"));
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))));
@ -504,20 +649,28 @@ log_message('error',$resp);
}
// 拆分的订单团款录第一个
if ($i===1) {
$fee_index=0;
if ( ! empty($travel_fees) ) {
$this->ci->tldOrderBuilder->setTravelFeesType(0, "Per Group")
->setTravelFeesMoney(0, $travel_fees->SUM_SSJE)
->setTravelFeesNum(0, 1)
->setTravelFeesUnit(0, 1)
->setTravelFeesSumMoney(0, $travel_fees->SUM_SSJE);
$this->ci->tldOrderBuilder->setTravelFeesType($fee_index, "Per Group")
->setTravelFeesMoney($fee_index, $travel_fees->SUM_SSJE)
->setTravelFeesNum($fee_index, 1)
->setTravelFeesUnit($fee_index, 1)
->setTravelFeesSumMoney($fee_index, $travel_fees->SUM_SSJE);
++$fee_index;
}
if ( ! empty($replace_collections) ) {
$this->ci->tldOrderBuilder->setReplaceCollectionsType(0, "Per Group")
->setReplaceCollectionsMoney(0, $replace_collections->SUM_SSJE)
->setReplaceCollectionsRemark(0, $replace_collections->ALL_Memo);
$this->ci->tldOrderBuilder->setTravelFeesType($fee_index, "Per Group")
->setTravelFeesMoney($fee_index, $replace_collections->SUM_SSJE)
->setTravelFeesNum($fee_index, 1)
->setTravelFeesUnit($fee_index, 1)
->setTravelFeesSumMoney($fee_index, $replace_collections->SUM_SSJE)
->setTravelFeesRemark($fee_index, "代收; " . $replace_collections->ALL_Memo);
}
}
// 查询是否变更 TODO deprecated
// 查询是否变更 TODO: deprecated
$sync_orderstate = 10;
$vps_sn = 0;
$vendor_orderid = 0;
@ -571,7 +724,7 @@ log_message('error',$resp);
->setUserId($userId)
->setKey($userKey);
$detail_resp = $this->excute_curl($this->detail_url, $this->tld_order);
// $detail_resp = '{"status":1,"errMsg":"","orderDetail":{"orderId":' . rand(1000,9999) . ',"operationDetails": {"guiderOperations":[{"name":"北京翟梦琪Susie","mobelPhone":"18801326155","startDate":"2017-04-25","endDate":"2017-04-25","sumMoney":400,"remark":"","guiderPhoto":"http://djb3c.ltsoftware.net:9921/projects/djb3c//uploadImages/guider/1526898234415.png"}]}}}'; // test
// $detail_resp = '{"status":1,"errMsg":"","orderDetail":{"orderId":' . rand(1000,9999) . ',"operationDetails": {"guiderOperations":[{"name":"北京翟梦琪Susie","mobelPhone":"18801326155","startDate":"2017-04-25","endDate":"2017-04-25","sumMoney":400,"remark":"","guiderPhoto":"http://djb3c.ltsoftware.net:9921/projects/djb3c//uploadImages/guider/1526898234415.png"}]}}}'; // test:
$detail_jsonResp = json_decode($detail_resp);
// 判断
if ($detail_jsonResp->status !== 1) {
@ -640,7 +793,7 @@ log_message('error',$resp);
$ret['errMsg'] = "身份验证失败.";
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
}
// $vendorID = 29188;//29188 1343; // test
// $vendorID = 29188;//29188 1343; // test:
$vas_info = array();
if (in_array($input['agcName'], array("D目的地桂林组", "Trippest"))) {
$vas_info = $this->BIZ_order->get_vendorarrangestate_byVendor($input['orderId'], $vendorID);
@ -693,7 +846,6 @@ log_message('error',$resp);
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
}
private function excute_curl($url, $content_builder)
{
$ch = curl_init();

@ -56,6 +56,58 @@ class Trippest
return $ret;
}
public function ch_code_transfer($code)
{
$trippest_code = $code;
switch ($code) {
case 'SHALC-6':
case 'SHALC-7':
case 'SHALC-8':
case 'SHALC-9':
$trippest_code = "SHSIC-45";
break;
case 'SHSIC-31':
$trippest_code = "SHSIC-41";
break;
case 'SHSIC-32':
$trippest_code = "SHSIC-42";
break;
case 'SHSIC-33':
$trippest_code = "SHSIC-43";
break;
default:
break;
}
return $trippest_code;
}
/*!
* @Author: LYT
* @Date: 2019-05-28 15:17:11
* @Desc: 判断产品是否需要发送PVT计划
* @param $all_pag_info = array((pag.*),(pag.*))
* @return 1-pvt;2-combine
*/
public function if_tour_pvt($all_pag_info)
{
$tour_pvt_arr = array_filter(array_map(function($pag) {
if(intval($pag->PAG_ExtendType)===39009)
{
return 1;
} else if (stripos($pag->PAG_Title,"PVT") !== false) {
return 1;
} else if (stripos($pag->PAG_Title,"private") !== false) {
return 1;
} else {
return null;
}
}, $all_pag_info));
$order_type = empty($tour_pvt_arr) ? 2 : 1;
return $order_type;
}
}

File diff suppressed because it is too large Load Diff

@ -20,15 +20,14 @@ class Group_model extends CI_Model {
from VendorArrangeState vas
inner join Eva_ObjectInfo eoi on EOI_GRI_SN=VAS_GRI_SN and EOI_Type=1 and EOI_ObjSN=VAS_VEI_SN
inner join GRoupInfo gri on GRI_SN=VAS_GRI_SN
where 1=1 ";
where 1=1 AND VAS_VEI_SN in ($vendor_str) ";
$sql .= $gri_sn!==0 ? $gri_sql : "
AND VAS_IsCancel=0 AND VAS_Delete=0 AND vas.DeleteFlag=0
AND VAS_IsSendSucceed=1 AND VAS_IsReceive=0
AND isnull(VAS_IsCancel,0)=0 AND isnull(VAS_Delete,0)=0 AND isnull(vas.DeleteFlag,0)=0
AND VAS_IsSendSucceed=1 AND isnull(VAS_IsReceive,0)=0
AND EOI_GetDate between '$start_date' AND '$end_date'
AND VAS_VEI_SN in ($vendor_str)
-- Trippest, not confirm, not change -- for Trippest deploy
AND isnull(VAS_IsConfirm,0)=0 AND isnull(VAS_SendVary,0)=0
AND GRI_OrderType=227002
AND VAS_IsConfirm=0 AND VAS_SendVary=0
AND EXISTS (
select 1 from OperatorInfo where OPI_SN=GRI_operator AND OPI_DEI_SN=30
)
@ -68,16 +67,16 @@ class Group_model extends CI_Model {
'ReturnDatesAsStrings' => 1
);
$conn = sqlsrv_connect($db['HT']['hostname'], $connection);
$stmt = sqlsrv_query($conn, "EXEC Tourmanager.dbo.SP_VendorPlan_GetPlanInfo $gri_sn, $vendor_id, 0 ");
$stmt = sqlsrv_query($conn, "SET NOCOUNT ON;EXEC Tourmanager.dbo.SP_VendorPlan_GetPlanInfo $gri_sn, $vendor_id, 0 ");
$result_object = array();
if (false !== $stmt) { // 无权限返回false,会导致下列sqlsrv_has_rows,sqlsrv_next_result死循环
//存储过程中每个select都产生一个结果集,取某个结果集就需要从第一个移动到需要的那个结果集
//如果结果集为空就移到下一个
while (sqlsrv_has_rows($stmt) !== TRUE) {
sqlsrv_next_result($stmt);
}
while ($row = sqlsrv_fetch_object($stmt)) {
$result_object[] = $row;
if (false !== $stmt ) { // 无权限或执行错误返回false
// 存储过程中每个select都产生结果集
// 设置了SET NOCOUNT ON;就只有输出的结果集
$a = true;
while ($a !== false) {
$row = sqlsrv_fetch_object($stmt); // Retrieves the next row of data as a PHP object.
$a = !empty($row);
$a===true ? $result_object[] = $row : null;
}
sqlsrv_free_stmt($stmt);
}
@ -85,12 +84,25 @@ class Group_model extends CI_Model {
$grd_info = $result_object;
$all_day_no = array_map(function($ele){return $ele->GRD_DayNo;}, $grd_info);
$day_no_str = implode(",", $all_day_no);
$all_aci = $this->get_arrange_info($gri_sn, 0, $day_no_str);
$all_aci = $this->get_arrange_info($gri_sn, $vendor_id, $day_no_str);
foreach ($grd_info as $kgrd => &$vgrd) {
$vgrd->pag_code_arr = array();
$vgrd->PAG_Title = $vgrd->GRD_Landscape;
foreach ($all_aci as $kaci => $vaci) {
if ($vgrd->GRD_DayNo == $vaci->ACI_DayNo) {
$vgrd->day_no_raw = strstr($vaci->ACI_OrderDate, " ", true);
break;
$vgrd->day_no_raw = strstr($vaci->ACI_OrderDate, " ", true);
$vgrd->tocity = $vaci->tocity;
$vgrd->citycode = $vaci->citycode;
$vgrd->ACI_PersonNum = intval($vaci->ACI_PersonNum);
$vgrd->ACI_ChildNum = intval($vaci->ACI_ChildNum);
$vgrd->ACI_BabyNum = intval($vaci->ACI_BabyNum);
$vgrd->PAG_DEI_SN = $vaci->PAG_DEI_SN;
if ( strval($vaci->ACI_ServiceType)==='D') {
$vgrd->PAG_Code = mb_strtoupper($vaci->PAG_Code);
$vgrd->PAG_ExtendType = mb_strtoupper($vaci->PAG_ExtendType);
$vgrd->pag_code_arr[] = mb_strtoupper($vaci->PAG_Code);
break;
}
}
}
}
@ -122,8 +134,13 @@ class Group_model extends CI_Model {
where CII2_CII_SN=ACI_ToCity and CII2_LGC=2) as tocity,
(select CII_PKCode from CItyInfo
where CII_SN=ACI_ToCity ) as citycode,
PAG_Code,PAG_ExtendType,PAG_DEI_SN,
*
from ArrangeConfirmInfo aci
left join BIZ_PackageInfo on PAG_SN=ACI_ServiceSN
and ACI_ServiceType='D' and PAG_DefaultVEI_SN=ACI_VEI_SN
-- 增加是否目的地产品的判断
and SUBSTRING(CONVERT(varchar(10), PAG_SourceType) ,1,3)='132'
where 1=1
and aci.ACI_GRI_SN=?
$vendor_sql
@ -273,8 +290,6 @@ class Group_model extends CI_Model {
return $this->HT->query($update_sql);
}
/*
* 发送邮件
*/

@ -213,7 +213,10 @@ class TuLanDuo_addOrUpdateRouteOrderContentBuilder extends CI_Model
return $this;
}
/** 行程详细数组 */
/**
* 行程详细数组
* 已存在的日期则拼接内容
*/
public function setScheduleDetailsTitle($index, $title)
{
$this->orderData['scheduleDetails'][$index]['title'] = $title;
@ -221,32 +224,38 @@ class TuLanDuo_addOrUpdateRouteOrderContentBuilder extends CI_Model
}
public function setScheduleDetailsContent($index, $content)
{
$this->orderData['scheduleDetails'][$index]['content'] = $content;
$this->orderData['scheduleDetails'][$index]['content'] = isset($this->orderData['scheduleDetails'][$index]['content']) ?
($this->orderData['scheduleDetails'][$index]['content'] . "\r\n" . $content) : $content;
return $this;
}
public function setScheduleDetailsTraffic($index, $traffic)
{
$this->orderData['scheduleDetails'][$index]['traffic'] = $traffic;
$this->orderData['scheduleDetails'][$index]['traffic'] = isset($this->orderData['scheduleDetails'][$index]['traffic']) ?
($this->orderData['scheduleDetails'][$index]['traffic'] . "\r\n" . $traffic) : $traffic;
return $this;
}
public function setScheduleDetailsAccommodation($index, $accommodation)
{
$this->orderData['scheduleDetails'][$index]['accommodation'] = $accommodation;
$this->orderData['scheduleDetails'][$index]['accommodation'] = isset($this->orderData['scheduleDetails'][$index]['accommodation']) ?
($this->orderData['scheduleDetails'][$index]['accommodation'] . "\r\n" . $accommodation) : $accommodation;
return $this;
}
public function setScheduleDetailsBreakFirst($index, $breakFirst)
{
$this->orderData['scheduleDetails'][$index]['breakFirst'] = $breakFirst;
$this->orderData['scheduleDetails'][$index]['breakFirst'] = isset($this->orderData['scheduleDetails'][$index]['breakFirst']) ?
$breakFirst+$this->orderData['scheduleDetails'][$index]['breakFirst'] : $breakFirst;
return $this;
}
public function setScheduleDetailsDinner($index, $dinner)
{
$this->orderData['scheduleDetails'][$index]['dinner'] = $dinner;
$this->orderData['scheduleDetails'][$index]['dinner'] = isset($this->orderData['scheduleDetails'][$index]['dinner']) ?
$dinner+$this->orderData['scheduleDetails'][$index]['dinner'] : $dinner;
return $this;
}
public function setScheduleDetailsLunch($index, $lunch)
{
$this->orderData['scheduleDetails'][$index]['lunch'] = $lunch;
$this->orderData['scheduleDetails'][$index]['lunch'] = isset($this->orderData['scheduleDetails'][$index]['lunch']) ?
$lunch+$this->orderData['scheduleDetails'][$index]['lunch'] : $lunch;
return $this;
}

@ -27,10 +27,14 @@ class Orders_model extends CI_Model {
where LGC_LGC = 2
and COI_SN in (select MEI_Country from MemberInfo where MEI_SN=CUL_CUI_SN)
) as Country,
(select MEI_PassportNo from MemberInfo where MEI_SN=CUL_CUI_SN) PassportNo,
(select MEI_PassportValidDate from MemberInfo where MEI_SN=CUL_CUI_SN) PassportValidDate
MEI_Phone phone,
MEI_PassportNo PassportNo,
MEI_PassportValidDate PassportValidDate
-- (select MEI_PassportNo from MemberInfo where MEI_SN=CUL_CUI_SN) PassportNo,
-- (select MEI_PassportValidDate from MemberInfo where MEI_SN=CUL_CUI_SN) PassportValidDate
-- ,(select dbo.GetSysCodeName(MEI_Occupation,2) from MemberInfo where MEI_SN=CUL_CUI_SN) as Occupation
from CustomerList
inner join MemberInfo on MEI_SN=CUL_CUI_SN
where isnull(CUL_IsAgent,0)=0
and isnull(CUL_IsEmergency,0)=0
and isnull(CUL_IsTJR,0)=0

Loading…
Cancel
Save