load->helper('array'); $this->load->model('Orders_model'); mb_regex_encoding("UTF-8"); } public function index() { $this->operation_detail(); } 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; $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; // 领队名字 $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($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)); } } return $this->output->set_content_type('application/json')->set_output(json_encode($ret)); } } /* End of file api.php */ /* Location: ./third_party/trippestOrderSync/controllers/api.php */