PjController.php 1.8 KB

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