public function articleInfo() { //实例化Model $articleModel = new ArticleModel(); //文章 $commentModel = new CommentModel(); //评论 $collectModel = new CollectModel(); //文章收藏 $articleId = Data::get($_GET['articleId'], Data::Int); if (!is_int($articleId) && $articleId <= 0) { R('Index', 'index'); } $articleModel->setIncArticleByHitNum($articleId); //文章信息 $content = $articleModel->getArticleById($articleId); //文章评论数 $commentNum = $commentModel->getCommentCountByArticleId($articleId); $content['commentNum'] = $commentNum; //文章收藏数 $collectNum = $collectModel->getCollectCountByarticleId($articleId); $content['collectNum'] = $collectNum; //是否已经收藏 $if_collect = 0; if ($_SESSION['qq']) { if ($collectModel->getCollects($articleId, $_SESSION['qq']['userId'])) { $if_collect = 1; } } //评论查询 $comments = $commentModel->getComment($articleId); //用户个人信息 $allUserInfo = $this->getAllUserInfo(); //博主个人信息 $blogerInfo = $this->getBlogerInfo($content['adminId']); //获取所有文章分类 $allTypes = $this->getAllTypes($content['adminId']); //获取所有文章标签 $allTags = $this->getAllTags(); //文章总数 $count = $this->articleCount($content['adminId']); //最新三条评论 $latestComments = $this->getLatestComments($content['adminId'], '0,3'); $this->assign('count', $count); //某博主文章总数 $this->assign("allTags", $allTags); //所有文章标签 $this->assign("allTypes", $allTypes); //某人所有文章分类 $this->assign('blogerInfo', $blogerInfo); //某博主信息 $this->assign('allUserInfo', $allUserInfo); //某用户信息 $this->assign('latestComments', $latestComments); //最新三条评论 $this->assign('if_collect', $if_collect); //是否已经收藏 $this->assign('article', $content); //文章详情 $this->assign('comments', $comments); $this->display(); }