1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-11 16:32:55 +00:00

Prepare api v2 calls to retrieve messages from the server

This commit is contained in:
Loic Blot
2016-05-12 23:05:58 +02:00
parent facbe2a7d7
commit d6818be568
3 changed files with 61 additions and 6 deletions
+15
View File
@@ -157,6 +157,21 @@ class SmsMapper extends Mapper {
return $messageList;
}
public function getMessages ($userId, $start, $limit) {
$messageList = array();
$query = \OCP\DB::prepare('SELECT sms_date, sms_msg, sms_type FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ? LIMIT ?,?');
$result = $query->execute(array($userId, $start, $limit));
while ($row = $result->fetchRow()) {
$messageList[$row["sms_date"]] = array(
"msg" => $row["sms_msg"],
"type" => $row["sms_type"]
);
}
return $messageList;
}
public function countMessagesForPhoneNumber ($userId, $phoneNumber, $country) {
$cnt = 0;
$phlst = $this->getAllPhoneNumbersForFPN ($userId, $phoneNumber, $country);