public function public_timeline($type, $since_id = 0, $max_id = 0, $limit = 20, $page = 1, $returnId = false)
{
$since_id = intval($since_id);
$max_id = intval($max_id);
$limit = intval($limit);
$page = intval($page);
$where = ' is_del = 0 ';
//动态类型
if (in_array($type, array('post', 'repost', 'postimage', 'postfile', 'postvideo'))) {
$where .= " AND type='{$type}' ";
}
if (!empty($since_id) || !empty($max_id)) {
!empty($since_id) && ($where .= " AND feed_id > {$since_id}");
!empty($max_id) && ($where .= " AND feed_id < {$max_id}");
}
$start = ($page - 1) * $limit;
$end = $limit;
$feed_ids = $this->where($where)->field('feed_id')->limit("{$start},{$end}")->order('feed_id DESC')->getAsFieldArray('feed_id');
if ($returnId === true) {
$feed_ids = is_array($feed_ids) ? $feed_ids : array();
return $feed_ids;
}
return $this->formatFeed($feed_ids, true);
}