123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/4/19
- * Time: 下午2:52
- */
- namespace mobile\controllers;
- use common\models\CategoryCity;
- use common\models\House;
- use mobile\base\CommonController;
- use mobile\server\HouseServer;
- use Yii;
- use mobile\base\Help;
- class PublicController extends CommonController
- {
- public $enableCsrfValidation = false;
- /*
- * 报名弹窗
- * */
- public function actionSignup()
- {
- return $this->renderPartial('signup');
- }
- /*
- * 内页顶部导航
- * */
- public function actionNav()
- {
- return $this->renderPartial('nav');
- }
- /*
- * 内页顶部导航 侧边栏
- * */
- public function actionNavsidebar()
- {
- return $this->renderPartial('navsidebar');
- }
- /*
- * 报名弹窗
- * */
- public function actionCustomization()
- {
- $arr['price'] = ['不限', 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000];
- $typeModel = new \common\models\CategoryHousetype();
- $typeModel->state = 1;
- $arr['type'] = $typeModel->getList([], ['id', 'huxing_name']);
- $city = new \common\models\CategoryCity();
- $city->pid = 0;
- $city->abroad = 1;
- $arr['province'] = $city->getList([], ['id', 'city_name']);
-
- // p($arr);1111
- // exit;
- return $this->renderPartial('customization', $arr);
- }
- // 楼盘 预售许可证
- public function actionLicence()
- {
- return $this->renderPartial('licence');
- }
- /*独立的报名窗口*/
- public function actionApplicationwindow()
- {
- $model = new \common\models\CategoryCity();
- $model->pid = 68;
- $city = $model->getList([], ['id', 'city_name']);
- $province = $this->province();
- $type = $this->type();
- $price = $this->price();
- return $this->renderPartial('applicationwindow', ['province' => $province, 'type' => $type, 'price' => $price, 'city' => $city]);
- }
- public function actionTypes()
- {
- $rows = $this->type();
- if ($rows) {
- return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
- }
- return Help::JsonCode(Help::ERROR, Yii::t('app', 'get_error'));
- }
- public function actionSaleprice()
- {
- $rows = $this->price();
- if ($rows) {
- return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
- }
- return Help::JsonCode(Help::ERROR, Yii::t('app', 'get_error'));
- }
- /*
- * 公共报名-专业找房 2019-1-15
- */
- public function actionMajorlookhouse()
- {
- return $this->renderPartial('majorlookhouse');
- }
- /*户型*/
- public function type()
- {
- $TypeModel = new \common\models\CategoryHousetype();
- $TypeModel->state = 1;
- $type = $TypeModel->getList([], ['id', 'huxing_name']);
- return $type;
- }
- /*价格*/
- public function price()
- {
- $priceModel = new \common\models\HousesPrice();
- $priceModel->state = 1;
- $price = $priceModel->getList([], ['id', 'price']);
- return $price;
- }
- /*省份*/
- public function province()
- {
- $city = new \common\models\CategoryCity();
- $input = Yii::$app->request->post();
- if (!isset($input['pid'])) {
- $city->pid = 0;
- } else {
- $city->pid = $input['city'];
- }
- $city->state = 1;
- $province = $city->getList([]);
- return $province;
- }
- /*传入父id获取城市*/
- public function actionGetcity()
- {
- $model = new \common\models\CategoryCity();
- $input = Yii::$app->request->post();
- $model->pid = $input['id'];
- $rows = $model->getList([], ['id', 'city_name']);
- if (!empty($rows)) return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
- }
- /*
- * 帮我找房
- * */
- public function actionFindroom()
- {
- //户型
- $TypeModel = new \common\models\CategoryHousetype();
- $Type = $TypeModel->getList([], ['id', 'huxing_name']);
- //区域
- $City = (new CategoryCity())->GetUpCity();
- return $this->render('findroom', ['type' => $Type, 'city' => $City]);
- }
- /*
- * 404页面
- * */
- public function actionError()
- {
- return $this->renderPartial('error');
- }
- /*
- * 楼盘项目不存在显示的页面
- */
- public function actionShowhouse()
- {
- Yii::$app->response->statusCode = 404;
- $m = new \common\models\House();
- $data = $m->HomegetList(5);
- foreach ($data as &$val) {
- $val['thumb'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['houses'] . $val['thumb'] . '/' . 'same';
- if (!empty($val['characteristic'])) {
- $val['characteristic'] = \common\fm\HouseHandle::ChangeCharacteristic($val['characteristic']);
- }
- $val['tel'] = \common\fm\HouseHandle::ChangeCityTel($val['city']);
- }
- $start_time = date('Y/m') . '/01-' . date('Y/m', strtotime('+ 2 month')) . '/01'; //有效日期
- return $this->render('@app/views/house/xiajia.php', ['model' => $data, 'start_time' => $start_time]);
- }
-
- /**
- * @return string
- */
- public function actionFiltrate()
- {
- $city = new CategoryCity();
- $city->abroad = 1;
- $rowsCity = $city->TypeAbroad(['id', 'city_name', 'a', 'pid']);
- if ($rowsCity) {
- $rowsCity = getTree($rowsCity, 0);
- }
- return $this->renderPartial('filtrate', [
- 'city' => $rowsCity,
- 'name' => Yii::$app->request->get('name')
- ]);
- }
-
- /**
- * 搜索弹窗
- * @return string
- */
- public function actionSearchalertwindow()
- {
- $city = CategoryCity::find()->andWhere(['del' => 1,'state'=>1,'abroad'=>1])->select(['id'])->column();
- $model = new HouseServer();
- $query = House::find();
- $query->andWhere(['is_push' => 2]);
- $query->andWhere(['pfg_house.city' => $city]);
- $query->andWhere(['del' => 1]);
- $query->andWhere(['is_view' => 1]);
- $query->select(['id', 'name']);
- // $query->orderBy('RAND()');
- $query->orderBy(['pfg_house.sort'=>SORT_DESC]);
- $shaixuan = $query->limit(9)->asArray()->all();
- $price = $model->PriceList();
- return $this->renderPartial('searchalertwindow', [
- 'shaixuan' => $shaixuan,
- 'price' => $price
- ]);
- }
- }
|