tracking: 增加除了图兰朵以外的调度查询, 目前是导游信息

feature/trippest
lyt 7 years ago
parent ab361415e8
commit c33a710e76

@ -9,6 +9,11 @@ class Api extends CI_Controller {
$this->load->helper('array');
$this->load->library('trippest');
$this->load->model('Orders_query', 'Orders_model');
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST, GET');
header('Access-Control-Max-Age:0');
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
header('Access-Control-Allow-Credentials:true');
}
public function index()
@ -20,11 +25,134 @@ class Api extends CI_Controller {
public function operation_detail($find=null)
{
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST, GET');
header('Access-Control-Max-Age:0');
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
header('Access-Control-Allow-Credentials:true');
($find===null) ? $find = $this->input->get_post('q') : null;
$find = (mb_strlen($find)<9) ? null : $this->input->get_post('q');
$order_plan = $this->Orders_model->get_order_vendorplan($find);
if ($find===null || $order_plan == null) {
$ret['status'] = 0;
$ret['msg'] = "Not Found.";
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
}
$ret['status'] = 1;
$ret['msg'] = "";
$gri_sn = $order_plan[0]->VAS_GRI_SN;
$group_number_info = analysis_groupCode($order_plan[0]->COLI_GroupCode);
$ret['group_number'] = $group_number_info["cut"];
$operation_info = $ht_tourguide = $this->tourguide_common($gri_sn);
if (empty($operation_info)) {
return $this->operation_detail_tulanduo($find);
}
$ret['operation'] = $operation_info;
/** 外联信息 */
$raw_opi_id = 0;
if (intval($order_plan[0]->COLI_OPI_ID) === 435) {
$real_code_info = analysis_groupCode($ret['group_number']);
$raw_opi_id = $this->Orders_model->get_gri_opi_id($real_code_info['cut']);
} else {
$raw_opi_id = $order_plan[0]->COLI_OPI_ID;
}
$operator = $this->Orders_model->get_operator($raw_opi_id);
if ( ! empty($operator)) {
$ret['operator']['chinese_name'] = $operator->OPI_Name;
$ret['operator']['mobile'] = $operator->OPI_MoveTelephone;
$ret['operator']['email'] = $operator->OPI_Email;
$ret['operator']['english_name'] = $operator->OPI2_Name;
// 英文名没有
if ($operator->OPI_FirstName == null || $operator->OPI2_Name == null ) {
$ret['operator']['english_name'] = ucfirst(strstr($operator->OPI_Email, "@", true));
}
}
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
}
public function tourguide_common($gri_sn)
{
$operation = array();
$tourguide = $this->Orders_model->get_plan_tourguide($gri_sn);
if (empty($tourguide)) {
return null;
}
$order_detail = $this->Orders_model->get_order_detail($gri_sn);
foreach ($order_detail as $kd => $poi) {
$operation_tmp = array();
$operation_tmp['start_date'] = substr($poi->COLD_StartDate, 0, 10);
$out_datetime = strtotime($poi->COLD_StartDate);
$out_datetime2 = strtotime($poi->COLD_EndDate);
$operation_tmp['dateWeek_text'] = date('D', $out_datetime);
$operation_tmp['dateDay_text'] = date('d', $out_datetime);
$operation_tmp['dateMonth_text'] = date('M', $out_datetime);
$operation_tmp['dateYear_text'] = date('Y', $out_datetime);
if ($out_datetime !== $out_datetime2) {
$operation_tmp['start_date'] = $poi->COLD_StartDate . " to " . $poi->COLD_EndDate;
}
$operation_tmp['tour_name'] = $poi->PAG2_Name;
$code_name = $this->trippest->tour_name(strtoupper($poi->pag_code));
if ($code_name !== "") {
$operation_tmp['tour_name'] = $code_name;
}
// 领队名字
$operation_tmp['leader_name'] = trim($poi->GUT_FirstName . " " . $poi->GUT_LastName);
// 行程人数
$operation_tmp['personNum_text'] = $poi->COLD_PersonNum + $poi->COLD_ChildNum;
$operation_tmp['personNum_text'] .= " (" . $poi->COLD_PersonNum . " Adult(s)";
if ($poi->COLD_ChildNum > 0) {
$operation_tmp['personNum_text'] .= " " . $poi->COLD_ChildNum . " Child(ren)";
}
$operation_tmp['personNum_text'] .= ")" ;
// 人数
$operation_tmp['adult_number'] = $poi->COLD_PersonNum;
$operation_tmp['kid_number'] = $poi->COLD_ChildNum;
// 酒店
$operation_tmp['hotel_name'] = $poi->POI_Hotel;
$operation_tmp['hotel_address'] = $poi->POI_HotelAddress;
$operation_tmp['hotel_tel'] = $poi->POI_HotelPhone;
// 航班/车次
$operation_tmp['flights_no'] = $poi->POI_FlightsNo;
$operation_tmp['flights_airport'] = $poi->POI_AirPort;
// 接送信息
$operation_tmp['pick_up'] = "";
$operation_tmp['drop_off'] = "";
$decode_MemoText = $memo_text_tmp = "";
$operation_tmp['pick_up'] = trim(substr(strstr(strstr($poi->COLI_OrderDetailText, "Pick Up From:"), "\n", true), 13));
$operation_tmp['drop_off'] = trim(substr(strstr(strstr($poi->COLI_OrderDetailText, "Drop Off:"), "\n" , true), 9));
if ($operation_tmp['pick_up'] === "") {
if (strval($poi->PAGS_Direction) === '0') {
$operation_tmp['pick_up'] .= $poi->POI_FlightsNo . " " . $poi->POI_AirPort;
$operation_tmp['drop_off'] .= $poi->POI_Hotel;
} else if (strval($poi->PAGS_Direction) === '1') {
$operation_tmp['pick_up'] .= $poi->POI_Hotel;
$operation_tmp['drop_off'] .= $poi->POI_FlightsNo . " " . $poi->POI_AirPort;
} else { // if ($poi->POI_FlightsNo != "")
$operation_tmp['pick_up'] .= $poi->POI_Hotel;
// $operation_tmp['drop_off'] .= $poi->POI_FlightsNo . " " . $poi->POI_AirPort; // 结束后送机
}
}
$opd = new stdclass();
foreach ($tourguide as $key => $tgi) {
if ($poi->COLD_PlanVEI_SN === $tgi->EOI_VEI_SN
// && strcmp($operation_tmp['start_date_raw'], substr($poi->COLD_StartDate, 0, 10) ) === 0
) {
$opd = $tgi;
}
}
if (empty($opd)) {
$opd = $tgi[0];
}
$tourguide_tmp['guide_name'] = $opd->TGI2_Name;
$tourguide_tmp['guide_tel'] = $opd->TGI_Mobile;
$tourguide_tmp['guide_pic'] = "";
// $tourguide_tmp['using_startdate'] = $opd->GCOD_startDate;
// $tourguide_tmp['using_enddate'] = $opd->GCOD_endDate;
$operation_tmp['tourguide'][] = $tourguide_tmp;
$tourguide_tmp = array();
$operation[] = $operation_tmp;
}
return $operation;
}
public function operation_detail_tulanduo($find=null)
{
($find===null) ? $find = $this->input->get_post('q') : null;
$find = (mb_strlen($find)<9) ? null : $this->input->get_post('q');
$order_project = $this->Orders_model->get_package_order($find);

@ -24,6 +24,53 @@ class Orders_query extends CI_Model {
return 0;
}
public function get_order_vendorplan($COLI_ID)
{
$sql = "SELECT COLI_GroupCode,COLI_OPI_ID,vas.*
from BIZ_ConfirmLineInfo coli
left join VendorArrangeState vas on VAS_GRI_SN=COLI_GRI_SN
where COLI_GroupCode like '%" . $this->HT->escape_like_str($COLI_ID) . "%'
OR COLI_ID like '%" . $this->HT->escape_like_str($COLI_ID) . "%'
OR COLI_PriceMemo like '%" . $this->HT->escape_like_str($COLI_ID) . "%'
";
return $this->HT->query($sql)->result();
}
public function get_order_detail($GRI_SN)
{
$sql = "SELECT
pag2.PAG2_Name
,(select PAG_code from biz_packageinfo where pag_sn=COLD_ServiceSN) as pag_code
,pags.PAGS_Direction,pags.PAGS_describ
,poi.POI_Hotel,poi.POI_HotelAddress,poi.POI_HotelPhone
,poi.POI_AirPort,poi.POI_FlightsNo
,GUT_FirstName,GUT_LastName
,cold.*,coli.*
from BIZ_ConfirmLineDetail cold
inner join BIZ_ConfirmLineInfo coli on COLI_SN=COLD_COLI_SN and cold.DeleteFlag=0
inner join BIZ_PackageOrderInfo poi on poi.POI_COLD_SN=COLD_SN
inner join BIZ_GUEST g on g.GUT_SN=COLI_GUT_SN
left join BIZ_PackageInfo2 pag2 on pag2.PAG2_PAG_SN=COLD_ServiceSN and pag2.PAG2_LGC=1
left join BIZ_PackageInfoSub pags on pags.PAGS_SN=cold.COLD_ServiceSN2
where COLI_GRI_SN=$GRI_SN
order by COLD_StartDate ";
return $this->HT->query($sql)->result();
}
public function get_plan_tourguide($GRI_SN)
{
$sql = "SELECT tgi_info.TGI_SN,tgi_info.TGI2_Name,tgi_info.TGI_Mobile
,eoi.EOI_GetDate,eoi.EOI_Date,eoi.EOI_VEI_SN
from Eva_ObjectInfo eoi
left join
( select TGI_SN,TGI_Mobile,TGI2_Name from TouristGuideInfo tgi
left join TouristGuideInfo2 tgi2 on TGI2_TGI_SN=TGI_SN and TGI2_LGC=1
) as tgi_info on tgi_info.TGI_SN=eoi.EOI_ObjSN
where eoi.EOI_Type=3 and EOI_gri_sn=$GRI_SN
order by eoi.EOI_GetDate ";
return $this->HT->query($sql)->result();
}
function get_package_order($COLI_ID)
{
$order_info_sql = "SELECT
@ -50,14 +97,6 @@ class Orders_query extends CI_Model {
// OR COLI_ID like '%" . $this->HT->escape_like_str($COLI_ID) . "%'
$order_info_query = $this->HT->query($order_info_sql);
$ret = $order_info_query->result();
// if ($order_info_query->num_rows() > 0) {
// $operation_sql = "SELECT gcod.*
// from GroupCombineOperationDetail gcod
// where GCOD_GCI_combineNo=?
// and gcod.GCOD_operationType in ('touristCarOperations','guiderOperations')";
// $operation_info = $this->HT->query($operation_sql, array($ret['order_info'][0]->GCI_combineNo));
// $ret['operation_info'] = $operation_info->result();
// }
return $ret;
}

Loading…
Cancel
Save