修改客人查询订单接口, 增加支持订单下预定了多个项目. 未完成

feature/pay
lyt 8 years ago
parent f2f903fb99
commit 27bee3fa08

@ -256,7 +256,7 @@ class TulanduoApi extends CI_Controller
} else {
// $startDate = ('2018-04-21');
// $endDate = ('2018-04-22'); // test
$startDate = date('Y-m-d');
$startDate = date('Y-m-d', strtotime("-3 days"));
$endDate = date('Y-m-d', strtotime("+7 days"));
$to_update_list = $this->Orders_model->get_groupCombineInfo(0, $startDate, $endDate);
}

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

@ -1237,15 +1237,15 @@ class Orders_model extends CI_Model {
return $query;
}
function get_operation_detail_for_client($COLI_ID)
function get_package_order($COLI_ID)
{
$ret['order_info'] = NULL;
$order_info_sql = "SELECT TOP 1
$order_info_sql = "SELECT
GCI_SN,GCI_VendorOrderId,GCI_combineNo
,COLI_SN,COLI_ID,COLD_SN,COLI_GroupCode,COLI_OPI_ID
,COLD_ServiceSN,COLD_PersonNum,COLD_ChildNum,COLD_StartDate,cold.COLD_MemoText
,COLD_ServiceSN,COLD_PersonNum,COLD_ChildNum,COLD_StartDate,COLD_EndDate,cold.COLD_MemoText
,pag2.PAG2_Name
,poi.POI_Hotel,poi.POI_HotelAddress,poi.POI_HotelPhone
,poi.POI_AirPort,poi.POI_FlightsNo
,GUT_FirstName,GUT_LastName
FROM BIZ_ConfirmLineInfo coli
inner join GroupCombineInfo on COLI_GRI_SN=GCI_GRI_SN
@ -1257,23 +1257,37 @@ class Orders_model extends CI_Model {
OR COLI_ID like '%" . $this->HT->escape_like_str($COLI_ID) . "%'";
// 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) {
$ret['order_info'] = $order_info_query->row();
$operator_sql = "SELECT opi.OPI_SN,opi.OPI_Name,opi.OPI_FirstName,OPI_MoveTelephone,OPI_Email,opi2.OPI2_Name
from OperatorInfo opi
left join OperatorInfo2 opi2 on opi2.OPI2_OPI_SN=OPI_SN and opi2.OPI2_LGC=1
where OPI_SN=" . $ret['order_info']->COLI_OPI_ID;
$ret['operator_info'] = $this->HT->query($operator_sql)->row();
$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']->GCI_combineNo));
$ret['operation_info'] = $operation_info->result();
// $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;
}
function get_operator($OPI_SN)
{
$operator_sql = "SELECT opi.OPI_SN,opi.OPI_Name,opi.OPI_FirstName,OPI_MoveTelephone,OPI_Email,opi2.OPI2_Name
from OperatorInfo opi
left join OperatorInfo2 opi2 on opi2.OPI2_OPI_SN=OPI_SN and opi2.OPI2_LGC=1
where OPI_SN=" . $OPI_SN . " AND OPI_SN<>435";
return $this->HT->query($operator_sql)->row();
}
function get_operation($combineNo)
{
$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($combineNo));
return $operation_info->result();
}
function GetNationalityID($nationalityName) {
if (!$nationalityName) {
return 0;

Loading…
Cancel
Save