12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/7/16
- * Time: 上午9:36
- */
- namespace frontend\controllers;
- use frontend\base\CommonController;
- use common\models\NewsWeirdo;
- use yii\data\Pagination;
- use Yii;
- class WeirdoController extends CommonController{
- public function actionHome()
- {
- $model = new NewsWeirdo();
- $pages = new Pagination(['totalCount' => $model->HomeListTotal(),'pageSize'=>8, 'pageSizeParam' => false, 'validatePage' => false, ]);
- $rows = $model->HomeList($pages);
- // p($rows);
- return $this->render('home',['model'=>$rows,'page'=>$pages]);
- }
- public function actionDetails()
- {
- $model = new NewsWeirdo();
- $rows = $model->FindById(Yii::$app->request->get('qid'));
- //记录查看次数
- $iprecord = new \common\models\AllclickRecord();
- $arr['id'] = $rows->id;
- $arr['ip'] = Yii::$app->request->userIP;;
- $arr['type'] = 2;
- $re = $iprecord->RecordQuery($arr);
- if(empty($re)){
- if($iprecord->addRecord($arr))
- {
- $model->Clickadd($rows->id);
- }
- }
- //推荐楼盘
- $house = new \common\models\House();
- $house->is_push = 2;
- $houseRes = $house->randList(4,[]);
- return $this->render('details',['model'=>$rows,'cityhouse'=>$houseRes]);
- }
- }
|