VKAPI: Change behaviour of start_from and next_from params. Timestamp can cause issues, so i just changed it to 'internal' id

This commit is contained in:
veselcraft 2022-08-27 01:36:54 +03:00
parent 343acabff2
commit 863fb232e0
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -26,7 +26,7 @@ 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) ->where("id < (?)", empty($start_from) ? time()+1 : $start_from)
->order("created DESC"); ->order("created DESC");
$rposts = []; $rposts = [];
@ -34,7 +34,7 @@ final class Newsfeed extends VKAPIRequestHandler
$rposts[] = (new PostsRepo)->get($post->id)->getPrettyId(); $rposts[] = (new PostsRepo)->get($post->id)->getPrettyId();
$response = (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; $response->next_from = end($response->items)->id;
return $response; return $response;
} }
} }