You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php

939 lines
53 KiB
PHTML

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class TulanduoApi 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"
);
public $city_info = array(
"北京分公司" => array(
"PlanVEI_SN" => 1343
,"COLI_sourcetype" => 32090
,"routeType" => "北京目的地线路"
),
"西安分公司" => array(
"PlanVEI_SN" => 30548
,"COLI_sourcetype" => 32116
,"routeType" => "西安目的地线路"
),
"上海分公司" => array(
"PlanVEI_SN" => 29188
,"COLI_sourcetype" => 32112
,"routeType" => "上海目的地线路"
)
);
// userId key
// 1343 2e47c3721e3ff6e816fe6b928d7acc7d
// 29188 95c3b0d958a79a1216e651df182b3cb4
// 30548 9db75a2dc17156eb122364295804b7a2
// test
// public $list_url = "http://dj.ltsoftware.net:9901/action/api/searchRouteOrder/";
// public $detail_url = "http://dj.ltsoftware.net:9901/action/api/detailRouteOrder/";
public $neworder_url = "http://dj.ltsoftware.net:9901/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 $neworder_url = "http://djb3c.ltsoftware.net:9921/action/api/addOrUpdateRouteOrder/";
// 发送到图兰朵系统接口的参数jsonParams
public function __construct(){
parent::__construct();
mb_regex_encoding("UTF-8");
bcscale(4);
$this->load->helper('array');
$this->load->model('Orders_model');
$this->load->model('TuLanDuo_queryContentBuilder', 'tld_order');
// $this->output->enable_profiler(TRUE);
/** test */
// $this->userId = "358";
// $this->key = "a08f26ddc5b1bd4c8e5eafcac28fc1ec";
/** Live */
// 目的地
$this->userId = "1134";
$this->key = "73d180d05d425fd192e1c5b3097e75ff";
// 桂林海纳国旅
// $this->userId = "18";
// $this->key = "d05c25e6e6c5d4898161e0aaf700d9c7";
}
/*!
* 获取订单列表
* @date 2018-05-02
*/
public function get_orderlist($order_number=null)
{
// $order_number = $this->input->get_post("orderNo");
$startOrderDate = date('Y-m-d', strtotime("-2 days"));
$endOrderDate = date('Y-m-d');
$startTravelDate = date('Y-m-d');
$endTravelDate = date('Y-m-d', strtotime("+2 days"));
$this->tld_order->setUserId($this->userId)
->setKey($this->key)
->setPageSize(20)
->setPageIndex(1) ;
if ( ! empty($order_number)) {
$this->tld_order->setAgcOrderNo($order_number);
} else {
$get_type = rand(0, 1); // 需要按预定时间和出发时间, 避免有漏的
if ($get_type === 0) {
log_message('error','get_orderlist From TuLanDuo By travel Date' );
$this->tld_order->setStartTravelDate($startTravelDate)
->setEndTravelDate($endTravelDate) ;
} else {
log_message('error','get_orderlist From TuLanDuo By order Date' );
$this->tld_order->setStartOrderDate($startOrderDate)
->setEndOrderDate($endOrderDate) ;
}
}
$resp = $this->excute_curl($this->list_url, $this->tld_order);
$resp_arr = json_decode($resp, true);
if ($resp_arr['status'] !== 1) {
log_message('error','TulanduoApi get_orderlist failed. Msg:' . $resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent()));
return;
}
if ($resp_arr["responseData"]["totalRows"] == 0) {
log_message('error','TulanduoApi get_orderlist 0. ');
return;
}
$all_list = $resp_arr["responseData"]["orders"];
$order_to_HT = array_map(
function($ele){
if ( ! in_array($ele['agcName'], array("D目的地桂林组", "Trippest")) ) {
return $ele;
}
},$resp_arr["responseData"]["orders"]);
for($pi=2; $pi <= $resp_arr['responseData']['pageCount']; $pi++) {
$this->tld_order->setPageIndex($pi);
$f_resp = $this->excute_curl($this->list_url, $this->tld_order);
$f_resp_arr = json_decode($f_resp, true);
if ($resp_arr['status'] !== 1) {
log_message('error','TulanduoApi get_orderlist failed. Msg:' . $f_resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent()));
continue;
}
$f_order_to_HT = array_map(
function($ele){
if ( ! in_array($ele['agcName'], array("D目的地桂林组", "Trippest")) ) {
return $ele;
}
},$f_resp_arr["responseData"]["orders"]);
$order_to_HT = array_filter(array_merge($order_to_HT, $f_order_to_HT));
$all_list = array_merge($all_list, $f_resp_arr["responseData"]["orders"]);
}
$cnt = 0;
$pag_no_tmp = $this->pag_no_tmp();
mb_regex_encoding("UTF-8");
$unique_order = array();
foreach ($all_list as $k => $vo) {
if (in_array($vo['orderId'], $unique_order)) {
continue;
}
$unique_order[] = $vo['orderId'];
$this->Orders_model->BIZ_COLI_SN = null;
$this->Orders_model->GRI_SN = null;
$vo['agcOrderNo'] = mb_ereg_replace('( )', '', trim($vo['agcOrderNo'])); // 去掉中文的全角空格
$PAG_Code = $pag_sub = null;
preg_match('/[a-zA-Z]+\-[0-9\-]+/', $this->characet($vo['routeName'], "UTF-8"), $temp_array);
if (empty($temp_array) && isset($pag_no_tmp[$vo['routeName']])) {
$PAG_Code = $pag_no_tmp[$vo['routeName']];
$split_code = explode("-", $PAG_Code);
$PAG_Code = $split_code[0] . "-" . $split_code[1];
isset($split_code[2]) ? $pag_sub=$split_code[2] : null;
// 旧的数据没有线路代号
log_message('error',"未识别的线路名称 $PAG_Code " . $vo['orderId'] . " " . $vo['routeName'] . var_export($temp_array, 1));
} else {
$PAG_Code = $pag_sub = null;
$split_code = explode("-", $temp_array[0]);
$PAG_Code = $split_code[0] . "-" . $split_code[1];
isset($split_code[2]) ? $pag_sub=$split_code[2] : null;
}
$PAG_Code = in_array($PAG_Code, array("SHALC-6","SHALC-7","SHALC-8","SHALC-9")) ? "SHSIC-45" : $PAG_Code;
$serviceSN = $this->Orders_model->get_packageSN($PAG_Code);
$COLD_MemoText = raw_json_encode(array("Pick up"=>$vo['toTraffic'], "Drop off"=>$vo['backTraffic']));
$this->Orders_model->BIZ_COLI_SN = null;
$this->Orders_model->GRI_SN = null;
$this->Orders_model->GCI_SN = null;
$tmpv = $this->city_info[$vo['operationDep']]['PlanVEI_SN'] ? $this->city_info[$vo['operationDep']]['PlanVEI_SN'] : 1343;
// set GCI_SN
$this->Orders_model->get_SN_by_vendorOrderId($vo['orderId'], $tmpv); // 查询订单是否已经录入过
if ($this->Orders_model->BIZ_COLI_SN === null && in_array($vo['agcName'], array("D目的地桂林组", "Trippest"))) {
$real_groupCode = analysis_groupCode($vo['agcOrderNo']);
// set BIZ_COLI_SN, GRI_SN at Orders_model
$this->Orders_model->get_SN_by_groupCode($real_groupCode, $vo['orderId']);
}
if ($this->Orders_model->GRI_SN === null) {
/** GRoupInfo */
$travelDate = new DateTime($vo['travelDate']);
$leaveDate = new DateTime($vo['leaveDate']);
$date_diff = $travelDate->diff($leaveDate);
$this->Orders_model->GRI_No = mb_substr($vo['agcOrderNo'], 0, 49);
$this->Orders_model->GRI_OrderType = 227002; // 商务
$this->Orders_model->GRI_Name = mb_substr($vo["agcName"] . $vo['agcOrderNo'], 0, 49);
$this->Orders_model->GRI_PersonNum = $vo['adultNum']+$vo['childNum'];
$this->Orders_model->GRI_Days = intval($date_diff->format('%R%a')+1);
$this->Orders_model->GRI_IsCancel = 0;
$this->Orders_model->DeleteFlag = 0;
$this->Orders_model->GRI_OPI_ID = 435;
$this->Orders_model->GRI_operator = 435;
$this->Orders_model->GRI_Creator = 435;
$this->Orders_model->groupinfo_save();
}
/** insert HT */
if ($this->Orders_model->BIZ_COLI_SN === null) {
/** BIZ_Guest */
$this->Orders_model->GUT_LastName = $vo['customerName'];
$this->Orders_model->biz_guest_save();
/**BIZ_ConfirmLineInfo*/
$this->Orders_model->BIZ_COLI_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null;
$this->Orders_model->BIZ_COLI_GroupCode = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_No : "";
$this->Orders_model->BIZ_GUT_SN = $this->Orders_model->GUT_SN;
$this->Orders_model->BIZ_COLI_ID = $this->Orders_model->biz_make_order_number();
$this->Orders_model->BIZ_COLI_ApplyDate = $vo['orderDate'];
$this->Orders_model->BIZ_COLI_sourcetype = empty($this->city_info[$vo['operationDep']]) ? 32090 : $this->city_info[$vo['operationDep']]['COLI_sourcetype'];
$this->Orders_model->BIZ_COLI_State = 9;
$this->Orders_model->BIZ_COLI_servicetype = 'D';
$this->Orders_model->BIZ_COLI_ConfirmType = 52001;
$this->Orders_model->BIZ_COLI_Memo = "";
$this->Orders_model->BIZ_COLI_OrderDetailText = "来自图兰朵系统同步" . $vo["orderId"] . ";线路:" . $vo['routeName'] . "; 团名: " . $vo['agcOrderNo'];
$this->Orders_model->BIZ_COLI_GUT_SN = $this->Orders_model->BIZ_GUT_SN ? $this->Orders_model->BIZ_GUT_SN : null;
$this->Orders_model->BIZ_COLI_OPI_ID = 435;
$this->Orders_model->BIZ_COLI_PayManner = 15006;
$coli_sn[] = $this->Orders_model->biz_confirm_save();
/**BIZ_ConfirmLineDetail*/
$this->Orders_model->COLD_COLI_SN = $this->Orders_model->BIZ_COLI_SN;
$this->Orders_model->COLD_ServiceType = "D";
$this->Orders_model->COLD_ServiceSN = $serviceSN->PAG2_PAG_SN;
$this->Orders_model->COLD_ServiceSN2 = $pag_sub;
$this->Orders_model->COLD_ServiceCity = $serviceSN->PAG_CII_SN;
$this->Orders_model->COLD_StartDate = $vo['travelDate'];
$this->Orders_model->COLD_EndDate = $vo['leaveDate'];
$this->Orders_model->COLD_PersonNum = $vo['adultNum'];
$this->Orders_model->COLD_ChildNum = $vo['childNum'];
$this->Orders_model->cold_state = $vo['orderStatus']==1 ? 9 : 104; // 9订妥 // 104联络地接中
$this->Orders_model->DeleteFlag = 0;
$this->Orders_model->COLD_PlanVEI_SN = $this->city_info[$vo['operationDep']]['PlanVEI_SN'] ? $this->city_info[$vo['operationDep']]['PlanVEI_SN'] : 1343;
$this->Orders_model->COLD_MemoText = $COLD_MemoText;
$this->Orders_model->biz_confirm_detail_save();
/** SP_BIZ_Arrange
* 这里是其他社的订单, 不写这个操作
*/
// if ($this->Orders_model->GRI_SN) {
// $this->Orders_model->sp_biz_arrange();
// }
$cnt++;
}
if ($this->Orders_model->GCI_SN === null) {
/*biz_groupcombineinfo*/
$this->Orders_model->GCI_combineNo = isset($vo['groupOrderNo']) ? $vo['groupOrderNo'] : '';
$this->Orders_model->GCI_GRI_SN = $this->Orders_model->GRI_SN;
$this->Orders_model->GCI_VEI_SN = $this->city_info[$vo['operationDep']]['PlanVEI_SN'] ? $this->city_info[$vo['operationDep']]['PlanVEI_SN'] : 1343;
$this->Orders_model->GCI_VendorOrderId = $vo['orderId'];
$this->Orders_model->GCI_FromAgc = $vo['agcName'];
$this->Orders_model->GCI_groupType = $vo['orderType'];
$this->Orders_model->GCI_travelDate = $vo['travelDate'];
$this->Orders_model->GCI_leaveDate = $vo['leaveDate'];
$this->Orders_model->GCI_createTime = date('Y-m-d H:i:s');
$this->Orders_model->biz_groupcombineinfo_save();
}
}
log_message('error',"Got order list from TuLanDuo. count: " . $resp_arr["responseData"]["totalRows"] . " Insert COLI : " . $cnt);
echo "Got order list from TuLanDuo. count: " . $resp_arr["responseData"]["totalRows"] . "\r\n";
echo "Insert COLI : " . $cnt . "\r\n";
return;
}
/*!
* 更新订单的详情;[客人列表, 团费, 调度信息]
* @date 2018-05-02
* @param [type] $coli_sn HT系统的订单key
*/
public function insert_HT_order_operation($coli_sn=null,$get_vendorID=null)
{
// if ($coli_sn == null) {
// return null;
// }
log_message('error','get_order_operation From TuLanDuo ');
$this->load->model('Order_update');
if ($coli_sn !== null && $coli_sn != 0) {
$to_update_list = $this->Orders_model->get_groupCombineInfo($coli_sn);
} elseif ($get_vendorID !== null) {
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, $get_vendorID);
} else {
// $startDate = ('2018-04-21');
// $endDate = ('2018-04-22'); // test
$startDate = date('Y-m-d', strtotime("-4 days"));
$endDate = date('Y-m-d', strtotime("+2 days"));
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, null, $startDate, $endDate);
}
$unique_orderGroupCombine = array();
$unique_order = array();
$cnt = 0;
foreach ($to_update_list as $key => $order) {
if (in_array($order->GCI_VendorOrderId, $unique_order)) {
continue;
}
$unique_order[] = $order->GCI_VendorOrderId;
$this->tld_order->setOrderId($order->GCI_VendorOrderId)
->setUserId($this->userId)
->setKey($this->key);
$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());
if ( $detail_jsonResp->errMsg == "未查询到对应的订单") {
$this->plan_cancel($order->GCI_VendorOrderId);
if (intval($order->COLI_OPI_ID) === 435) {
$this->order_cancel($order->COLI_ID);
}
}
continue;
}
// 目的地的团已经主动取消, 只有其他渠道的团需要更新状态
if (mb_strstr($detail_jsonResp->orderDetail->agcOrderNo, "取消") !== false) {
$this->plan_cancel($order->GCI_VendorOrderId);
if (intval($order->COLI_OPI_ID) === 435) {
$this->order_cancel($order->COLI_ID);
}
continue;
}
$allDetails_to_HT = "";
$allDetails_to_HT .= "\r\n日程: ";
foreach ($detail_jsonResp->orderDetail->scheduleDetails as $vsd) {
$allDetails_to_HT .= $vsd->travelDate .": ". $vsd->title . "; ";
}
if (isset($detail_jsonResp->orderDetail->operationDetails->guiderOperations) ) {
$allDetails_to_HT .= "\r\n导游: ";
foreach ($detail_jsonResp->orderDetail->operationDetails->guiderOperations as $vg) {
$allDetails_to_HT .= $vg->name ." (". $vg->mobelPhone . "); ";
}
}
if (isset($detail_jsonResp->orderDetail->operationDetails->touristCarOperations) ) {
$allDetails_to_HT .= "\r\n用车: ";
foreach ($detail_jsonResp->orderDetail->operationDetails->touristCarOperations as $vtc) {
$allDetails_to_HT .= $vtc->name .": " . $vtc->driver." (". $vtc->driverTel . ") ";
$allDetails_to_HT .= "[". $vtc->remark . "]; ";
}
}
/** HT 开始 */
/** UPDATE */
$cnt++;
$vei_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] ? $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] : $order->COLD_PlanVEI_SN;
$getInfo_byGroupCode = null;
if (in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) {
$real_groupCode = analysis_groupCode($detail_jsonResp->orderDetail->agcOrderNo);
$getInfo_byGroupCode = $this->Orders_model->get_SN_by_groupCode($real_groupCode, $detail_jsonResp->orderDetail->orderId);
}
$groupSN = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->GRI_SN : $order->COLI_GRI_SN;
$coli_sn = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_SN : $order->COLI_SN;
$coli_id = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_ID : $order->COLI_ID;
$coli_memo = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_Memo : $order->COLI_Memo;
$coli_orderdetailtext = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_OrderDetailText : $order->COLI_OrderDetailText;
$coli_state = isset($getInfo_byGroupCode->COLI_SN) ?
(intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? 9 : $getInfo_byGroupCode->COLI_State)
: 9;
$cold_sn = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLD_SN : $order->COLD_SN;
// HT 订单有重复时, 以图兰朵的团号为正确的订单, 原本已录入的设为无效
if ($getInfo_byGroupCode === null) {
} elseif ($getInfo_byGroupCode->GRI_SN != $order->COLI_GRI_SN && in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) {
if ( $order->COLI_ID && $order->COLI_ID != $getInfo_byGroupCode->COLI_ID) {
$allDetails_to_HT .= "\r\n疑似重复,请更新订单状态:" . $order->COLI_ID;
if (intval($order->COLI_OPI_ID) === 435 ) {
$this->order_cancel($order->COLI_ID);
}
}
}
/** groupcombineinfo */
// $this->Order_update->gci_where_update = " GCI_VEI_SN=$vei_SN and GCI_VendorOrderId='" . $detail_jsonResp->orderDetail->orderId . "'";
$this->Order_update->gci_where_update = " GCI_VendorOrderId='" . $detail_jsonResp->orderDetail->orderId . "'";
$gci_update_column = array(
"GCI_combineNo" => isset($detail_jsonResp->orderDetail->groupOrderNo) ? $detail_jsonResp->orderDetail->groupOrderNo : null
,"GCI_VEI_SN" => $vei_SN
,"GCI_GRI_SN" => $groupSN
,"GCI_travelDate" => $detail_jsonResp->orderDetail->travelDate
,"GCI_leaveDate" => $detail_jsonResp->orderDetail->leaveDate
,"GCI_createTime" => date('Y-m-d H:i:s')
);
$this->Order_update->biz_groupcombineinfo_update($gci_update_column);
/** BIZ_ConfirmLineInfo */
$this->Order_update->coli_where_update = " COLI_SN=" . $coli_sn;
$old_memo = mb_strstr($coli_memo, " orderRemark", true)!==false ? mb_strstr($coli_memo, " orderRemark", true) : $coli_memo;
$new_memo = trim($detail_jsonResp->orderDetail->orderRemark)=="" ? $old_memo : $old_memo . " orderRemark\r\n" . $detail_jsonResp->orderDetail->orderRemark . "\r\n";
$old_detail = mb_strstr($coli_orderdetailtext, " operations", true)!==false ? mb_strstr($coli_orderdetailtext, " operations", true) : $coli_orderdetailtext;
$new_detail = trim($allDetails_to_HT)=="" ? $old_detail : $old_detail . " operations\r\n" . $allDetails_to_HT . "\r\n";
// 团款总金额 美元币种
$travel_fee = 0;
$travel_fee_currency = 'RMB';
if (isset($detail_jsonResp->orderDetail->travelFees) ) {
foreach ($detail_jsonResp->orderDetail->travelFees as $ktf => $vtf) {
$travel_fee = bcadd($travel_fee, $vtf->sumMoney);
}
unset($vtf);
}
$travel_fee = isset($getInfo_byGroupCode->COLI_SN) ?
(intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? $travel_fee : $getInfo_byGroupCode->COLI_Price)
: $travel_fee;
$travel_fee_currency = isset($getInfo_byGroupCode->COLI_SN) ?
(intval($getInfo_byGroupCode->COLI_OPI_ID)===435 ? $travel_fee_currency : $getInfo_byGroupCode->COLI_CUrrency)
: $travel_fee_currency;
$coli_update_column = array(
"COLI_Memo" => substr($new_memo, 0, 400)
,"COLI_OrderDetailText" => $new_detail
,"COLI_State" => $coli_state
,"COLI_Price" => $travel_fee
,"COLI_CUrrency" => $travel_fee_currency
);
$this->Order_update->biz_confirmlineinfo_update($coli_update_column);
/** BIZ_ConfirmLineDetail */ // nothing to update
/** INSERT */
/*BIZ_BookPeople*/
if ($this->Orders_model->bookpeople_exist($cold_sn) === array()) {
if (isset($detail_jsonResp->orderDetail->customers)) {
foreach ($detail_jsonResp->orderDetail->customers as $kd => $vd) {
$this->Orders_model->BPE_FirstName = $vd->name;
$this->Orders_model->BPE_GuestType = $vd->peopleType=="成人" ? 1 : 2;
$this->Orders_model->BPE_Passport = $vd->documentNo;
$bpe_sn[] = $this->Orders_model->biz_book_people_save();
// BIZ_BookPeopleList
$this->Orders_model->biz_bookpeople_List_save($cold_sn, $this->Orders_model->BPE_SN);
}
}
}
/*BIZ_PackageOrderInfo*/
$this->Orders_model->POI_COLD_SN = $cold_sn;
$this->Orders_model->POI_Time = $detail_jsonResp->orderDetail->travelDate;
$this->Orders_model->POI_Hotel = isset($detail_jsonResp->orderDetail->scheduleDetails[0]->accommodation) ? $detail_jsonResp->orderDetail->scheduleDetails[0]->accommodation : '';
$this->Orders_model->POI_HotelAddress = $detail_jsonResp->orderDetail->scheduleDetails[0]->accommodationAddress;
$this->Orders_model->POI_HotelPhone = $detail_jsonResp->orderDetail->scheduleDetails[0]->accommodationTelNo;
$this->Orders_model->POI_EndTime = $detail_jsonResp->orderDetail->leaveDate;
$this->Orders_model->POI_QuotationType = 1; // 1 报价 2 网络支付价 3 促销价
$this->Orders_model->biz_packageorder_save();
/** BIZ_GroupAccountInfo */
// 团款, 只有其他社的订单, 目的地项目组的团款已经直接收入海纳账户
$paytype = 15006; // 地接代收
$pay_currency = 'RMB';
$auto_text = "dataAutoEnter ";
// query latest order detail
$latest_order_detail = $this->Orders_model->get_orderinfo_detail($coli_id);
// 删除旧的录入
$this->Orders_model->biz_groupaccountinfo_cut($coli_sn, $paytype);
if (isset($detail_jsonResp->orderDetail->travelFees) && intval($latest_order_detail[0]->COLI_OPI_ID===435) ) {
foreach ($detail_jsonResp->orderDetail->travelFees as $ktf => $vtf) {
// if ($vtf->reviewStatus == 0) { // 未审核的
// continue;
// }
$this->Orders_model->GAI_Operator = 435;
$this->Orders_model->GAI_COLI_SN = $coli_sn;
$this->Orders_model->GAI_GRI_SN = $groupSN;
$this->Orders_model->GAI_COLI_ID = $coli_id;
$this->Orders_model->GAI_Type = $paytype;
$this->Orders_model->GAI_SQJE = $vtf->sumMoney;
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
$this->Orders_model->GAI_SSJE = $vtf->sumMoney;
$this->Orders_model->GAI_SSDate = date("Y-m-d H:i:s");
$this->Orders_model->GAI_Memo = $auto_text . "团款" . $vtf->type . ", " . $vtf->remark;
$this->Orders_model->biz_groupaccountinfo_save();
}
}
// 目的地项目组的订单为了避免重复录入, 外联会沟通录入, 这里不写入. todo
// 代收
if (isset($detail_jsonResp->orderDetail->replaceCollections) && intval($latest_order_detail[0]->COLI_OPI_ID===435) ) {
foreach ($detail_jsonResp->orderDetail->replaceCollections as $krc => $vrc) {
// if ($vrc->reviewStatus == 0) {
// continue;
// }
$this->Orders_model->GAI_Operator = 435;
$this->Orders_model->GAI_COLI_SN = $coli_sn;
$this->Orders_model->GAI_GRI_SN = $groupSN;
$this->Orders_model->GAI_COLI_ID = $coli_id;
$this->Orders_model->GAI_Type = $paytype;
$this->Orders_model->GAI_SQJE = $vrc->money;
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
$this->Orders_model->GAI_SSJE = $vrc->money;
$this->Orders_model->GAI_SSDate = date("Y-m-d H:i:s");
$this->Orders_model->GAI_Memo = $auto_text . "代收" . $vrc->type . ", " . $vrc->remark;
$this->Orders_model->biz_groupaccountinfo_save();
}
}
if (isset($detail_jsonResp->orderDetail->operationDetails->otherReceives) && intval($latest_order_detail[0]->COLI_OPI_ID===435) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->otherReceives as $koor => $voor) {
$this->Orders_model->GAI_Operator = 435;
$this->Orders_model->GAI_COLI_SN = $coli_sn;
$this->Orders_model->GAI_GRI_SN = $groupSN;
$this->Orders_model->GAI_COLI_ID = $coli_id;
$this->Orders_model->GAI_Type = $paytype;
$this->Orders_model->GAI_SQJE = $voor->sumMoney;
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
$this->Orders_model->GAI_SSJE = $voor->sumMoney;
$this->Orders_model->GAI_SSDate = date("Y-m-d H:i:s");
$this->Orders_model->GAI_Memo = $auto_text . "代收" . $voor->type . ", " . $voor->remark;
$this->Orders_model->biz_groupaccountinfo_save();
}
}
// 代付
if (isset($detail_jsonResp->orderDetail->replacePays) && intval($latest_order_detail[0]->COLI_OPI_ID===435) ) {
foreach ($detail_jsonResp->orderDetail->replacePays as $krp => $vrp) {
// if ($vrp->reviewStatus == 0) {
// continue;
// }
$this->Orders_model->GAI_Operator = 435;
$this->Orders_model->GAI_COLI_SN = $coli_sn;
$this->Orders_model->GAI_GRI_SN = $groupSN;
$this->Orders_model->GAI_COLI_ID = $coli_id;
$this->Orders_model->GAI_Type = $paytype;
$this->Orders_model->GAI_SQJE = "-" . $vrp->money;
$this->Orders_model->GAI_SQJECurrency = $pay_currency;
$this->Orders_model->GAI_SSJE = $vrp->money;
$this->Orders_model->GAI_SSDate = date("Y-m-d H:i:s");
$this->Orders_model->GAI_Memo = $auto_text . $vrp->type . ", " . $vrp->remark;
$this->Orders_model->biz_groupaccountinfo_save();
}
}
/*BIZ_GroupCombineOperationDetail*/
if ( ! isset($detail_jsonResp->orderDetail->groupOrderNo)) { // 没有拼团团号
continue;
}
if (in_array($detail_jsonResp->orderDetail->groupOrderNo, $unique_orderGroupCombine)) {
continue;
}
$unique_orderGroupCombine[] = $detail_jsonResp->orderDetail->groupOrderNo;
// 删除旧的录入
$this->Orders_model->biz_groupcombineoperationdetail_cut($detail_jsonResp->orderDetail->groupOrderNo);
// 门票
if (isset($detail_jsonResp->orderDetail->operationDetails->sceneryOperations)) {
foreach ($detail_jsonResp->orderDetail->operationDetails->sceneryOperations as $ks => $vso) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo;
$this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "sceneryOperations";
$this->Orders_model->GCOD_subType = $vso->type;
$this->Orders_model->GCOD_title = $vso->name;
$this->Orders_model->GCOD_startDate = $vso->useDate;
$this->Orders_model->GCOD_endDate = $vso->useDate;
$this->Orders_model->GCOD_useNum = $vso->useNum;
$this->Orders_model->GCOD_sumMoney = $vso->sumMoney;
$this->Orders_model->GCOD_remark = $vso->remark;
$this->Orders_model->GCOD_dutyName = "";
$this->Orders_model->GCOD_dutyTel = null;
$this->Orders_model->GCOD_dutyPhoto = null;
$this->Orders_model->GCOD_standard = "";
$this->Orders_model->GCOD_carLicense = "";
$this->Orders_model->biz_groupcombineoperationdetail_save();
}
}
// 用房 ...
// 用餐
if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->restraurantOperations as $vro) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "restraurantOperations";
$this->Orders_model->GCOD_subType = $vro->type;
$this->Orders_model->GCOD_title = $vro->name;
$this->Orders_model->GCOD_startDate = $vro->useDate;
$this->Orders_model->GCOD_endDate = $vro->useDate;
$this->Orders_model->GCOD_useNum = $vro->useNum;
$this->Orders_model->GCOD_sumMoney = $vro->sumMoney;
$this->Orders_model->GCOD_standard = $vro->standard;
$this->Orders_model->GCOD_remark = $vro->remark;
$this->Orders_model->GCOD_dutyName = "";
$this->Orders_model->GCOD_dutyTel = null;
$this->Orders_model->GCOD_dutyPhoto = null;
$this->Orders_model->GCOD_carLicense = "";
$this->Orders_model->biz_groupcombineoperationdetail_save();
}
}
// 用车
if (isset($detail_jsonResp->orderDetail->operationDetails->touristCarOperations)) {
foreach ($detail_jsonResp->orderDetail->operationDetails->touristCarOperations as $vco) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "touristCarOperations";
$this->Orders_model->GCOD_subType = $vco->type;
$this->Orders_model->GCOD_title = $vco->name;
$this->Orders_model->GCOD_dutyName = $vco->driver;
$this->Orders_model->GCOD_dutyTel = $vco->driverTel;
$this->Orders_model->GCOD_startDate = $vco->startDate;
$this->Orders_model->GCOD_endDate = $vco->endDate;
$this->Orders_model->GCOD_sumMoney = $vco->sumMoney;
$this->Orders_model->GCOD_carLicense = $vco->carLicense;
$this->Orders_model->GCOD_useNum = 1;
$this->Orders_model->GCOD_standard = "";
$this->Orders_model->GCOD_dutyPhoto = null;
$this->Orders_model->GCOD_remark = $vco->remark;
$this->Orders_model->biz_groupcombineoperationdetail_save();
}
}
// 导游服务
if (isset($detail_jsonResp->orderDetail->operationDetails->guiderOperations) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->guiderOperations as $vgo) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "guiderOperations";
$this->Orders_model->GCOD_subType = "";
$this->Orders_model->GCOD_title = "";
$this->Orders_model->GCOD_dutyName = $vgo->name;
$this->Orders_model->GCOD_dutyTel = $vgo->mobelPhone;
$this->Orders_model->GCOD_dutyPhoto = isset($vgo->guiderPhoto) ? $vgo->guiderPhoto : '';
$this->Orders_model->GCOD_startDate = $vgo->startDate;
$this->Orders_model->GCOD_endDate = $vgo->endDate;
$this->Orders_model->GCOD_sumMoney = $vgo->sumMoney;
$this->Orders_model->GCOD_carLicense = "";
$this->Orders_model->GCOD_standard = "";
$this->Orders_model->GCOD_remark = $vgo->remark;
$this->Orders_model->GCOD_useNum = 1;
$this->Orders_model->biz_groupcombineoperationdetail_save();
}
}
// 其他支出
if (isset($detail_jsonResp->orderDetail->operationDetails->otherCosts) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->otherCosts as $voc) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "otherCosts";
$this->Orders_model->GCOD_subType = $voc->type;
$this->Orders_model->GCOD_title = "";
$this->Orders_model->GCOD_dutyName = "";
$this->Orders_model->GCOD_dutyTel = "";
$this->Orders_model->GCOD_dutyPhoto = '';
$this->Orders_model->GCOD_startDate = "";
$this->Orders_model->GCOD_endDate = "";
$this->Orders_model->GCOD_sumMoney = $voc->sumMoney;
$this->Orders_model->GCOD_carLicense = "";
$this->Orders_model->GCOD_standard = "";
$this->Orders_model->GCOD_remark = $voc->remark;
$this->Orders_model->GCOD_useNum = $voc->useNum;
$this->Orders_model->biz_groupcombineoperationdetail_save();
}
}
// 其他收入
if (isset($detail_jsonResp->orderDetail->operationDetails->otherReceives) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->otherReceives as $vor) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "otherReceives";
$this->Orders_model->GCOD_subType = $vor->type;
$this->Orders_model->GCOD_title = "";
$this->Orders_model->GCOD_dutyName = "";
$this->Orders_model->GCOD_dutyTel = "";
$this->Orders_model->GCOD_dutyPhoto = '';
$this->Orders_model->GCOD_startDate = "";
$this->Orders_model->GCOD_endDate = "";
$this->Orders_model->GCOD_sumMoney = $vor->sumMoney;
$this->Orders_model->GCOD_carLicense = "";
$this->Orders_model->GCOD_standard = "";
$this->Orders_model->GCOD_remark = $vor->remark;
$this->Orders_model->GCOD_useNum = $vor->useNum;
$this->Orders_model->biz_groupcombineoperationdetail_save();
}
}
} // end foreach order
log_message('error',"Got order operations from TuLanDuo, count: " . count($cnt));
echo "Got order operations from TuLanDuo, count: " . count($cnt);
return;
}
/*!
* 取消团
* @date 2018-05-02
* @param string $COLI_ID HT系统订单号
*/
public function order_cancel($COLI_ID="")
{
if ($COLI_ID == '') {
return false;
}
log_message('error','修改为不成行 order_cancel ' . $COLI_ID);
/** UPDATE HT */
/** BIZ_ConfirmLineInfo */
$this->Order_update->coli_where_update = " COLI_ID='" . $COLI_ID . "'";
$coli_update_column = array(
"COLI_State" => 40
);
return $this->Order_update->biz_confirmlineinfo_update($coli_update_column);
}
public function plan_cancel($vendorID=0)
{
/** groupcombineinfo */
$this->Order_update->gci_where_update = " GCI_VendorOrderId='" . $vendorID . "'";
$gci_update_column = array(
"GCI_combineNo" => 'cancel'
,"GCI_createTime" => date('Y-m-d H:i:s')
);
$this->Order_update->biz_groupcombineinfo_update($gci_update_column);
}
/*!
* 发送预订计划到地接系统
* @date 2018-05-02
* @param string $COLI_ID HT系统订单号
*/
public function order_push($COLI_ID="") // test
{
exit();
/** 目的地 test */
$this->userId = "358";
$this->key = "a08f26ddc5b1bd4c8e5eafcac28fc1ec";
$this->load->model('TuLanDuo_addOrUpdateRouteOrderContentBuilder', 'tldOrderBuilder');
$orderinfo = $this->Orders_model->get_orderinfo_detail($COLI_ID);
if(empty($orderinfo)) {return;}
$COLD_SN_str = implode(',', array_map( function($element){return $element->COLD_SN;}, $orderinfo )) ;
$guestlist = $this->Orders_model->get_guestlist($COLD_SN_str);
$scheduleDetails = $this->Orders_model->get_scheduleDetails($COLD_SN_str);
$routeName = isset($this->special_route_name[$scheduleDetails[0]->PAG_Code]) ? $this->special_route_name[$scheduleDetails[0]->PAG_Code] : $scheduleDetails[0]->PAG2_Name;
// 子线路
if ($scheduleDetails[0]->PAGS_CN_Title) {
$routeName .= "[" . $scheduleDetails[0]->PAGS_CN_Title . "]";
}
if (isset($this->special_route[$scheduleDetails[0]->PAG_Code])) {
$scheduleDetails = $this->Orders_model->get_packageDetails($this->special_route[$scheduleDetails[0]->PAG_Code]);
}
$travelFees = $this->Orders_model->get_paymentDetails($COLI_ID);
bcscale(4);
$this->tldOrderBuilder->setUserId($this->userId)
->setKey($this->key)
->setOrderType(2) // todo
->setRouteName($routeName)
->setRouteType($scheduleDetails[0]->CII2_Name . "目的地线路")
->setAgcOrderNo($orderinfo[0]->COLI_GroupCode . "-" . $scheduleDetails[0]->CII2_Name)
->setAdultNum($orderinfo[0]->COLD_PersonNum)
->setChildNum($orderinfo[0]->COLD_ChildNum)
->setDestination($scheduleDetails[0]->CII2_Name)
->setTravelDate(strstr($orderinfo[0]->COLD_StartDate, " ", true))
->setLeavedDate(strstr($orderinfo[0]->COLD_EndDate, " ", true))
->setOrderRemark($orderinfo[0]->COLI_Memo . "\r\n" . $orderinfo[0]->COLD_Memo . "\r\n" . $orderinfo[0]->COLD_MemoText); // todo 抵离交通
foreach ($guestlist as $key => $vg) {
$this->tldOrderBuilder->setCustomersName($key, $vg->BPE_FirstName)
->setCustomersPeopleType($key, ($vg->BPE_GuestType==1 ? "成人" : "儿童"))
->setCustomersDocumentType($key, "护照") // Passport No.
->setCustomersDocumentNo($key, $vg->BPE_Passport)
->setCustomersOtherInfo($key, $this->Orders_model->GetNationalityName($orderinfo[0]->GUT_NationalityID));
}
foreach ($scheduleDetails as $ks => $vs) {
$this->tldOrderBuilder->setScheduleDetailsContent($ks, $vs->PAG2_Title)
->setScheduleDetailsTitle($ks, $vs->PAG2_Name)
// ->set_scheduleDetails($ks, "traffic", ($vs->PAG_Vehicle>60001 ? 1 : 0))
->setScheduleDetailsBreakFirst($ks, 0 )
->setScheduleDetailsDinner($ks, (in_array($vs->PAG_Meal, array('61003', '61004')) ? 1 : 0) )
->setScheduleDetailsLunch($ks, (in_array($vs->PAG_Meal, array('61002', '61004')) ? 1 : 0));
}
foreach ($travelFees as $kf => $vf) { // todo 发生退款或多笔收款
$this->tldOrderBuilder->setTravelFeesType($kf, "Per Group")
->setTravelFeesMoney($kf, $vf->GAI_SQJE)
->setTravelFeesNum($kf, 1)
->setTravelFeesUnit($kf, bcdiv($vf->GAI_SSJE, $vf->GAI_SQJE))
->setTravelFeesSumMoney($kf, $vf->GAI_SSJE)
->setTravelFeesRemark($kf, $vf->GAI_Memo);
}
$resp = $this->excute_curl($this->neworder_url, $this->tldOrderBuilder);
/** BIZ_GroupCombineInfo */
if (json_decode($resp)->status == 1) {
log_message('error','in GCI ' . json_decode($resp)->responseData->orderId);
$this->Orders_model->GCI_COLI_SN = $orderinfo[0]->COLI_SN;
$this->Orders_model->GCI_GRI_SN = $orderinfo[0]->COLI_GRI_SN;
$this->Orders_model->GCI_VendorOrderId = json_decode($resp)->responseData->orderId;
$this->Orders_model->GCI_FromAgc = "D目的地桂林组";
$this->Orders_model->biz_groupcombineinfo_save();
}
// email 供应商 todo
echo "Order Push done.";
return;
}
/*!
* 订单状态变更,调度变更
* (地接社调用, 并邮件通知外联)
*/
public function order_change()
{
$this->load->model('Order_update');
$ret['status'] = -1;
$ret['errMsg'] = "未知错误";
$input = $this->input->post();
$vendorID = $input['userId'];
$validate = $this->calc_key($vendorID, $input['key']);
if ($validate !== TRUE) {
$ret['errMsg'] = "身份验证失败.";
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
}
// $vendorID = 29188;//29188 1343; // test
$vas_info = array();
if (in_array($input['agcName'], array("D目的地桂林组", "Trippest"))) {
$vas_info = $this->Orders_model->get_vendorarrangestate_byVendor($input['orderId'], $vendorID);
if (empty($vas_info) && ! empty($input['agcOrderNo'])) {
$real_groupCode = analysis_groupCode($input['agcOrderNo']);
$vas_info = $this->Orders_model->get_vendorarrangestate_byGroup($real_groupCode, $vendorID);
}
} elseif ($input['agcName'] == '桂林海纳国旅') {
$real_groupCode = analysis_groupCode($input['agcOrderNo']);
$vas_info = $this->Orders_model->get_vendorarrangestate_byGroup_T($real_groupCode, $vendorID);
}
if (empty($vas_info)) {
$ret['errMsg'] = "未找到订单.";
} else {
$vendor_manager = $this->Orders_model->get_vendorContact($vendorID);
/** VendorArrangeState */
$VAS_ConfirmInfo = $input['orderRemark'] . "\r\n======确认人: " . $input['orderDuty'] . ", 确认时间: " . $input['orderTime'];
$VAS_ConfirmInfo .= "\r\n" . $vas_info[0]->VAS_ConfirmInfo;
$update_vas = $this->Order_update->vendorStatus_update($vas_info[0]->VAS_SN, $vendor_manager->LMI_SN, $VAS_ConfirmInfo);
if (in_array($input['agcName'], array("D目的地桂林组", "Trippest"))) { // 传统团的不需要更新订单主表
/** BIZ_confirmlineinfo */
$this->Order_update->coli_where_update = " COLI_SN=" . $vas_info[0]->COLI_SN;
$coli_update_column = array(
"COLI_State" => 7
);
$update_coli = $this->Order_update->biz_confirmlineinfo_update($coli_update_column);
}
if ($update_vas === TRUE) {
$ret['status'] = 1;
$ret['errMsg'] = "";
}
}
if ($ret['status'] !== 1) {
log_message('error','图兰朵确认上报失败. POST RAW: ' . raw_json_encode($input) . "; Result: " . raw_json_encode($ret));
}
$sender_name = "中华游供应商合作平台";
$sender_mail = "info@chinahighlights.net";
$from_name = $vendor_manager->LMI2_Name;
$from_mail = $vendor_manager->LMI_ListMail;
$to_name = $vas_info[0]->OPI_Name;
$to_mail = $vas_info[0]->OPI_Email;
$subject = $input['agcOrderNo'] . "团已确认: " . $vendor_manager->VEI2_CompanyBN;
$mail_body = $vendor_manager->VEI2_CompanyBN . "对团" . $input['agcOrderNo'] . "的计划在" . $input['orderTime'] . "已确认。\r\n";
$mail_body .= "确认说明:" . $input['orderRemark'] . "\r\n";
$mail_body .= "确认人:$vendor_manager->LMI2_Name $vendor_manager->LMI_ListMail 固定电话: $vendor_manager->LMI_Telephone 移动电话:$vendor_manager->LMI_Mobile\r\n";
$mail_body .= "变更内容: " . $vas_info[0]->VAS_ChangeText . "\r\n";
$this->Orders_model->save_automail($sender_name, $sender_mail, $from_name, $from_mail, $to_name, $to_mail, $subject, $mail_body, $sender_name);
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
}
public function refresh_operation($coli_sn=0)
{
$this->load->model('OrderFinance_model', 'combine_model');
// $this->insert_HT_order_operation($coli_sn);
echo "string";
$data['combineNo_arr'] = $this->combine_model->get_order_combineNo($coli_sn);
foreach ($data['combineNo_arr'] as $kcn => $vcn) {
$data['combineNo_arr'][$kcn]->cost = $this->combine_model->get_combine_sumMoney($vcn->GCI_combineNo);
}
$this->load->view('operation',$data);
}
protected function excute_curl($url, $content_builder) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Accept: application/json"
));
$params_str = $content_builder->getBizContent();
$postBody = array('jsonParams' => $params_str, "notHander" => 1);
if (is_string($params_str) && 0 < mb_strlen($params_str)) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postBody);
}
$reponse = curl_exec($ch);
$eval_resp = json_decode($reponse);
if (curl_errno($ch) || $eval_resp->status == 0) {
log_message('error', "curl error code: ".curl_error($ch) . $eval_resp->errMsg . "; curl postBodyString: ".json_encode($postBody));
} else {
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode) {
log_message('error', "Request html Status Code: ".$httpStatusCode."; curl postBodyString: ".json_encode($postBody));
}
}
curl_close($ch);
return $reponse;
}
/*!
* 转换字符集编码
* @param $data
* @param $targetCharset
* @return string
*/
protected function characet($data, $targetCharset) {
if (!empty($data)) {
$fileType = "UTF-8";
if (strcasecmp($fileType, $targetCharset) != 0) {
$data = mb_convert_encoding($data, $targetCharset, $fileType);
// $data = iconv($fileType, $targetCharset.'//IGNORE', $data);
}
}
return $data;
}
public function pag_no_tmp($routeName='')
{
return array(
"故宫深度一日游(目的地)" => "BJSIC-44"
,"故宫深度游拼团(目的地)" => "BJSIC-44"
,"北京精品一日游(目的地)" => "BJSIC-41"
,"北京精品两日游(目的地)" => "BJSIC-42"
,"北京精品三日游(目的地)" => "BJSIC-43"
,"北京精品游D2目的地" => "BJSIC-42"
,"北京精品游D3目的地" => "BJSIC-43"
,"北京单租车服务(目的地)" => "BJALC-209"
,"北京市内-天津新港大车接送(目的地)" => "BJSIC-16"
,"天津新港-北京市内大车接送(目的地)" => "BJSIC-16"
,"箭扣-慕田峪徒步一日游(目的地)" => "BJSIC-45"
,"箭扣-慕田峪长城徒步拼团(目的地)" => "BJSIC-45"
,"司马台西-金山岭徒步一日游(目的地)" => "BJSIC-46"
,"司马台西-金山岭长城徒步拼团(目的地)" => "BJSIC-46"
,"慕田峪半日游拼团(目的地)" => "BJSIC-47"
,"古北口长城徒步一日游(目的地)" => "BJSIC-48"
,"半日游广场故宫拼团(目的地)" => "BJSIC-41"
// ,=>
,"西安精品一日游(目的地)" => "XASIC-41"
,"西安精品两日游(目的地)" => "XASIC-42"
,"西安单租车服务(目的地)" => "XASIC-17"
,"西安单租车接送服务(目的地)" => "XASIC-17"
,"西安兵马俑精品一日游(目的地)" => "XASIC-41"
,"西安兵马俑精品半日游(目的地)" => "XASIC-15"
,"西安汉阳陵市内精品一日游(目的地)" => "XASIC-42"
// ,=>
,"上海精品一日游(目的地)" => "SHSIC-41"
,"上海市内精品一日游(目的地)" => "SHSIC-42"
,"周庄锦溪精品一日游(目的地)" => "SHSIC-43"
,"上海单租车(目的地)" => "SHSIC-45" //"SHALC-6,7,8,9"
);
}
public function calc_key($userId, $key)
{
$default = "b825e39422a54875a95752fc7ed6f5d2";
$ret = md5(hash("sha256", $userId.$default));
return $ret===$key;
}
public function call_do()
{
$this->Orders_model->test();
}
}