|
|
|
@ -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);
|
|
|
|
|