HouseController.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/4/19
  6. * Time: 下午2:52
  7. */
  8. namespace frontend\controllers;
  9. use common\models\CategoryAdviser;
  10. use common\models\CategoryLabel;
  11. use common\models\Brand;
  12. use common\models\Characteristic;
  13. use common\models\House;
  14. use common\models\HouseComment;
  15. use common\models\HouseCommentLikes;
  16. use common\models\PushDiscount;
  17. use common\models\Sensitivewords;
  18. use frontend\base\CommonController;
  19. use common\models\Sendcoderecord;
  20. use frontend\server\IndexServer;
  21. use mobile\server\WordMatcher;
  22. use linslin\yii2\curl;
  23. use Yii;
  24. use yii\data\Pagination;
  25. use frontend\server\HouseServer;
  26. use frontend\base\Help;
  27. use yii\helpers\ArrayHelper;
  28. use yii\helpers\VarDumper;
  29. class HouseController extends CommonController
  30. {
  31. const LOCATIONCITYHOUSE = 'locationcityhouse';
  32. public function beforeAction($action)
  33. {
  34. if (in_array(Yii::$app->controller->action->id, ['home', 'type', 'details', 'album', 'houseremark', 'news'])) {
  35. $input = Yii::$app->request->get();
  36. if (!is_numeric($input['hid'])) {
  37. $input['hid'] = explode('-', Yii::$app->request->get('hid'))[1];
  38. }
  39. if (empty((new House())->HouseIsshow($input['hid']))) {
  40. return $this->redirect('/public/showhouse')->send();
  41. }
  42. }
  43. return parent::beforeAction($action); // TODO: Change the autogenerated stub
  44. }
  45. /*
  46. * 楼盘首页
  47. * */
  48. public function actionHome()
  49. {
  50. $this->on(self::LOCATIONCITYHOUSE, [new \common\fm\HouseHandle(), 'CityLocation']);
  51. $this->trigger(self::LOCATIONCITYHOUSE);
  52. $module = Yii::$app->controller->module->id;
  53. $model = new HouseServer();
  54. $rows = $model->Details();
  55. $adviser = (new CategoryAdviser())->GetAdviser();
  56. if(!empty($rows['house'])){
  57. Yii::$app->view->params['TargetCrumbs'] = ['url'=>'','title'=>'>'.$rows['house']['name']];
  58. }
  59. //指定楼盘使用指定该53客服
  60. if ( !empty($rows['house']['type']) && in_array(12, json_decode($rows['house']['type'], true))) {
  61. Yii::$app->hostserver->zhiding_shangwu = true;
  62. Yii::$app->hostserver->shangwu = '<script>(function() {var _53code = document.createElement("script");_53code.src = "https://www111.53kf.com/code/code/9e0fdd15a7ccf645325b36076f1273231/4";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(_53code, s);})();</script>';
  63. }
  64. return $this->render($this->action->id, [
  65. 'model' => $rows,
  66. 'module'=> $module,
  67. 'adviser' => $adviser,
  68. ]);
  69. }
  70. /*
  71. * 楼盘列表
  72. * */
  73. public function actionSearch()
  74. {
  75. $renderData = [];
  76. $meta = []; //SEO 关键字
  77. $CityModel = new \common\models\CategoryCity();
  78. $CityModel->abroad = 1;
  79. $input = Yii::$app->request->get();
  80. $meta['province'] = '海南省';
  81. if (Yii::$app->hostserver->hostId == 0) {
  82. $CityModel->pid = 0;
  83. $CityModel->state = 1;
  84. $CityModel->abroad = 1;
  85. $renderData['city'] = $CityModel->getList([], ['city_name', 'id', 'pinyin']);
  86. // dump($input);die;
  87. //处理区域 父类
  88. if (!empty($input['city'])) {
  89. $pro = $CityModel->FindById($input['city']);
  90. if ($pro['pid'] == 0) //父类ID处理方法
  91. {
  92. $meta['province'] = $pro['city_name'];
  93. $r = $CityModel->GetAllSon($input['city'], ['city_name', 'id', 'pinyin'], 2);
  94. $renderData['city_son'] = $r;
  95. if (!empty($r)) {
  96. $input['city'] = array_column($r, 'id');
  97. }
  98. } else //子类处理方法
  99. {
  100. $meta['city'] = $pro['city_name'];
  101. $father = $CityModel->FindById($pro['pid']);
  102. if (!empty($father)) {
  103. $meta['province'] = $father['city_name'];
  104. }
  105. // if(substr_count($pro['path'],',') == 2)
  106. // {
  107. // $r = $CityModel->GetAllSon($pro['pid'],['city_name','id','pid','pinyin'],2);
  108. // $renderData['city_son'] = $r;
  109. // }
  110. if ($pro['level'] == 2) {
  111. $r = $CityModel->GetAllSon($pro['pid'], ['city_name', 'id', 'pid', 'pinyin'], 2);
  112. $renderData['city_son'] = $r;
  113. }
  114. }
  115. }
  116. } else {
  117. $pro = $CityModel->FindById(Yii::$app->hostserver->hostId);
  118. $meta['province'] = $pro['city_name'];
  119. $r = $CityModel->GetAllSon(Yii::$app->hostserver->hostId, ['city_name', 'id', 'pid', 'pinyin'], 2);
  120. $renderData['city_son'] = $r;
  121. if (!empty($r)) {
  122. $input['city'] = array_column($r, 'id');
  123. }
  124. if (ArrayHelper::keyExists('city', Yii::$app->request->get()) && !empty(Yii::$app->request->get('city'))) {
  125. $input['city'] = Yii::$app->request->get('city');
  126. }
  127. }
  128. //区分国家,区域为空的情况下,自动获取国外地区,调出楼盘
  129. if (empty($input['city'])) {
  130. $CityModel->pid = 0;
  131. $CityModel->state = 1;
  132. $CityModel->abroad = 1;
  133. $mainCity = $CityModel->getList([], ['id']);
  134. if ($mainCity) {
  135. $city_Id = $CityModel->GetAllSon(array_column($mainCity, 'id'), ['id']);
  136. if (!empty($city_Id)) {
  137. $input['city'] = array_column($city_Id, 'id');
  138. }
  139. }
  140. }
  141. $PriceModel = new \common\models\HousesPrice();
  142. $renderData['price'] = $PriceModel->getList([], ['id', 'price', 'price_short']);
  143. $TypeModel = new \common\models\CategoryHousetype();
  144. $TypeModel->state = 1;
  145. $renderData['type'] = $TypeModel->getList([], ['id', 'huxing_name']);
  146. $zhutiModel = new \common\models\Characteristic();
  147. $renderData['zhuti'] = $zhutiModel->getList([], ['id', 'name']);
  148. //物业类型
  149. $labelType = new CategoryLabel();
  150. $labelType->type = 1;
  151. $labelType->state = 1;
  152. $renderData['label'] = $labelType->getList([], ['id', 'name']); //物业
  153. //品牌馆
  154. $BrandModel = new Brand();
  155. $renderData['brand'] = $BrandModel->getPcSearchBrand(1);
  156. // 特色
  157. $renderData['characteristic'] = (new Characteristic())->getListAll();
  158. $IndexModel = new IndexServer();
  159. $renderData['ctype'] = $IndexModel->Characteristic();
  160. //处理搜索条件
  161. $meta['city'] = '';
  162. $renderData['seo'] = $meta;
  163. $renderData['post'] = $input; //用于view选中
  164. $renderData['count'] = 0;
  165. $model = new HouseServer();
  166. $rows = $model->Search($input);
  167. //右侧热销楼盘
  168. $hothouselist = (new \common\models\House())->HotList(3);
  169. $renderData['hothouselist'] = $hothouselist;
  170. if ($rows['data'] != null) {
  171. $renderData['models'] = $rows['data'];
  172. $renderData['page'] = $rows['page'];
  173. $renderData['count'] = $rows['page']->totalCount;
  174. $renderData['push_discount'] = (new PushDiscount())->getHomeList(1, 4);
  175. $renderData['push_house'] = (new PushDiscount())->getHomeList(2, 8);
  176. }
  177. return $this->render('search', $renderData);
  178. }
  179. public function actionAbroad()
  180. {
  181. $renderData = [];
  182. $meta = []; //SEO 关键字
  183. $CityModel = new \common\models\CategoryCity();
  184. $input = Yii::$app->request->get();
  185. $meta['province'] = '海外房产';
  186. if (Yii::$app->hostserver->hostId == 0) {
  187. $CityModel->pid = 0;
  188. $CityModel->state = 1;
  189. $CityModel->abroad = 2;
  190. $renderData['city'] = $CityModel->getList([], ['city_name', 'id', 'pinyin']);
  191. //处理区域 父类
  192. if (!empty($input['city'])) {
  193. $pro = $CityModel->FindById($input['city']);
  194. if ($pro['pid'] == 0) //父类ID处理方法
  195. {
  196. $meta['province'] = $pro['city_name'];
  197. $r = $CityModel->GetAllSon($input['city'], ['city_name', 'id', 'pinyin']);
  198. $renderData['city_son'] = $r;
  199. if (!empty($r)) {
  200. $input['city'] = array_column($r, 'id');
  201. }
  202. } else //子类处理方法
  203. {
  204. $meta['city'] = $pro['city_name'];
  205. $father = $CityModel->FindById($pro['pid']);
  206. if (!empty($father)) {
  207. $meta['province'] = $father['city_name'];
  208. }
  209. if (substr_count($pro['path'], ',') == 2) {
  210. $r = $CityModel->GetAllSon($pro['pid'], ['city_name', 'id', 'pid', 'pinyin']);
  211. $renderData['city_son'] = $r;
  212. }
  213. }
  214. }
  215. } else {
  216. $pro = $CityModel->FindById(Yii::$app->hostserver->hostId);
  217. $meta['province'] = $pro['city_name'];
  218. $r = $CityModel->GetAllSon(Yii::$app->hostserver->hostId, ['city_name', 'id', 'pid', 'pinyin']);
  219. $renderData['city_son'] = $r;
  220. if (!empty($r)) {
  221. $input['city'] = array_column($r, 'id');
  222. }
  223. if (ArrayHelper::keyExists('city', Yii::$app->request->get()) && !empty(Yii::$app->request->get('city'))) {
  224. $input['city'] = Yii::$app->request->get('city');
  225. }
  226. }
  227. //区分国家,区域为空的情况下,自动获取国外地区,调出楼盘
  228. if (empty($input['city'])) {
  229. $CityModel->pid = 0;
  230. $CityModel->state = 1;
  231. $CityModel->abroad = 2;
  232. $mainCity = $CityModel->getList([], ['id']);
  233. if ($mainCity) {
  234. $city_Id = $CityModel->GetAllSon(array_column($mainCity, 'id'), ['id']);
  235. if (!empty($city_Id)) {
  236. $input['city'] = array_column($city_Id, 'id');
  237. }
  238. }
  239. }
  240. $PriceModel = new \common\models\HousesPrice();
  241. $renderData['price'] = $PriceModel->getList([], ['id', 'price']);
  242. $TypeModel = new \common\models\CategoryHousetype();
  243. $renderData['type'] = $TypeModel->getList([], ['id', 'huxing_name']);
  244. $zhutiModel = new \common\models\Characteristic();
  245. $renderData['zhuti'] = $zhutiModel->getList([], ['id', 'name']);
  246. $IndexModel = new IndexServer();
  247. $renderData['ctype'] = $IndexModel->Characteristic();
  248. //处理搜索条件
  249. $meta['city'] = '';
  250. $renderData['seo'] = $meta;
  251. $renderData['post'] = $input; //用于view选中
  252. $renderData['count'] = 0;
  253. $model = new HouseServer();
  254. $rows = $model->Search($input);
  255. if ($rows['data'] != null) {
  256. $renderData['models'] = $rows['data'];
  257. $renderData['page'] = $rows['page'];
  258. $renderData['count'] = $rows['page']->totalCount;
  259. }
  260. return $this->render('abroad', $renderData);
  261. }
  262. public function actionVr()
  263. {
  264. $renderData = [];
  265. $meta = []; //SEO 关键字
  266. $CityModel = new \common\models\CategoryCity();
  267. $input = Yii::$app->request->get();
  268. $meta['province'] = '海南省';
  269. if (Yii::$app->hostserver->hostId == 0) {
  270. $CityModel->pid = 0;
  271. $CityModel->state = 1;
  272. $CityModel->abroad = 1;
  273. $renderData['city'] = $CityModel->getList([], ['city_name', 'id', 'pinyin']);
  274. //处理区域 父类
  275. if (!empty($input['city'])) {
  276. $pro = $CityModel->FindById($input['city']);
  277. if ($pro['pid'] == 0) //父类ID处理方法
  278. {
  279. $meta['province'] = $pro['city_name'];
  280. $r = $CityModel->GetAllSon($input['city'], ['city_name', 'id', 'pinyin']);
  281. $renderData['city_son'] = $r;
  282. if (!empty($r)) {
  283. $input['city'] = array_column($r, 'id');
  284. }
  285. } else //子类处理方法
  286. {
  287. $meta['city'] = $pro['city_name'];
  288. $father = $CityModel->FindById($pro['pid']);
  289. if (!empty($father)) {
  290. $meta['province'] = $father['city_name'];
  291. }
  292. if (substr_count($pro['path'], ',') == 2) {
  293. $r = $CityModel->GetAllSon($pro['pid'], ['city_name', 'id', 'pid', 'pinyin']);
  294. $renderData['city_son'] = $r;
  295. }
  296. }
  297. }
  298. } else {
  299. $pro = $CityModel->FindById(Yii::$app->hostserver->hostId);
  300. $meta['province'] = $pro['city_name'];
  301. $r = $CityModel->GetAllSon(Yii::$app->hostserver->hostId, ['city_name', 'id', 'pid', 'pinyin']);
  302. $renderData['city_son'] = $r;
  303. if (!empty($r)) {
  304. $input['city'] = array_column($r, 'id');
  305. }
  306. if (ArrayHelper::keyExists('city', Yii::$app->request->get()) && !empty(Yii::$app->request->get('city'))) {
  307. $input['city'] = Yii::$app->request->get('city');
  308. }
  309. }
  310. //区分国家,区域为空的情况下,自动获取国外地区,调出楼盘
  311. if (empty($input['city'])) {
  312. $CityModel->pid = 0;
  313. $CityModel->state = 1;
  314. $CityModel->abroad = 1;
  315. $mainCity = $CityModel->getList([], ['id']);
  316. if ($mainCity) {
  317. $city_Id = $CityModel->GetAllSon(array_column($mainCity, 'id'), ['id']);
  318. if (!empty($city_Id)) {
  319. $input['city'] = array_column($city_Id, 'id');
  320. }
  321. }
  322. }
  323. $PriceModel = new \common\models\HousesPrice();
  324. $renderData['price'] = $PriceModel->getList([], ['id', 'price']);
  325. $TypeModel = new \common\models\CategoryHousetype();
  326. $renderData['type'] = $TypeModel->getList([], ['id', 'huxing_name']);
  327. $zhutiModel = new \common\models\Characteristic();
  328. $renderData['zhuti'] = $zhutiModel->getList([], ['id', 'name']);
  329. $IndexModel = new IndexServer();
  330. $renderData['ctype'] = $IndexModel->Characteristic();
  331. //处理搜索条件
  332. $meta['city'] = '';
  333. $renderData['seo'] = $meta;
  334. $renderData['post'] = $input; //用于view选中
  335. $renderData['count'] = 0;
  336. $model = new HouseServer();
  337. $rows = $model->Search($input);
  338. if ($rows['data'] != null) {
  339. $renderData['models'] = $rows['data'];
  340. $renderData['page'] = $rows['page'];
  341. $renderData['count'] = $rows['page']->totalCount;
  342. }
  343. return $this->render('vr', $renderData);
  344. }
  345. /*
  346. * 获取楼盘户型分组和分组总数
  347. * */
  348. public function actionType()
  349. {
  350. $model = new HouseServer();
  351. $publiHouse = $model->PublicDetails();
  352. $type = $model->Type();
  353. $count = 0;
  354. if (!empty($type)) {
  355. foreach ($type as &$val) {
  356. $count += $val['num'];
  357. }
  358. }
  359. $input['hid'] = Yii::$app->request->get('hid');
  360. $input['type_id'] = Yii::$app->request->get('type_id', '');
  361. $rows = $model->TypeAll($input, false);
  362. $IndexModel = new IndexServer();
  363. $hotHouse = $IndexModel->HotHouse(); //热销楼盘
  364. return $this->render('type', ['post' => Yii::$app->request->get(), 'public' => $publiHouse, 'grouptype' => $type,
  365. 'count' => $count, 'typeimg' => $rows, 'selecttype' => Yii::$app->request->get('type_id', ''), 'hotHouse' => $hotHouse]);
  366. }
  367. /*
  368. * 楼盘首页-户型分组后的数据
  369. * */
  370. public function actionHousetype()
  371. {
  372. $model = new HouseServer();
  373. $rows = $model->TypeAll(Yii::$app->request->post(), true);
  374. if ($rows != null) {
  375. return Help::JsonCode(Help::SUCCESS, '成功', $rows);
  376. }
  377. return Help::JsonCode(Help::ERROR, '暂无楼盘户型图数据');
  378. }
  379. /*
  380. * 楼盘户型数据
  381. * */
  382. public function actionHousetypeall()
  383. {
  384. $model = new HouseServer();
  385. $result = $model->TypeAll(Yii::$app->request->post(), false);
  386. $IndexModel = new IndexServer();
  387. $rows['types'] = $result;
  388. $rows['hotHouse'] = $IndexModel->HotHouse(); //热销楼盘
  389. if ($rows != null) {
  390. return Help::JsonCode(Help::SUCCESS, '成功', $rows);
  391. }
  392. }
  393. /*
  394. * 楼盘首页-楼盘动态
  395. * */
  396. public function actionDynamic()
  397. {
  398. $model = new HouseServer();
  399. $rows = $model->NewsDynamic(Yii::$app->request->post());
  400. if ($rows != null) {
  401. return Help::JsonCode(Help::SUCCESS, '成功', $rows);
  402. }
  403. return Help::JsonCode(Help::ERROR, '失败');
  404. }
  405. /*
  406. * 楼盘详细信息
  407. * */
  408. public function actionDetails()
  409. {
  410. $model = new HouseServer();
  411. $publiHouse = $model->PublicDetails();
  412. // p($publiHouse);
  413. $rows = $model->ParamsDetails();
  414. return $this->render('details', ['public' => $publiHouse, 'model' => $rows]);
  415. }
  416. /*
  417. * 楼盘资讯
  418. * */
  419. public function actionNews()
  420. {
  421. $model = new HouseServer();
  422. $publiHouse = $model->PublicDetails();
  423. $news = $model->HouseNewsList();
  424. $IndexModel = new IndexServer();
  425. $hotHouse = $IndexModel->HotHouse(); //热销楼盘
  426. //大家都在看
  427. $query = \common\models\News::find();
  428. $query->select('subject,id');
  429. $query->limit = 10;
  430. $newsClick = $query->orderBy(['clicks' => SORT_DESC])->asArray()->all();
  431. // dump($news);die;
  432. return $this->render('news', ['public' => $publiHouse, 'news' => $news, 'hotHouse' => $hotHouse, 'newsClick' => $newsClick]);
  433. }
  434. public function actionPeriphery()
  435. {
  436. return $this->render('periphery');
  437. }
  438. /*
  439. * 楼盘相册页面
  440. * */
  441. public function actionAlbum()
  442. {
  443. $model = new HouseServer();
  444. $publiHouse = $model->PublicDetails();
  445. // $album = $model->Album();
  446. $album = $model->Album();
  447. // p($album);die;
  448. return $this->render('album', ['public' => $publiHouse, 'album' => $album]);
  449. }
  450. /**
  451. * 楼盘户型详情
  452. * @return int|mixed|string|\yii\console\Response
  453. * @throws \yii\base\InvalidRouteException
  454. * @throws \yii\console\Exception
  455. */
  456. public function actionTypedetails()
  457. {
  458. $model = new HouseServer();
  459. $publiHouse = $model->PublicDetails();
  460. //楼盘相关户型信息
  461. $model = new HouseServer();
  462. $input = Yii::$app->request->get();
  463. $input['type_id'] = 'all';
  464. $typelist = $model->TypeAll($input,false);
  465. return $this->render('typedetails',['public'=>$publiHouse,'data'=>$typelist]);
  466. }
  467. /*
  468. * 楼盘所有相册
  469. * */
  470. public function actionAlbumlist()
  471. {
  472. $model = new HouseServer();
  473. $album = $model->AlbumAll();
  474. if ($album != null) {
  475. return Help::JsonCode(Help::SUCCESS, '成功', $album);
  476. }
  477. }
  478. /*
  479. * 楼盘相册获取
  480. * */
  481. public function actionGetalbumlist()
  482. {
  483. $model = new HouseServer();
  484. $album = $model->GetAlbumAll(Yii::$app->request->get());
  485. if ($album != null) {
  486. return Help::JsonCode(Help::SUCCESS, '成功', $album);
  487. }
  488. }
  489. /*
  490. * 楼盘首页底部---推荐楼盘 同价位楼盘 同区域楼盘
  491. * */
  492. public function actionTall()
  493. {
  494. $model = new HouseServer();
  495. $res = $model->distinguishHouse(Yii::$app->request->post());
  496. if (!empty($res)) {
  497. return Help::JsonCode(Help::SUCCESS, '成功', $res);
  498. }
  499. }
  500. // 楼盘点评(废弃)
  501. public function actionRemark()
  502. {
  503. // $m = new \common\models\House();
  504. // if(empty($m->HouseIsshow(Yii::$app->request->get('hid'))))
  505. // {
  506. // return Yii::$app->runAction('public/showhouse');
  507. // }
  508. //
  509. // $model = new HouseServer();
  510. // $publiHouse = $model->PublicDetails();
  511. //
  512. // $album = $model->Album();
  513. // return $this->render('remark',['public'=>$publiHouse,'album'=>$album]);
  514. }
  515. public function actionRemarkfrom()
  516. {
  517. $input = Yii::$app->request->post();
  518. $model = new HouseComment();
  519. $input['ip'] = Yii::$app->request->userIP;
  520. $wordMatcher = new WordMatcher();
  521. $sensitivewords = new Sensitivewords();
  522. $senWordsInfo = $sensitivewords->getList();
  523. $list = explode("、", $senWordsInfo['info']);
  524. foreach ($list as $val) {
  525. $wordMatcher->addWord($val);
  526. }
  527. $wordMatcher->match($input['content'], $matched);
  528. if (!empty($matched)) {
  529. return Help::JsonCode(Help::ERROR, '点评内容存在敏感词汇', $matched);
  530. }
  531. $true = $model->Iplimit($input);
  532. if ($true === false) return Help::JsonCode(Help::ERROR, '一个楼盘最多只能点评2次');
  533. $input['initiator'] = 2;
  534. $input['is_show'] = 2;
  535. if ($model->load($input, '') && $model->save()) {
  536. $curlArr = array(
  537. "mobile" => $input['mobile'],
  538. "source" => $input['source'],
  539. "equipment" => 2,
  540. "hid" => $input['hid'],
  541. );
  542. $curl = new curl\Curl();
  543. $url = 'http://www.yigouf.com/enroll/signup';
  544. $response = $curl->reset()->setOption(CURLOPT_POSTFIELDS, http_build_query($curlArr))->post($url);
  545. return Help::JsonCode(Help::SUCCESS, Yii::t('app', '点评成功'));
  546. }
  547. return Help::JsonCode(Help::ERROR, Yii::t('app', '点评失败'), $model->errors);
  548. }
  549. public function actionRemarklikesfrom()
  550. {
  551. $input = Yii::$app->request->post();
  552. $model = new HouseCommentLikes();
  553. $input['ip'] = Yii::$app->request->userIP;
  554. $true = $model->Iplimit($input);
  555. if ($true === false) return Help::JsonCode(Help::ERROR, '一条点评最多只能赞一次');
  556. if ($model->load($input, '') && $model->save()) {
  557. $model->hid = $input['hid'];
  558. $model->hcid = $input['hcid'];
  559. $total = $model->Total();
  560. return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'add_success'), $total);
  561. }
  562. return Help::JsonCode(Help::ERROR, Yii::t('app', 'add_error'), $model->errors);
  563. }
  564. // 楼盘点评
  565. public function actionHouseremark()
  566. {
  567. $input = Yii::$app->request->get();
  568. $model = new HouseServer();
  569. $houseComment = new HouseComment();
  570. $rows = $model->Details();
  571. $publiHouse = $model->PublicDetails();
  572. // $album = $model->Album();
  573. // ,'album'=>$album
  574. $getHouseList = $model->getHouseRemarkList($input, 10);
  575. $houseComment->hid = $input['hid'];
  576. $getHouseListTotal = $houseComment->getHouseListTotal();
  577. return $this->render('houseremark', ['model' => $rows, 'hid' => Yii::$app->request->get('hid'), 'xuqiu' => $houseComment->xuqiu, 'commentList' => $getHouseList, 'getHouseListTotal' => $getHouseListTotal, 'public' => $publiHouse]);
  578. }
  579. public function actionSendcode()
  580. {
  581. $input = Yii::$app->request->post();
  582. $input['purpose'] = '视频播放验证';
  583. $smsServer = new \frontend\server\SendCode();
  584. return $smsServer->send($input);
  585. }
  586. public function actionCheckcode()
  587. {
  588. $input = Yii::$app->request->post();
  589. $session = Yii::$app->session;
  590. $skey = 'live_' . $input['mobile'];
  591. if (empty($session[$skey])) {
  592. return Help::JsonCode(Help::ERROR, '请输入正确手机号');
  593. }
  594. //验证码有效期5分钟
  595. if ($session[$skey]['expire_time'] < time()) {
  596. return Help::JsonCode(Help::ERROR, '验证码已失效');
  597. }
  598. if ($input['code'] != $session[$skey]['code']) {
  599. return Help::JsonCode(Help::ERROR, '验证码不正确');
  600. }
  601. Yii::$app->session->set('adopt', $input['mobile']);
  602. if (!empty(Yii::$app->session['adopt']) && !empty(Yii::$app->session[$skey])) {
  603. $record = Sendcoderecord::find()->andWhere(['mobilephone' => $input['mobile'], 'code' => $session[$skey]['code']])->one();
  604. $record->status = 2;
  605. $record->save();
  606. }
  607. return Help::JsonCode(Help::SUCCESS, '验证通过');//验证通过继续播放视频
  608. }
  609. // 众趣播放页面
  610. public function actionZhongqu()
  611. {
  612. $input = Yii::$app->request->get();
  613. $url = '#';
  614. if (!empty($input['h'])) {
  615. $url = $input['h'];
  616. }
  617. return $this->render('zhongqu', ['url' => $url]);
  618. }
  619. }