public function commentList()
 {
     //分页设置
     $pageSize = 40;
     //查询条数
     $currPage = I('page', '1', 'intval');
     //获取当前页数
     $countPage = 0;
     //总页数
     $uid = session('uid');
     //登录用户的ID标识
     //将用户的新评论数设置为0
     M('user')->where(array('id' => $uid))->setField('newcommentNum', 0);
     $articleIdList = array();
     //查找出这个用户所发的帖子的ID
     $articleId = M('article')->field('id')->where(array('uid' => $uid))->select();
     foreach ($articleId as $item) {
         $articleIdList[] = $item['id'];
     }
     //查找赞动态总数量
     $where = array('aid' => array('IN', $articleIdList));
     $countPage = M('comments')->where($where)->count();
     //查找分页数据
     $limit = ($currPage - 1) * $pageSize . ',' . $pageSize;
     $list = D('CommentDongtaiRelation')->getCommentsList($where, $limit);
     for ($i = 0; $i < count($list); $i++) {
         $list[$i]['time'] = timeFriendly($list[$i]['time']);
         //上传时间转换
         $list[$i]['userinfo']['headicon'] = headiconUrl($list[$i]['userinfo']['headicon'], 60);
         //用户头像转换
         $list[$i]['articleinfo']['pic'] = pictureUrl($list[$i]['articleinfo']['pic'], 106);
         //用户上传图片转换
     }
     $this->ajaxReturn($list, "评论动态列表", 1);
 }
 public function commontList()
 {
     $aid = I('aid', '', 'intval');
     //帖子ID
     //分页设置
     $pageSize = 20;
     //查询条数
     $currPage = I('page', '1', 'intval');
     //获取当前页数
     $countPage = 0;
     //总页数
     //查找评论总数
     $countPage = M('comments')->where(array('aid' => $aid))->count();
     //查找分页数据
     $limit = ($currPage - 1) * $pageSize . ',' . $pageSize;
     $list = D('CommentRelation')->getArticleComments(array('aid' => $aid), $limit);
     if ($listNum = count($list)) {
         for ($i = 0; $i < $listNum; $i++) {
             $list[$i]['time'] = timeFriendly($list[$i]['time']);
             $list[$i]['fromuser']['headicon'] = headiconUrl($list[$i]['fromuser']['headicon'], 60);
             //用户头像转换
             if (!$list[$i]['touser']) {
                 $list[$i]['touser'] = '';
             } else {
                 $list[$i]['touser']['headicon'] = headiconUrl($list[$i]['touser']['headicon'], 60);
                 //用户头像转换
             }
         }
     } else {
         $list = '';
     }
     $this->ajaxReturn($list, "帖子评论表", 1);
 }