PublicController.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/4/19
  6. * Time: 下午2:52
  7. */
  8. namespace mobile\controllers;
  9. use common\models\CategoryCity;
  10. use mobile\base\CommonController;
  11. use Yii;
  12. use mobile\base\Help;
  13. class PublicController extends CommonController
  14. {
  15. public $enableCsrfValidation = false;
  16. /*
  17. * 报名弹窗
  18. * */
  19. public function actionSignup()
  20. {
  21. return $this->renderPartial('signup');
  22. }
  23. /*
  24. * 内页顶部导航
  25. * */
  26. public function actionNav()
  27. {
  28. return $this->renderPartial('nav');
  29. }
  30. /*
  31. * 内页顶部导航 侧边栏
  32. * */
  33. public function actionNavsidebar()
  34. {
  35. return $this->renderPartial('navsidebar');
  36. }
  37. /*
  38. * 报名弹窗
  39. * */
  40. public function actionCustomization()
  41. {
  42. $arr['price'] = ['不限', 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000];
  43. $typeModel = new \common\models\CategoryHousetype();
  44. $typeModel->state = 1;
  45. $arr['type'] = $typeModel->getList([], ['id', 'huxing_name']);
  46. $city = new \common\models\CategoryCity();
  47. $city->pid = 0;
  48. $arr['province'] = $city->getList([], ['id', 'city_name']);
  49. // p($arr);1111
  50. // exit;
  51. return $this->renderPartial('customization', $arr);
  52. }
  53. // 楼盘 预售许可证
  54. public function actionLicence()
  55. {
  56. return $this->renderPartial('licence');
  57. }
  58. /*独立的报名窗口*/
  59. public function actionApplicationwindow()
  60. {
  61. $model = new \common\models\CategoryCity();
  62. $model->pid = 68;
  63. $city = $model->getList([], ['id', 'city_name']);
  64. $province = $this->province();
  65. $type = $this->type();
  66. $price = $this->price();
  67. return $this->renderPartial('applicationwindow', ['province' => $province, 'type' => $type, 'price' => $price, 'city' => $city]);
  68. }
  69. public function actionTypes()
  70. {
  71. $rows = $this->type();
  72. if ($rows) {
  73. return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
  74. }
  75. return Help::JsonCode(Help::ERROR, Yii::t('app', 'get_error'));
  76. }
  77. public function actionSaleprice()
  78. {
  79. $rows = $this->price();
  80. if ($rows) {
  81. return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
  82. }
  83. return Help::JsonCode(Help::ERROR, Yii::t('app', 'get_error'));
  84. }
  85. /*
  86. * 公共报名-专业找房 2019-1-15
  87. */
  88. public function actionMajorlookhouse()
  89. {
  90. return $this->renderPartial('majorlookhouse');
  91. }
  92. /*户型*/
  93. public function type()
  94. {
  95. $TypeModel = new \common\models\CategoryHousetype();
  96. $TypeModel->state = 1;
  97. $type = $TypeModel->getList([], ['id', 'huxing_name']);
  98. return $type;
  99. }
  100. /*价格*/
  101. public function price()
  102. {
  103. $priceModel = new \common\models\HousesPrice();
  104. $priceModel->state = 1;
  105. $price = $priceModel->getList([], ['id', 'price']);
  106. return $price;
  107. }
  108. /*省份*/
  109. public function province()
  110. {
  111. $city = new \common\models\CategoryCity();
  112. $input = Yii::$app->request->post();
  113. if (!isset($input['pid'])) {
  114. $city->pid = 0;
  115. } else {
  116. $city->pid = $input['city'];
  117. }
  118. $city->state = 1;
  119. $province = $city->getList([]);
  120. return $province;
  121. }
  122. /*传入父id获取城市*/
  123. public function actionGetcity()
  124. {
  125. $model = new \common\models\CategoryCity();
  126. $input = Yii::$app->request->post();
  127. $model->pid = $input['id'];
  128. $rows = $model->getList([], ['id', 'city_name']);
  129. if (!empty($rows)) return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
  130. }
  131. /*
  132. * 帮我找房
  133. * */
  134. public function actionFindroom()
  135. {
  136. //户型
  137. $TypeModel = new \common\models\CategoryHousetype();
  138. $Type = $TypeModel->getList([], ['id', 'huxing_name']);
  139. //区域
  140. $City = (new CategoryCity())->GetUpCity();
  141. return $this->render('findroom', ['type' => $Type, 'city' => $City]);
  142. }
  143. /*
  144. * 404页面
  145. * */
  146. public function actionError()
  147. {
  148. return $this->renderPartial('error');
  149. }
  150. /*
  151. * 楼盘项目不存在显示的页面
  152. */
  153. public function actionShowhouse()
  154. {
  155. Yii::$app->response->statusCode = 404;
  156. $m = new \common\models\House();
  157. $data = $m->HomegetList(5);
  158. foreach ($data as &$val) {
  159. $val['thumb'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['houses'] . $val['thumb'] . '/' . 'same';
  160. if (!empty($val['characteristic'])) {
  161. $val['characteristic'] = \common\fm\HouseHandle::ChangeCharacteristic($val['characteristic']);
  162. }
  163. $val['tel'] = \common\fm\HouseHandle::ChangeCityTel($val['city']);
  164. }
  165. $start_time = date('Y/m') . '/01-' . date('Y/m', strtotime('+ 2 month')) . '/01'; //有效日期
  166. return $this->render('@app/views/house/xiajia.php', ['model' => $data, 'start_time' => $start_time]);
  167. }
  168. }