Add "next_start" to JSON API result on posts
This commit is contained in:
parent
5f2cc85c9a
commit
81b21d838f
|
@ -26,8 +26,13 @@ ORDER BY id ASC LIMIT '.$limit.'
|
|||
unset($object['reblog_of_id']);
|
||||
}
|
||||
|
||||
$delay = 0;
|
||||
$next_start = null;
|
||||
if (count($objects) > 0) {
|
||||
$delay = $pg->fetch('SELECT COUNT(1) FROM statuses WHERE id > '.$objects[count($objects)-1]['id']);
|
||||
$delay = intval($delay['count']);
|
||||
$next_start = $objects[count($objects)-1]['id'];
|
||||
}
|
||||
if ($delay > $limit)
|
||||
$delay = ['total' => $delay, 'ticks' => intval($delay / $limit)];
|
||||
else $delay = ['total' => $delay, 'ticks' => 1 ];
|
||||
|
@ -37,6 +42,7 @@ ORDER BY id ASC LIMIT '.$limit.'
|
|||
'items' => $objects,
|
||||
'limit' => $limit,
|
||||
'delay' => $delay,
|
||||
'next_start' => $next_start,
|
||||
]);
|
||||
};
|
||||
$_();
|
||||
|
|
Loading…
Reference in New Issue