12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace wechat\controllers;
- use wechat\base\CommonController;
- use common\models\NewsWeirdo;
- use Yii;
- use wechat\base\Help;
- 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([]);
- // p($rows);
- return $this->render('home',['model'=>$rows]);
- }
- public function actionHomeform()
- {
- $model = new NewsWeirdo();
- $rows = $model->Mhomelist(Yii::$app->request->post());
- if(!empty($rows))
- {
- foreach ($rows as &$val)
- {
- $val['thumb'] = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['weirdo'].$val['thumb'];
- }
- return Help::JsonCode(Help::SUCCESS,'成功',$rows);
- }
- return Help::JsonCode(Help::ERROR,'暂无资料');
- }
- 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(3,[]);
- return $this->render('details',['model'=>$rows,'cityhouse'=>$houseRes]);
- }
- }
|