1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 07:56:23 +00:00

Return current start as last_id if last_id = 0

This commit is contained in:
Loic Blot 2016-12-07 00:10:06 +01:00
parent 7fda438397
commit 467565d41b

View File

@ -195,7 +195,7 @@ class ApiController extends Controller {
} }
$messages = $this->smsMapper->getMessages($this->userId, $start, $limit); $messages = $this->smsMapper->getMessages($this->userId, $start, $limit);
$last_id = 0; $last_id = $start;
if (count($messages) > 0) { if (count($messages) > 0) {
$last_id = max(array_keys($messages)); $last_id = max(array_keys($messages));
} }
@ -219,7 +219,7 @@ class ApiController extends Controller {
} }
// @TODO because multiple phone numbers can be same number with different formatting // @TODO because multiple phone numbers can be same number with different formatting
return new JSONResponse(array("messages" => array(), "last_id" => 0)); return new JSONResponse(array("messages" => array(), "last_id" => $start));
} }
/** /**