1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/4/26
- * Time: 上午11:13
- */
- namespace mobile\controllers;
- use mobile\base\CommonController;
- use Yii;
- use mobile\base\Help;
- use common\models\NewsRenovation;
- use common\models\NewsRenovationcontent;
- use yii\data\Pagination;
- class PjController extends CommonController
- {
- public function actionHome()
- {
- return $this->render('home');
- }
- public function actionHomeform()
- {
- $model = new NewsRenovation();
- $rows = $model->MgetList(Yii::$app->request->get());
- if(!empty($rows))
- {
- foreach ($rows as &$val)
- {
- $val['img'] = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['pj'].$val['img'];
- isset(Yii::$app->params['DecorationStyle'][$val['type']]) ? $val['type'] = Yii::$app->params['DecorationStyle'][$val['type']] : '';
- }
- return Help::JsonCode(Help::SUCCESS,'成功',$rows);
- }
- return Help::JsonCode(Help::ERROR,'失败');
- }
- public function actionDetails()
- {
- $model = new NewsRenovation();
- //品鉴相关信息
- $f = new NewsRenovationcontent();
- $f->nid = Yii::$app->request->get('pid');
- $col = $f->MLabel();
- //记录查看次数
- $iprecord = new \common\models\AllclickRecord();
- $arr['id'] = Yii::$app->request->get('pid');
- $arr['ip'] = Yii::$app->request->userIP;;
- $arr['type'] = 1;
- $re = $iprecord->RecordQuery($arr);
- if(empty($re)){
- if($iprecord->addRecord($arr))
- {
- $model->Clickadd($model->id);
- }
- }
- return $this->render('details',['model'=>$col]);
- }
- }
|