PjController.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/4/26
  6. * Time: 上午11:13
  7. */
  8. namespace mobile\controllers;
  9. use mobile\base\CommonController;
  10. use Yii;
  11. use mobile\base\Help;
  12. use common\models\NewsRenovation;
  13. use common\models\NewsRenovationcontent;
  14. use yii\data\Pagination;
  15. class PjController extends CommonController
  16. {
  17. public function actionHome()
  18. {
  19. return $this->render('home');
  20. }
  21. public function actionHomeform()
  22. {
  23. $model = new NewsRenovation();
  24. $rows = $model->MgetList(Yii::$app->request->get());
  25. if(!empty($rows))
  26. {
  27. foreach ($rows as &$val)
  28. {
  29. $val['img'] = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['pj'].$val['img'];
  30. isset(Yii::$app->params['DecorationStyle'][$val['type']]) ? $val['type'] = Yii::$app->params['DecorationStyle'][$val['type']] : '';
  31. }
  32. return Help::JsonCode(Help::SUCCESS,'成功',$rows);
  33. }
  34. return Help::JsonCode(Help::ERROR,'失败');
  35. }
  36. public function actionDetails()
  37. {
  38. $model = new NewsRenovation();
  39. //品鉴相关信息
  40. $f = new NewsRenovationcontent();
  41. $f->nid = Yii::$app->request->get('pid');
  42. $col = $f->MLabel();
  43. //记录查看次数
  44. $iprecord = new \common\models\AllclickRecord();
  45. $arr['id'] = Yii::$app->request->get('pid');
  46. $arr['ip'] = Yii::$app->request->userIP;;
  47. $arr['type'] = 1;
  48. $re = $iprecord->RecordQuery($arr);
  49. if(empty($re)){
  50. if($iprecord->addRecord($arr))
  51. {
  52. $model->Clickadd($model->id);
  53. }
  54. }
  55. return $this->render('details',['model'=>$col]);
  56. }
  57. }