HouseController.php 25 KB

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