mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 07:56:23 +00:00
Return last_id = 0 when there is no new messages
This commit is contained in:
parent
8d335d449e
commit
7fda438397
@ -195,8 +195,12 @@ class ApiController extends Controller {
|
||||
}
|
||||
|
||||
$messages = $this->smsMapper->getMessages($this->userId, $start, $limit);
|
||||
$last_id = 0;
|
||||
if (count($messages) > 0) {
|
||||
$last_id = max(array_keys($messages));
|
||||
}
|
||||
|
||||
return new JSONResponse(array("messages" => $messages, "last_id" => max(array_keys($messages))));
|
||||
return new JSONResponse(array("messages" => $messages, "last_id" => $last_id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user