<?php
/* @todo:用于获取基础数据
 * @author:gilbert
 * @date:2017-05-17
 */
class Default_BaseDataController extends Ec_Controller_DefaultAction
{

	public function preDispatch()
    {

    }

    /* @todo:获取机场三字码
     *
     */
    public function getAirportCodeAction() {
        $countryId = trim( $this->_request->getParam( 'countryId', '' ) );
        $countryCode = '';
        if( $countryId ) {
            $country = Service_Country::getByField( $countryId, 'country_id');
            if( $country ) {
                $countryCode = $country['country_code'];
            }
        }
        $fields = array( 'country_code', 'airport_destination','airport_name_en','airport_name_ch' );
        $obj = new Service_AirportCountryMap();
        $alias = $obj->getFieldsAlias( $fields );
        $condition = array(
            'country_code' => $countryCode
        );
        $airportCodes = Service_AirportCountryMap::getByCondition( $condition, $alias );
        die(json_encode( $airportCodes ) );
    }



}

    