示例#1
0
 public function detail()
 {
     $id = $_GET['id'];
     $blog = BlogModel::blog($id);
     $blog['is_favour'] = M('Favour')->is_favour($id, $this->mid, 'blog');
     $this->assign('blog', $blog);
     $this->assign('hot_blogs', BlogModel::hotBlogs(5));
     $comments = BlogModel::comments($id, 20);
     if (!empty($comments)) {
         foreach ($comments as &$comment) {
             $comment = model('User')->formatForApi($comment, $comment['uid']);
             $comment['addtime'] = $comment['ctime'];
             $comment['content'] = $this->convert_img($comment['content']);
         }
     }
     M('Blog')->updateReadCount($id);
     $this->assign('comments', $comments);
     $this->display();
 }