select(['pfg_house.id','pfg_house.price']) ->where(['pfg_pushm_mansion.del'=>1]) ->leftJoin('pfg_house','pfg_house.id = pfg_pushm_mansion.hid') ->groupBy('pfg_house.price') ->asArray()->all(); //区域 $son_city = PushmMansion::find()->select(['pfg_category_city.pid']) ->where(['pfg_pushm_mansion.del'=>1]) ->leftJoin('pfg_house','pfg_house.id = pfg_pushm_mansion.hid') ->leftJoin('pfg_category_city','pfg_category_city.id= pfg_house.city') ->groupBy('pfg_category_city.id') ->asArray()->all(); //父类区域 $city = CategoryCity::find()->select(['id','city_name','pinyin'])->andWhere(['pid'=>0,'del'=>1])->andWhere(['IN','id',array_column($son_city,'pid')])->asArray()->all(); //户型 $house = PushmMansion::find()->select(['pfg_house.id']) ->where(['pfg_pushm_mansion.del'=>1]) ->leftJoin('pfg_house','pfg_house.id = pfg_pushm_mansion.hid') ->asArray()->all(); $house_type = HouseType::find()->select(['pfg_house_type.type_id'])->where(['IN','hid',array_column($house,'id')])->groupBy('type_id')->asArray()->all(); $type = CategoryHousetype::find()->select(['id','huxing_name'])->where(['IN','id',array_column($house_type,'type_id')])->asArray()->all(); return $this->render('villalist',['price'=>$price,'city'=>$city,'type'=>$type]); } //区域子城市 public function actionSoncity() { $CityModel = new \common\models\CategoryCity(); $r = $CityModel->GetHaoSon(Yii::$app->request->post('pid')); return Help::JsonCode(Help::SUCCESS,'成功',$r); } }