PublicController.php 6.3 KB

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