예제 #1
0
 /**
  * @desc 根据城市ID字符串,得到城市,国家 ,大洲信息
  * @param string $cityIdStr [可选] 城市ID串  以逗号分隔 如:“1,2,3”
  * @return array 返回城市,国家,大洲的 ID和名称
  */
 public static function getAreaByCityid($cityIdStr = "")
 {
     $area = array();
     $cityArr = explode(',', $cityIdStr);
     if (count($cityArr) > 0) {
         $criteria = new CDbCriteria();
         $criteria->addInCondition('ID', $cityArr);
         $city_models = City::model()->findAll($criteria);
         //得到所有大洲到数据
         $continentArray = AreaManage::getContinentAll();
         if (!empty($continentArray)) {
             foreach ($city_models as $v) {
                 $area[$v['ID']]['cityId'] = $v['ID'];
                 $area[$v['ID']]['cityNameCn'] = $v['NameCn'];
                 $area[$v['ID']]['CountryId'] = $v['country']['ID'];
                 $area[$v['ID']]['CountryNameCn'] = $v['country']['NameCn'];
                 $area[$v['ID']]['ContinentId'] = $v['country']['ContinentID'];
                 $area[$v['ID']]['ContinentNameCn'] = $continentArray[$v['country']['ContinentID']];
             }
         }
     }
     return $area;
 }
 public function actionRceomResult()
 {
     $param = Yii::app()->request->getParam('recom');
     $attractions = array();
     $str_areaInfo = '';
     if (isset($param['lat']) && !empty($param['lat']) && isset($param['lng']) && !empty($param['lng']) && isset($param['days']) && !empty($param['days']) && isset($param['day_ave']) && !empty($param['day_ave'])) {
         $lat = $param['lat'];
         $lng = $param['lng'];
         $days = $param['days'];
         $day_ave = $param['day_ave'];
         $city_id = $param['city_id'];
         $attraction_sql = "select * from ( select `ID`, `NameCn`, `NameEn`, `NameCnShort`, `NamePin`, `NamePinShort`, `ContinentID`, `CountryID`, `CityID`, `Theme`, `ViewSpotLevel`, `Tel`, `Fax`, `Website`, `Zipcode`, `Address`, `Station`, `TrafficType`, `TicketPrice`, `BusinessHours`, `BusinessMonths`, `MoneyType`, `TravelTime`, `Lng`, `Lat`, `Hot`, `ParkService`, `Des`, `Note`, `SightCharacteristic`, `UID`, `CreateTime`, `UpdateTime`, `Status`, `Valid`,lat_long_distance(" . $lat . ", " . $lng . ", p.Lat, p.Lng) as distance from view_spot as p) as d where d.distance>0 and d.distance <5000 order by distance asc";
         $attractions = ViewSpot::model()->findAllBySql($attraction_sql);
         $attractions = array_slice($attractions, 0, $days * $day_ave);
         $attractions = array_chunk($attractions, $day_ave, false);
         if (!empty($city_id) && isset($city_id)) {
             $arr_areaInfo = AreaManage::getAreaByCityid($city_id);
             if (!empty($arr_areaInfo[$city_id])) {
                 $str_areaInfo = $arr_areaInfo[$city_id]['ContinentNameCn'] . '--' . $arr_areaInfo[$city_id]['CountryNameCn'] . '--' . $arr_areaInfo[$city_id]['cityNameCn'];
             }
         }
     }
     $this->renderPartial('recomResult', array('recomViewSpot' => $attractions, 'str_areaInfo' => $str_areaInfo));
 }
예제 #3
0
 /**
  * 管理图片
  */
 public function ActionAdminPicture()
 {
     //搜索条件处理 [E]
     $searchType = Yii::app()->request->getParam('searchType');
     if ($searchType === 'page') {
         //判断是分页提交还是搜索列表提交的查询条件
         $search = Yii::app()->request->getParam('search');
         $search = unserialize(base64_decode($search));
         //对分布传来的数据进行还原
     } else {
         $search = Yii::app()->request->getParam('search');
     }
     $search_continentid = '';
     //搜索的大洲ID
     $search_countryid = '';
     //搜索的国家ID
     $search_cityids = '';
     //要搜索的所有城市id
     $search_picture_category_id = '';
     //要搜索的图片类型
     $search_pic_name = '';
     //要搜索的图片名称或标题
     $continent = array();
     $country = array();
     $city = array();
     //得到国家名下对应的所有城市ID信息字符串
     if (isset($search) && !empty($search['continent'])) {
         //大洲
         $search_continentid = intval($search['continent']);
         if ($search['country']) {
             //大洲+国家
             $search_countryid = intval($search['country']);
             if (empty($search['city'])) {
                 //大洲+国家+城市
                 $search_cityids = AreaManage::getCityIdStrByCountryId($search_countryid);
             } else {
                 //大洲+国家
                 $search_cityids = intval($search['city']);
             }
         } else {
             //只选择大洲
             $search_countryid = AreaManage::getCountryStrByContinentId($search_continentid);
             if (empty($search['city'])) {
                 $search_cityids = AreaManage::getCityIdStrByCountryId($search_countryid);
             } else {
                 $search_cityids = trim($search['city']);
             }
         }
     }
     //得到图片类型
     if (is_numeric(trim($search['picture_category_id']))) {
         $search_picture_category_id = trim($search['picture_category_id']);
     }
     //图片标题
     if (trim($search['pic_name'])) {
         $search_pic_name = trim($search['pic_name']);
     }
     //所有图片类型
     $picture_category = PictureCategory::model()->findAll();
     $picture_category_list = array();
     if (!empty($picture_category)) {
         foreach ($picture_category as $v) {
             $picture_category_list[$v['ID']] = $v;
         }
     }
     $continent = Continent::model()->findAll();
     //获取所有的大洲信息
     if (!empty($search_continentid)) {
         //返回搜索大洲的下级国家信息
         $country = AreaManage::getCountryByContinentId($search_continentid);
     }
     if (!empty($search_countryid)) {
         //返回搜索国家的下级城市信息
         $city = AreaManage::getCityByCountryId($search_countryid);
     }
     $picture_category = PictureCategory::model()->findAllByAttributes(array('ParentId' => 0));
     // 图片二级类别列表
     if (!empty($search['picture_parent_id'])) {
         // 如果选择了一级图片类别则根据一级类别ID 查询二级类别
         $picture_children_category = PictureCategory::model()->findAllByAttributes(array('ParentId' => $search['picture_parent_id']));
     } else {
         $picture_children_category = array();
     }
     //搜索条件处理 [E]
     $criteria = new CDbCriteria();
     $criteria->order = 'ID DESC';
     // 增加搜索条件 [S]
     $cityIdArr = !empty($search_cityids) ? explode(',', $search_cityids) : array();
     $criteria->compare('Valid', '0');
     //对打上删除标记的数据进行过滤
     if (count($cityIdArr) > 0) {
         $criteria->addInCondition('CityId', $cityIdArr);
     }
     if (!empty($search_picture_category_id)) {
         $criteria->compare('CategoryId', $search_picture_category_id);
     }
     if (!empty($search_pic_name)) {
         //$criteria->compare('Title',$search_pic_name,true);
         $criteria->addSearchCondition('Title', $search_pic_name);
     }
     //增加搜索条件 [E]
     $count = Picture::model()->count($criteria);
     $pager = new CPagination($count);
     if (!empty($search)) {
         //判断是否存在搜索条件,并对搜索条件进行数据处理(便于url传输)
         $pager->params = array('search' => base64_encode(serialize($search)), 'searchType' => 'page');
     }
     $pager->pageSize = 20;
     $pager->applyLimit($criteria);
     $picture_list = Picture::model()->findAll($criteria);
     $picIdStr = '';
     //图片ID字符串
     $cityIDStr = '';
     //城市ID字符串
     if (!empty($picture_list)) {
         foreach ($picture_list as $val) {
             $picIdStr .= $val['ID'] . ',';
             $cityIDStr .= $val['CityId'] . ',';
         }
     }
     //得到图片地址信息列表
     $picture_source = PictureSourceManage::getPicSourceArrByPicIdStr($picIdStr);
     //得到每张图片所在的名称:(城市-国家-大洲)
     $area = AreaManage::getAreaByCityid($cityIDStr);
     $this->render('list_picture', array('picture_list' => $picture_list, 'picture_category_list' => $picture_category_list, 'picture_source' => $picture_source, 'pages' => $pager, 'area' => $area, 'continent' => $continent, 'picture_category' => $picture_category, 'picture_children_category' => $picture_children_category, 'search' => $search, 'country' => $country, 'city' => $city));
 }
예제 #4
0
 /**
  * 查看酒店
  */
 public function ActionViewHotel()
 {
     $hotel_id = trim(Yii::app()->request->getParam('hotel_id'));
     // 获取酒店ID
     if (!empty($hotel_id) && intval($hotel_id) > 0) {
         $hotel_data = Hotel::model()->findByPk($hotel_id);
         // 根据酒店ID 获取酒店信息
         $area = AreaManage::getAreaByCityid($hotel_data['CityId']);
         // 根据酒店所在城市ID 获取酒店所在的的 大洲/国家/城市
         // 获取酒店图
         $hotel_picture = HotelPicture::model()->findAllByAttributes(array('Hotel_Id' => $hotel_data->Id, 'SizeType' => '2'));
         // 跳转至查看页
         $this->render('view_hotel', array('hotel_data' => $hotel_data, 'area' => $area, 'hotel_picture' => $hotel_picture));
     } else {
         Yii::app()->user->setFlash('message', '参数错误');
         $this->redirect(Yii::app()->createUrl('Hotel/HotelList'));
     }
 }
 /**
  * 查看购物中心
  * @param $shopping_mall_id 购物中心ID
  */
 public function ActionViewShoppingMall($shopping_mall_id)
 {
     $shopping_mall_model = ShoppingMall::model();
     $shopping_mall_info = $shopping_mall_model->findByPk($shopping_mall_id);
     // 获取全部品牌
     $brand_criteria = new CDbCriteria();
     $brand_criteria->select = array('Id', 'BrandName');
     $brand = IconvEncode::ObjArrChangeArray(Brand::model()->findAll($brand_criteria), 'BrandName');
     // 获取全部餐厅
     $restaurant_criteria = new CDbCriteria();
     $restaurant_criteria->select = array('Id', 'RestaurantName');
     $restaurant = IconvEncode::ObjArrChangeArray(Restaurant::model()->findAll($restaurant_criteria), 'RestaurantName');
     // 获取全部优惠卡/券
     $discount_criteria = new CDbCriteria();
     $discount_criteria->select = array('Id', 'DiscountCardName');
     $discount_card = IconvEncode::ObjArrChangeArray(DiscountCard::model()->findAll($discount_criteria), 'DiscountCardName');
     // 获取购物中心所在的的 大洲/国家/城市
     $area = AreaManage::getAreaByCityid($shopping_mall_info['CityId']);
     $this->renderPartial('view_shopping_mall', array('shopping_mall_info' => $shopping_mall_info, 'brand' => $brand, 'restaurant' => $restaurant, 'discount_card' => $discount_card, 'area' => $area));
 }
예제 #6
0
 /**
  * 景点详细相看
  */
 public function actionViewViewSpot()
 {
     $ViewSpot_Id = Yii::app()->request->getParam('view_id');
     $ViewSpot_Id = intval($ViewSpot_Id);
     if (!empty($ViewSpot_Id)) {
         $view_spot_model = ViewSpot::model()->findByPk($ViewSpot_Id);
         if (!empty($view_spot_model)) {
             $area = AreaManage::getAreaByCityid($view_spot_model['CityID']);
             $view_spot_model->Theme = strlen($view_spot_model->Theme) > 0 ? explode(',', $view_spot_model->Theme) : array();
             //得到景点图片
             $viewSpotSource_models = ViewSpotSource::model()->findAllByAttributes(array('VS_Id' => $view_spot_model->ID, 'SizeType' => '2'));
             //得到编辑人[s]
             $account_name = '';
             if (!empty($view_spot_model->UID)) {
                 $account_model = Account::model()->findByPk($view_spot_model->UID);
                 $account_name = empty($account_model) ? $view_spot_model->UID : $account_model->UserName;
             }
             //得到编辑人[E]
             $this->render('view_view_spot', array('view_spot_model' => $view_spot_model, 'area' => $area, 'account_name' => $account_name, 'viewSpotSource_models' => $viewSpotSource_models));
         }
     }
 }