/** * 获取定位城市列表. * * @access public * @return mixed $innerCall 为 TRUE 有返回值. */ public function getPositionList() { $countryId = (int) I('post.countryId', ''); if ($countryId < 1) { $this->setAjaxData(Message::PARAM_ERROR, Message::get(Message::PARAM_ERROR))->myAjaxReturn(); } $model = new CityModel(); $hotCitys = $model->fetchHotList($countryId); $cityLists = $model->formatList($model->fetchListByCountry($countryId)); $data = ['hotCitys' => $hotCitys, 'cityList' => $cityLists]; $this->setAjaxData(Message::SUCCESS, Message::get(Message::SUCCESS), $data)->myAjaxReturn(); }
/** * 获取定位国家列表. * * @access public * @return void */ public function getPositionList() { // 默认国家 id. $defaultCountryId = C('select_city_default_country'); $model = new CountryModel(); // 定位国家列表. $lists = $model->fetchPositionList(); $modelCity = new CityModel(); // 热门城市列表. $hotCitys = $modelCity->fetchHotList($defaultCountryId); // 城市列表. $cityLists = $modelCity->formatList($modelCity->fetchListByCountry($defaultCountryId)); $data = ['defaultCountry' => $defaultCountryId, 'countryList' => $lists, 'hotCitys' => $hotCitys, 'cityList' => $cityLists]; $this->setAjaxData(Message::SUCCESS, Message::get(Message::SUCCESS), $data)->myAjaxReturn(); }