mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
VKAPI: Add support to start_from parameter
This commit is contained in:
parent
75030bfdc4
commit
174ed53d92
1 changed files with 4 additions and 4 deletions
|
@ -10,9 +10,6 @@ final class Newsfeed extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
if($offset != 0)
|
|
||||||
$start_from = $offset;
|
|
||||||
|
|
||||||
$id = $this->getUser()->getId();
|
$id = $this->getUser()->getId();
|
||||||
$subs = DatabaseConnection::i()
|
$subs = DatabaseConnection::i()
|
||||||
->getContext()
|
->getContext()
|
||||||
|
@ -29,12 +26,15 @@ final class Newsfeed extends VKAPIRequestHandler
|
||||||
->select("id")
|
->select("id")
|
||||||
->where("wall IN (?)", $ids)
|
->where("wall IN (?)", $ids)
|
||||||
->where("deleted", 0)
|
->where("deleted", 0)
|
||||||
|
->where("created < (?)", empty($start_from) ? time()+1 : $start_from)
|
||||||
->order("created DESC");
|
->order("created DESC");
|
||||||
|
|
||||||
$rposts = [];
|
$rposts = [];
|
||||||
foreach($posts->page((int) ($offset + 1), $count) as $post)
|
foreach($posts->page((int) ($offset + 1), $count) as $post)
|
||||||
$rposts[] = (new PostsRepo)->get($post->id)->getPrettyId();
|
$rposts[] = (new PostsRepo)->get($post->id)->getPrettyId();
|
||||||
|
|
||||||
return (new Wall)->getById(implode(',', $rposts), $extended, $fields, $this->getUser());
|
$response = (new Wall)->getById(implode(',', $rposts), $extended, $fields, $this->getUser());
|
||||||
|
$response->next_from = end($response->items)->date;
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue