WeirdoController.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace wechat\controllers;
  3. use wechat\base\CommonController;
  4. use common\models\NewsWeirdo;
  5. use Yii;
  6. use wechat\base\Help;
  7. class WeirdoController extends CommonController{
  8. public function actionHome()
  9. {
  10. $model = new NewsWeirdo();
  11. // $pages = new Pagination(['totalCount' => $model->HomeListTotal(),'pageSize'=>8, 'pageSizeParam' => false, 'validatePage' => false, ]);
  12. $rows = $model->HomeList([]);
  13. // p($rows);
  14. return $this->render('home',['model'=>$rows]);
  15. }
  16. public function actionHomeform()
  17. {
  18. $model = new NewsWeirdo();
  19. $rows = $model->Mhomelist(Yii::$app->request->post());
  20. if(!empty($rows))
  21. {
  22. foreach ($rows as &$val)
  23. {
  24. $val['thumb'] = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['weirdo'].$val['thumb'];
  25. }
  26. return Help::JsonCode(Help::SUCCESS,'成功',$rows);
  27. }
  28. return Help::JsonCode(Help::ERROR,'暂无资料');
  29. }
  30. public function actionDetails()
  31. {
  32. $model = new NewsWeirdo();
  33. $rows = $model->FindById(Yii::$app->request->get('qid'));
  34. //记录查看次数
  35. $iprecord = new \common\models\AllclickRecord();
  36. $arr['id'] = $rows->id;
  37. $arr['ip'] = Yii::$app->request->userIP;;
  38. $arr['type'] = 2;
  39. $re = $iprecord->RecordQuery($arr);
  40. if(empty($re)){
  41. if($iprecord->addRecord($arr))
  42. {
  43. $model->Clickadd($rows->id);
  44. }
  45. }
  46. //推荐楼盘
  47. $house = new \common\models\House();
  48. $house->is_push = 2;
  49. $houseRes = $house->randList(3,[]);
  50. return $this->render('details',['model'=>$rows,'cityhouse'=>$houseRes]);
  51. }
  52. }