public function getFollowingFeed($where = '', $limit = 10, $uid = '', $fgid = '', $max = null)
{
$fgid = intval($fgid);
$uid = intval($uid);
$buid = empty($uid) ? $_SESSION['mid'] : $uid;
$table = "{$this->tablePrefix}feed AS a LEFT JOIN {$this->tablePrefix}user_follow AS b ON a.uid=b.fid AND b.uid = {$buid}";
// 加上自己的信息,若不需要屏蔽下语句
$_where = !empty($where) ? "(a.uid = '{$buid}' OR b.uid = '{$buid}') AND ({$where})" : "(a.uid = '{$buid}' OR b.uid = '{$buid}')";
// 若填写了关注分组
if (!empty($fgid)) {
$table .= " LEFT JOIN {$this->tablePrefix}user_follow_group_link AS c ON a.uid = c.fid AND c.uid ='{$buid}' ";
$_where .= ' AND c.follow_group_id = ' . intval($fgid);
}
$feedlist = $this->table($table)->where($_where)->field('a.feed_id')->order('a.feed_id DESC');
//2013-10-01 为了提高效率增加一项改进,可以设置查看的分享总数,默认10000条
if ($max > 0) {
$feedlist = $this->findPage($limit, $max);
} else {
$feedlist = $this->findPage($limit);
}
$feed_ids = getSubByKey($feedlist['data'], 'feed_id');
$feedlist['data'] = $this->getFeeds($feed_ids);
return $feedlist;
}