Exemplo n.º 1
0
 public function index()
 {
     $this->assign('event', EventModel::hotEvents(1));
     $users = model('User')->getUserList(10);
     foreach ($users['data'] as &$user) {
         $user = model('User')->formatForApi($user, $user['uid']);
     }
     $this->assign('users', $users['data']);
     $blogs = BlogModel::hotBlogs(10);
     $this->assign('blogs', $blogs);
     $video = M('V')->hotVideo(8);
     foreach ($video as &$row) {
         $row['user'] = model('User')->formatForApi($row, $row['uid']);
     }
     $this->assign('videos', $video);
     //$this->ajaxReturn($video);
     //热门图片
     $photos = M('Photo')->where(array('is_del' => 0))->limit(10)->order('commentCount desc,cTime desc')->select();
     $this->assign('photos', $photos);
     //热门专题
     $album = M('Album')->order('comment_count desc')->find();
     $album['intro'] = htmlspecialchars_decode($album['intro']);
     $album['attach_info'] = model('attach')->getAttachById($album['attach']);
     $this->assign('album', $album);
     $this->display();
 }
Exemplo n.º 2
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();
 }