render('index'); } public function actionList() { $cookie = Yii::$app->request->cookies; $latitude = ""; $longitude = ""; if($cookie->has('localtion')) { $lcookie = $cookie->getValue('localtion'); $latitude=$lcookie['lat']; $longitude=$lcookie['lng']; } $search = Yii::$app->request->get('search'); $datas = Building::find()->where(['posted'=>Building::POSTED_YES]); $datas = $datas->andWhere('name like :search or address like :search or layout like :search or stage like :search or pattern like :search or style like :search ',[':search'=>'%'.$search.'%']); $arrs = $datas->orderBy('created_at DESC')->all(); $geohash = new ZM_Geohash(); foreach ($arrs as $list) { if(!empty($latitude)&&!empty($longitude)&&!empty($list->latitude)&&!empty($list->longitude)) { $distance = $geohash->getDistance($latitude,$longitude,$list->latitude,$list->longitude); $list->distance = $distance; } } return $this->render('list',['arrs'=>$arrs]); } // 搜索条件 public static function hotsearch(){ $datas = HotSearch::find()->where(['status'=>HotSearch::HOT_SEARCH_COMMON])->all(); return $datas; } //弹窗提示 function admin_alert($alert,$href=''){ if(empty($href)){ exit(""); }else{ exit(""); } } }