PublicController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/4/26
  6. * Time: 上午11:13
  7. */
  8. namespace frontend\controllers;
  9. use frontend\base\CommonController;
  10. use Yii;
  11. use mobile\base\Help;
  12. class PublicController extends CommonController
  13. {
  14. public $enableCsrfValidation = false;
  15. public function actionIndex()
  16. {
  17. return $this->render('index');
  18. }
  19. public function actionReduced()
  20. {
  21. return $this->renderPartial('reduced');
  22. }
  23. public function actionApplekf()
  24. {
  25. return $this->renderPartial('applekf');
  26. }
  27. // 帮我找房
  28. public function actionFindroom()
  29. {
  30. $model = new \common\models\CategoryCity();
  31. $model->pid = 68;
  32. $city = $model->getList([], ['id', 'city_name']);
  33. $province = $this->province();
  34. $type = $this->type();
  35. $price = $this->price();
  36. return $this->renderPartial('findroom', ['province' => $province, 'type' => $type, 'price' => $price, 'city' => $city]);
  37. }
  38. public function actionError()
  39. {
  40. return $this->renderPartial('error');
  41. }
  42. // public function actions()
  43. // {
  44. // return [
  45. // 'error' => [
  46. // 'class' => 'yii\web\ErrorAction',
  47. // ],
  48. // ];
  49. // }
  50. /*户型*/
  51. public function type()
  52. {
  53. $TypeModel = new \common\models\CategoryHousetype();
  54. $TypeModel->state = 1;
  55. $type = $TypeModel->getList([], ['id', 'huxing_name']);
  56. return $type;
  57. }
  58. /*价格*/
  59. public function price()
  60. {
  61. $priceModel = new \common\models\HousesPrice();
  62. $priceModel->state = 1;
  63. $price = $priceModel->getList([], ['price_short', 'id', 'price']);
  64. return $price;
  65. }
  66. /*省份*/
  67. public function province()
  68. {
  69. $city = new \common\models\CategoryCity();
  70. $input = Yii::$app->request->post();
  71. if (!isset($input['pid'])) {
  72. $city->pid = 0;
  73. } else {
  74. $city->pid = $input['city'];
  75. }
  76. $city->state = 1;
  77. $province = $city->getList([]);
  78. return $province;
  79. }
  80. /*传入父id获取城市*/
  81. public function actionGetcity()
  82. {
  83. $model = new \common\models\CategoryCity();
  84. $input = Yii::$app->request->post();
  85. $model->pid = $input['id'];
  86. $rows = $model->getList([], ['id', 'city_name']);
  87. if (!empty($rows)) return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
  88. }
  89. public function actionShowhouse()
  90. {
  91. Yii::$app->response->statusCode = 404;
  92. $m = new \common\models\House();
  93. $m->is_push = 2;
  94. $data = $m->HomegetList(4);
  95. return $this->render('@app/views/house/xiajia', ['model' => $data]);
  96. }
  97. // 悬挂弹窗
  98. public function actionSuspend()
  99. {
  100. return $this->renderPartial('suspend');
  101. }
  102. }