public function index() { $article = new ArticleModel(); $comment = new CommentModel(); $commentuser = new CommentuserModel(); //合计评论用户数 $this->totalUser = $commentuser->getCount(); //文章合计 $this->totalArticle = $article->getCount(); //评论合计 $this->totalComment = $comment->getCount(); //今日新增 $this->todayArticle = $article->getCount(' `createtime` > ' . $this->formatTime(time(), '1')); $this->todayComment = $comment->getCount(' `comment_time` > ' . $this->formatTime(time(), '1')); //昨日新增 $this->yesArticle = $article->getCount(' `createtime` > ' . $this->formatTime(time() - 24 * 60 * 60, '1') . ' AND createtime < ' . $this->formatTime(time() - 24 * 60 * 60, '2')); $this->yesComment = $comment->getCount(' `comment_time` > ' . $this->formatTime(time() - 24 * 60 * 60, '1') . ' AND comment_time < ' . $this->formatTime(time() - 24 * 60 * 60, '2')); //热门文章输出 $data = $article->getArticle('web_article.clicked', array(0, 10)); // foreach($data as $key=>$v){ // $data[$key]['commentinfo'] = count($data[$key]['commentinfo']); // } $this->data = $data; //活跃用户 $userList = $comment->getHotUser(); $this->userList = $userList; $this->display("Index/index.tpl"); }
public function del() { $id = $this->id; $commentUser = new CommentuserModel(); $comment = new CommentModel(); if ($commentUser->delete($id) && $comment->delCommentByCommentUserId($id)) { href('删除成功'); } else { href('删除失败'); } }