|
|
|
|
@ -23,59 +23,104 @@ class Api extends CI_Controller {
|
|
|
|
|
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;
|
|
|
|
|
$order_obj = $this->Orders_model->get_operation_detail_for_client($find);
|
|
|
|
|
if ($order_obj['order_info'] == null) {
|
|
|
|
|
$order_obj['status'] = 0;
|
|
|
|
|
$order_obj['msg'] = "Not Found.";
|
|
|
|
|
return $this->output->set_content_type('application/json')->set_output(json_encode($order_obj));
|
|
|
|
|
}
|
|
|
|
|
$order_obj['status'] = 1;
|
|
|
|
|
$order_obj['msg'] = "";
|
|
|
|
|
// 英文名没有
|
|
|
|
|
if ($order_obj['operator_info']->OPI_FirstName == null
|
|
|
|
|
|| $order_obj['operator_info']->OPI2_Name == null ) {
|
|
|
|
|
$order_obj['operator_info']->OPI_FirstName = $order_obj['operator_info']->OPI2_Name
|
|
|
|
|
= ucfirst(strstr($order_obj['operator_info']->OPI_Email, "@", true));
|
|
|
|
|
$order_project = $this->Orders_model->get_package_order($find);
|
|
|
|
|
if ($order_project == 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'] = "";
|
|
|
|
|
$ret['group_number'] = $order_project[0]->COLI_GroupCode;
|
|
|
|
|
// 领队名字
|
|
|
|
|
$order_obj['order_info']->leader_name = trim($order_obj['order_info']->GUT_FirstName . " " . $order_obj['order_info']->GUT_LastName);
|
|
|
|
|
// 团人数
|
|
|
|
|
$order_obj['order_info']->personNum_text = $order_obj['order_info']->COLD_PersonNum + $order_obj['order_info']->COLD_ChildNum;
|
|
|
|
|
$order_obj['order_info']->personNum_text .= " (" . $order_obj['order_info']->COLD_PersonNum . " Adult(s)";
|
|
|
|
|
if ($order_obj['order_info']->COLD_ChildNum > 0) {
|
|
|
|
|
$order_obj['order_info']->personNum_text .= " " . $order_obj['order_info']->COLD_ChildNum . " Child(ren)";
|
|
|
|
|
}
|
|
|
|
|
$order_obj['order_info']->personNum_text .= ")" ;
|
|
|
|
|
// 出团时间
|
|
|
|
|
$out_datetime = strtotime($order_obj['order_info']->COLD_StartDate);
|
|
|
|
|
$order_obj['order_info']->dateWeek_text = date('D', $out_datetime);
|
|
|
|
|
$order_obj['order_info']->dateDay_text = date('d', $out_datetime);
|
|
|
|
|
$order_obj['order_info']->dateMonth_text = date('M', $out_datetime);
|
|
|
|
|
$order_obj['order_info']->dateYear_text = date('Y', $out_datetime);
|
|
|
|
|
// 接送信息
|
|
|
|
|
$order_obj['order_info']->pick_up = "";
|
|
|
|
|
$order_obj['order_info']->drop_off = "";
|
|
|
|
|
if ($order_obj['order_info']->COLD_MemoText != null && json_decode($order_obj['order_info']->COLD_MemoText) != null) {
|
|
|
|
|
$decode_MemoText = json_decode($order_obj['order_info']->COLD_MemoText, true);
|
|
|
|
|
$order_obj['order_info']->pick_up = $decode_MemoText['Pick up'];
|
|
|
|
|
$order_obj['order_info']->drop_off = $decode_MemoText['Drop off'];
|
|
|
|
|
} else {
|
|
|
|
|
$memo_text_tmp = trim(strstr($order_obj['order_info']->COLD_MemoText, "Pick Up From:"));
|
|
|
|
|
$order_obj['order_info']->pick_up = trim(strstr($memo_text_tmp, "Drop Off:", true));
|
|
|
|
|
$order_obj['order_info']->drop_off = trim(strstr($memo_text_tmp, "Drop Off:"));
|
|
|
|
|
$ret['leader_name'] = trim($order_project[0]->GUT_FirstName . " " . $order_project[0]->GUT_LastName);
|
|
|
|
|
$ret['package'] = null;
|
|
|
|
|
foreach ($order_project as $kd => $poi) {
|
|
|
|
|
$tmp = array();
|
|
|
|
|
// 行程人数
|
|
|
|
|
$tmp['personNum_text'] = $poi->COLD_PersonNum + $poi->COLD_ChildNum;
|
|
|
|
|
$tmp['personNum_text'] .= " (" . $poi->COLD_PersonNum . " Adult(s)";
|
|
|
|
|
if ($poi->COLD_ChildNum > 0) {
|
|
|
|
|
$tmp['personNum_text'] .= " " . $poi->COLD_ChildNum . " Child(ren)";
|
|
|
|
|
}
|
|
|
|
|
$tmp['personNum_text'] .= ")" ;
|
|
|
|
|
// 人数
|
|
|
|
|
$tmp['adult_number'] = $order_project[0]->COLD_PersonNum;
|
|
|
|
|
$tmp['kid_number'] = $order_project[0]->COLD_ChildNum;
|
|
|
|
|
// 出团时间
|
|
|
|
|
$tmp['start_date'] = $poi->COLD_StartDate;
|
|
|
|
|
$tmp['end_date'] = $poi->COLD_EndDate;
|
|
|
|
|
$tmp['tour_name'] = $poi->PAG2_Name;
|
|
|
|
|
$out_datetime = strtotime($poi->COLD_StartDate);
|
|
|
|
|
$tmp['dateWeek_text'] = date('D', $out_datetime);
|
|
|
|
|
$tmp['dateDay_text'] = date('d', $out_datetime);
|
|
|
|
|
$tmp['dateMonth_text'] = date('M', $out_datetime);
|
|
|
|
|
$tmp['dateYear_text'] = date('Y', $out_datetime);
|
|
|
|
|
// 接送信息
|
|
|
|
|
$tmp['pick_up'] = "";
|
|
|
|
|
$tmp['drop_off'] = "";
|
|
|
|
|
$decode_MemoText = $memo_text_tmp = "";
|
|
|
|
|
if ($poi->COLD_MemoText != null && json_decode($poi->COLD_MemoText) != null) {
|
|
|
|
|
$decode_MemoText = json_decode($poi->COLD_MemoText, true);
|
|
|
|
|
$tmp['pick_up'] = $decode_MemoText['Pick up'];
|
|
|
|
|
$tmp['drop_off'] = $decode_MemoText['Drop off'];
|
|
|
|
|
} else {
|
|
|
|
|
$memo_text_tmp = trim(strstr($poi->COLD_MemoText, "Pick Up From:"));
|
|
|
|
|
$tmp['pick_up'] = trim(strstr($memo_text_tmp, "Drop Off:", true));
|
|
|
|
|
$tmp['drop_off'] = trim(strstr($memo_text_tmp, "Drop Off:"));
|
|
|
|
|
}
|
|
|
|
|
// 酒店
|
|
|
|
|
$tmp['hotel_name'] = $poi->POI_Hotel;
|
|
|
|
|
$tmp['hotel_address'] = $poi->POI_HotelAddress;
|
|
|
|
|
$tmp['hotel_tel'] = $poi->POI_HotelPhone;
|
|
|
|
|
// 航班/车次
|
|
|
|
|
$tmp['flights_no'] = $poi->POI_FlightsNo;
|
|
|
|
|
$tmp['flights_airport'] = $poi->POI_AirPort;
|
|
|
|
|
|
|
|
|
|
$ret['package'][] = $tmp;
|
|
|
|
|
}
|
|
|
|
|
log_message('error',$order_project[0]->GCI_combineNo);
|
|
|
|
|
$operation = $this->Orders_model->get_operation($order_project[0]->GCI_combineNo);
|
|
|
|
|
// 司机, 导游
|
|
|
|
|
if ( ! empty($order_obj['operation_info'])) {
|
|
|
|
|
foreach ($order_obj['operation_info'] as $key => $value) {
|
|
|
|
|
$order_obj['operation_info'][$value->GCOD_operationType] = $value;
|
|
|
|
|
if ( ! empty($operation)) {
|
|
|
|
|
foreach ($operation as $key => $value) {
|
|
|
|
|
if ($value->GCOD_operationType === 'touristCarOperations') {
|
|
|
|
|
$tmp_car = array();
|
|
|
|
|
$tmp_car['car_type'] = $value->GCOD_subType;
|
|
|
|
|
$tmp_car['car_company'] = $value->GCOD_title;
|
|
|
|
|
$tmp_car['car_license'] = $value->GCOD_carLicense;
|
|
|
|
|
$tmp_car['driver_name'] = $value->GCOD_dutyName;
|
|
|
|
|
$tmp_car['driver_tel'] = $value->GCOD_dutyTel;
|
|
|
|
|
$tmp_car['driver_pic'] = $value->GCOD_dutyPhoto;
|
|
|
|
|
$tmp_car['car_remark'] = $value->GCOD_remark;
|
|
|
|
|
$tmp_car['using_startdate'] = $value->GCOD_startDate;
|
|
|
|
|
$tmp_car['using_enddate'] = $value->GCOD_endDate;
|
|
|
|
|
$ret['cardriver'][] = $tmp_car;
|
|
|
|
|
}
|
|
|
|
|
else if ($value->GCOD_operationType === 'guiderOperations') {
|
|
|
|
|
$tmp_g = array();
|
|
|
|
|
$tmp_g['guide_name'] = $value->GCOD_dutyName;
|
|
|
|
|
$tmp_g['guide_tel'] = $value->GCOD_dutyTel;
|
|
|
|
|
$tmp_g['guide_pic'] = $value->GCOD_dutyPhoto;
|
|
|
|
|
$tmp_g['guide_remark'] = $value->GCOD_remark;
|
|
|
|
|
$tmp_g['using_startdate'] = $value->GCOD_startDate;
|
|
|
|
|
$tmp_g['using_enddate'] = $value->GCOD_endDate;
|
|
|
|
|
$ret['tourguide'][] = $tmp_g;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$operator = $this->Orders_model->get_operator($order_project[0]->COLI_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));
|
|
|
|
|
}
|
|
|
|
|
unset($order_obj['operation_info'][0]);
|
|
|
|
|
unset($order_obj['operation_info'][1]);
|
|
|
|
|
}
|
|
|
|
|
// unset($order_obj['order_info']->COLD_MemoText);
|
|
|
|
|
unset($order_obj['order_info']->GUT_FirstName);
|
|
|
|
|
unset($order_obj['order_info']->GUT_LastName);
|
|
|
|
|
return $this->output->set_content_type('application/json')->set_output(json_encode($order_obj));
|
|
|
|
|
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|