public function reportList() { import('Class.Page', APP_PATH); $count = M('article')->where(array('toreport' => 1))->count(); $page = new Page($count, 12); $limit = $page->firstRow . ',' . $page->listRows; $list = M('article')->field('id,pic,label,landmark,describe,toreport')->where(array('toreport' => 1))->order('id DESC')->limit($limit)->select(); for ($i = 0; $i < count($list); $i++) { $list[$i]['pic'] = pictureUrl($list[$i]['pic'], 212); //帖子图片转换 } $this->list = $list; $this->page = $page->show(); $this->display(); }
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 searchList() { //搜索条件 $condition = I('condition', ''); $where['label'] = array('like', '%' . $condition . '%'); //分页设置 $pageSize = 30; //查询条数 $currPage = I('page', '1', 'intval'); //获取当前页数 $countPage = 0; //总页数 //查找显示帖子总数量 $countPage = M('article')->where($where)->count(); //查找分页数据 $limit = ($currPage - 1) * $pageSize . ',' . $pageSize; $list = M('article')->field('id,pic,toreport')->where($where)->order('id DESC')->limit($limit)->select(); for ($i = 0; $i < count($list); $i++) { $list[$i]['pic'] = pictureUrl($list[$i]['pic'], 640); } $this->ajaxReturn($list, "搜索列表文章显示", 1); }