public function recommend_timeline($type, $mid, $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 = ' a.is_del = 0 ';
// 动态类型
if (in_array($type, array('post', 'repost', 'postimage', 'postfile', 'postvideo'))) {
$where .= " AND a.type='{$type}' ";
}
if (!empty($since_id) || !empty($max_id)) {
!empty($since_id) && ($where .= " AND a.feed_id > {$since_id}");
!empty($max_id) && ($where .= " AND a.feed_id < {$max_id}");
}
$where .= ' AND is_recommend = 1 AND is_audit = 1';
$start = ($page - 1) * $limit;
$end = $limit;
$table = "{$this->tablePrefix}feed AS a LEFT JOIN {$this->tablePrefix}user_follow AS b ON a.uid=b.fid AND b.uid = {$mid}";
// 加上自己的信息,若不需要此数据,请屏蔽下面语句
$feed_ids = $this->where($where)->table($table)->field('a.feed_id')->limit("{$start},{$end}")->order('a.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);
}