|
|
|
@ -366,4 +366,111 @@ class api extends CI_Controller
|
|
|
|
|
print_r(json_encode($cacheData));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询接口,单一Y仓全价
|
|
|
|
|
public function search_simple()
|
|
|
|
|
{
|
|
|
|
|
//http://202.103.68.104:61/info.php/apps/flightsystem/api/search/?departDate=2021-09-04&departCode=BJS&arriveCode=KWL //测试地址
|
|
|
|
|
$departDate = $this->input->get_post('departDate');
|
|
|
|
|
$departCode = $this->input->get_post('departCode');
|
|
|
|
|
$arriveCode = $this->input->get_post('arriveCode');
|
|
|
|
|
$flightnumber = $this->input->get_post('flightnumber');
|
|
|
|
|
|
|
|
|
|
if (empty($departDate) || empty($departCode) || empty($arriveCode)) {
|
|
|
|
|
exit('error');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$postJson = get_serach_json($departDate, $departCode, $arriveCode, $flightnumber);
|
|
|
|
|
//echo $postJson;die();
|
|
|
|
|
$returnJson = post_tuniu(TUNIU_FLIGHT_API, $postJson, 'POST');
|
|
|
|
|
$returnData = json_decode($returnJson);
|
|
|
|
|
//print_r($returnJson);die();
|
|
|
|
|
$cacheData = new stdClass();
|
|
|
|
|
if (!empty($returnData)) {
|
|
|
|
|
$cacheData->success = $returnData->success;
|
|
|
|
|
$cacheData->msg = $returnData->msg;
|
|
|
|
|
$cacheData->errorCode = $returnData->errorCode;
|
|
|
|
|
$cacheData->queryResultList = array();
|
|
|
|
|
$i = 0;
|
|
|
|
|
//$airPortCodeAndName = json_decode($redis->get('airPortCodeAndName'));
|
|
|
|
|
$airPortCodeAndName = $this->ajaxGetCodeAndName(true);
|
|
|
|
|
//print_r($airPortCodeAndName);die();
|
|
|
|
|
foreach ($returnData->data->queryResultList as $items) {
|
|
|
|
|
$cacheData->queryResultList[$i] = new stdClass();
|
|
|
|
|
$cacheData->queryResultList[$i]->flight = new stdClass();
|
|
|
|
|
|
|
|
|
|
//航班信息
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->flightNo = $items->flight->flightNo;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->craftType = $items->flight->craftType;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->airlineCompany = $items->flight->airlineCompany;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->airlineIataCode = $items->flight->airlineIataCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->arriveAirportCode = $items->flight->arriveAirportCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->arriveAirportName = $items->flight->arriveAirportName;
|
|
|
|
|
$arriveAirportCode = $items->flight->arriveAirportCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->arriveAirportNameEn = $this->flight_model->getAirPortNameEn($items->flight->arriveAirportCode); //$airPortCodeAndName->$arriveAirportCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->arriveAirportTerminal = $items->flight->arriveAirportTerminal;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->arriveCityIataCode = $items->flight->arriveCityIataCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->arriveCityName = $items->flight->arriveCityName;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->arriveDate = $items->flight->arriveDate;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->arriveTime = $items->flight->arriveTime;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->departAirportCode = $items->flight->departAirportCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->departAirportName = $items->flight->departAirportName;
|
|
|
|
|
$departAirportCode = $items->flight->departAirportCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->departAirportNameEn = $this->flight_model->getAirPortNameEn($items->flight->departAirportCode); //$airPortCodeAndName->$departAirportCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->departAirportTerminal = $items->flight->departAirportTerminal;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->departCityIataCode = $items->flight->departCityIataCode;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->departCityName = $items->flight->departCityName;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->departDate = $items->flight->departDate;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->departTime = $items->flight->departTime;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->duration = $items->flight->duration;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->meal = $items->flight->meal;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->stopInformation = $items->flight->stopInformation;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->stopNum = $items->flight->stopNum;
|
|
|
|
|
$cacheData->queryResultList[$i]->flight->stopPointList = $items->flight->stopPointList;
|
|
|
|
|
|
|
|
|
|
//航班对应可用的资源列表
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList = array();
|
|
|
|
|
$j = 0;
|
|
|
|
|
foreach ($items->resourceList as $resourceItems) {
|
|
|
|
|
|
|
|
|
|
//只读取全价
|
|
|
|
|
if ($resourceItems->price->adultFacePrice == $resourceItems->price->cabinClassFullPrice && $resourceItems->price->adultPrice == $resourceItems->price->cabinClassFullPrice){
|
|
|
|
|
//只显示经济舱
|
|
|
|
|
$isY = false;
|
|
|
|
|
foreach ($resourceItems->cabinList as $cabinListItems) {
|
|
|
|
|
if ($cabinListItems->cabinClass == "Y"){
|
|
|
|
|
$isY = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($isY){
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j] = new stdClass();
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->price = new stdClass();
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultPrice = $resourceItems->price->adultPrice;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->price->childPrice = $resourceItems->price->childPrice;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultFacePrice = $resourceItems->price->adultFacePrice;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->price->childFacePrice = $resourceItems->price->childFacePrice;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->price->cabinClassFullPrice = $resourceItems->price->cabinClassFullPrice;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->price->adultTax = $resourceItems->price->adultTax;
|
|
|
|
|
|
|
|
|
|
$k = 0;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k] = new stdClass();
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClass = $cabinListItems->cabinClass;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->cabinClassName = $cabinListItems->cabinClassName;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggage = $cabinListItems->freeLuggage;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->freeLuggageUnit = $cabinListItems->freeLuggageUnit;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->billType = $cabinListItems->billType;
|
|
|
|
|
$cacheData->queryResultList[$i]->resourceList[$j]->cabinList[$k]->seatStatus = $cabinListItems->seatStatus;
|
|
|
|
|
|
|
|
|
|
$j++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print_r(json_encode($cacheData));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|