1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace mobile\controllers;
- use common\models\CategoryCity;
- use common\models\CategoryHousetype;
- use common\models\HousesPrice;
- use common\models\HouseType;
- use common\models\PushmMansion;
- use mobile\base\CommonController;
- use mobile\base\Help;
- use Yii;
- class VillaController extends CommonController
- {
- public $enableCsrfValidation = false;
-
- public function actionVillalist()
- {
-
-
- $price = PushmMansion::find()->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);
- }
- }
|