PublicController.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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 common\models\House;
  11. use mobile\base\CommonController;
  12. use mobile\server\HouseServer;
  13. use Yii;
  14. use mobile\base\Help;
  15. class PublicController extends CommonController
  16. {
  17. public $enableCsrfValidation = false;
  18. /*
  19. * 报名弹窗
  20. * */
  21. public function actionSignup()
  22. {
  23. return $this->renderPartial('signup');
  24. }
  25. /*
  26. * 内页顶部导航
  27. * */
  28. public function actionNav()
  29. {
  30. return $this->renderPartial('nav');
  31. }
  32. /*
  33. * 内页顶部导航 侧边栏
  34. * */
  35. public function actionNavsidebar()
  36. {
  37. return $this->renderPartial('navsidebar');
  38. }
  39. /*
  40. * 报名弹窗
  41. * */
  42. public function actionCustomization()
  43. {
  44. $arr['price'] = ['不限', 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000];
  45. $typeModel = new \common\models\CategoryHousetype();
  46. $typeModel->state = 1;
  47. $arr['type'] = $typeModel->getList([], ['id', 'huxing_name']);
  48. $city = new \common\models\CategoryCity();
  49. $city->pid = 0;
  50. $arr['province'] = $city->getList([], ['id', 'city_name']);
  51. // p($arr);1111
  52. // exit;
  53. return $this->renderPartial('customization', $arr);
  54. }
  55. // 楼盘 预售许可证
  56. public function actionLicence()
  57. {
  58. return $this->renderPartial('licence');
  59. }
  60. /*独立的报名窗口*/
  61. public function actionApplicationwindow()
  62. {
  63. $model = new \common\models\CategoryCity();
  64. $model->pid = 68;
  65. $city = $model->getList([], ['id', 'city_name']);
  66. $province = $this->province();
  67. $type = $this->type();
  68. $price = $this->price();
  69. return $this->renderPartial('applicationwindow', ['province' => $province, 'type' => $type, 'price' => $price, 'city' => $city]);
  70. }
  71. public function actionTypes()
  72. {
  73. $rows = $this->type();
  74. if ($rows) {
  75. return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
  76. }
  77. return Help::JsonCode(Help::ERROR, Yii::t('app', 'get_error'));
  78. }
  79. public function actionSaleprice()
  80. {
  81. $rows = $this->price();
  82. if ($rows) {
  83. return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
  84. }
  85. return Help::JsonCode(Help::ERROR, Yii::t('app', 'get_error'));
  86. }
  87. /*
  88. * 公共报名-专业找房 2019-1-15
  89. */
  90. public function actionMajorlookhouse()
  91. {
  92. return $this->renderPartial('majorlookhouse');
  93. }
  94. /*户型*/
  95. public function type()
  96. {
  97. $TypeModel = new \common\models\CategoryHousetype();
  98. $TypeModel->state = 1;
  99. $type = $TypeModel->getList([], ['id', 'huxing_name']);
  100. return $type;
  101. }
  102. /*价格*/
  103. public function price()
  104. {
  105. $priceModel = new \common\models\HousesPrice();
  106. $priceModel->state = 1;
  107. $price = $priceModel->getList([], ['id', 'price']);
  108. return $price;
  109. }
  110. /*省份*/
  111. public function province()
  112. {
  113. $city = new \common\models\CategoryCity();
  114. $input = Yii::$app->request->post();
  115. if (!isset($input['pid'])) {
  116. $city->pid = 0;
  117. } else {
  118. $city->pid = $input['city'];
  119. }
  120. $city->state = 1;
  121. $province = $city->getList([]);
  122. return $province;
  123. }
  124. /*传入父id获取城市*/
  125. public function actionGetcity()
  126. {
  127. $model = new \common\models\CategoryCity();
  128. $input = Yii::$app->request->post();
  129. $model->pid = $input['id'];
  130. $rows = $model->getList([], ['id', 'city_name']);
  131. if (!empty($rows)) return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'get_success'), $rows);
  132. }
  133. /*
  134. * 帮我找房
  135. * */
  136. public function actionFindroom()
  137. {
  138. //户型
  139. $TypeModel = new \common\models\CategoryHousetype();
  140. $Type = $TypeModel->getList([], ['id', 'huxing_name']);
  141. //区域
  142. $City = (new CategoryCity())->GetUpCity();
  143. return $this->render('findroom', ['type' => $Type, 'city' => $City]);
  144. }
  145. /*
  146. * 404页面
  147. * */
  148. public function actionError()
  149. {
  150. return $this->renderPartial('error');
  151. }
  152. /*
  153. * 楼盘项目不存在显示的页面
  154. */
  155. public function actionShowhouse()
  156. {
  157. Yii::$app->response->statusCode = 404;
  158. $m = new \common\models\House();
  159. $data = $m->HomegetList(5);
  160. foreach ($data as &$val) {
  161. $val['thumb'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['houses'] . $val['thumb'] . '/' . 'same';
  162. if (!empty($val['characteristic'])) {
  163. $val['characteristic'] = \common\fm\HouseHandle::ChangeCharacteristic($val['characteristic']);
  164. }
  165. $val['tel'] = \common\fm\HouseHandle::ChangeCityTel($val['city']);
  166. }
  167. $start_time = date('Y/m') . '/01-' . date('Y/m', strtotime('+ 2 month')) . '/01'; //有效日期
  168. return $this->render('@app/views/house/xiajia.php', ['model' => $data, 'start_time' => $start_time]);
  169. }
  170. /**
  171. * @return string
  172. */
  173. public function actionFiltrate()
  174. {
  175. $city = new CategoryCity();
  176. $city->abroad = 1;
  177. $rowsCity = $city->TypeAbroad(['id', 'city_name', 'a', 'pid']);
  178. if ($rowsCity) {
  179. $rowsCity = getTree($rowsCity, 0);
  180. }
  181. return $this->renderPartial('filtrate', [
  182. 'city' => $rowsCity,
  183. 'name' => Yii::$app->request->get('name')
  184. ]);
  185. }
  186. /**
  187. * 搜索弹窗
  188. * @return string
  189. */
  190. public function actionSearchalertwindow()
  191. {
  192. $city = CategoryCity::find()->andWhere(['del' => 1])->select(['id'])->andWhere(['pid' => 68])->column();
  193. $model = new HouseServer();
  194. $query = House::find();
  195. $query->andWhere(['is_push' => 2]);
  196. $query->andWhere(['pfg_house.city' => $city]);
  197. $query->andWhere(['del' => 1]);
  198. $query->andWhere(['is_view' => 1]);
  199. $query->select(['id', 'name']);
  200. // $query->orderBy('RAND()');
  201. $query->orderBy(['pfg_house.sort'=>SORT_DESC]);
  202. $shaixuan = $query->limit(8)->asArray()->all();
  203. $price = $model->PriceList();
  204. return $this->renderPartial('searchalertwindow', [
  205. 'shaixuan' => $shaixuan,
  206. 'price' => $price
  207. ]);
  208. }
  209. }