mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
highly improve discussion perfs + fix initial sound playing and erratic scrolling
This commit is contained in:
parent
48e8eacc34
commit
fb919ff59f
10 changed files with 242 additions and 28 deletions
|
@ -178,6 +178,34 @@ namespace models;
|
|||
|
||||
return $this->_run_query($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return sendeds for an origin and a user since a date.
|
||||
*
|
||||
* @param int $id_user : User id
|
||||
* @param string $since : Date we want messages since
|
||||
* @param string $origin : Number who sent the message
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function gets_since_date_by_origin_and_user(int $id_user, string $since, string $origin)
|
||||
{
|
||||
$query = '
|
||||
SELECT *
|
||||
FROM received
|
||||
WHERE id_user = :id_user
|
||||
AND origin = :origin
|
||||
AND at > :since
|
||||
';
|
||||
|
||||
$params = [
|
||||
'id_user' => $id_user,
|
||||
'origin' => $origin,
|
||||
'since' => $since,
|
||||
];
|
||||
|
||||
return $this->_run_query($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of sended SMS for every date since a date for a specific user.
|
||||
|
|
|
@ -233,6 +233,63 @@ namespace models;
|
|||
|
||||
return $this->_run_query($query, $params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get messages scheduled after a date for a number and a user.
|
||||
*
|
||||
* @param int $id_user : User id
|
||||
* @param $date : Date after which we want messages
|
||||
* @param string $number : Number for which we want messages
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function gets_after_date_for_number_and_user(int $id_user, $date, string $number)
|
||||
{
|
||||
$query = '
|
||||
SELECT *
|
||||
FROM scheduled
|
||||
WHERE at > :date
|
||||
AND id_user = :id_user
|
||||
AND (
|
||||
id IN (
|
||||
SELECT id_scheduled
|
||||
FROM scheduled_number
|
||||
WHERE number = :number
|
||||
)
|
||||
OR id IN (
|
||||
SELECT id_scheduled
|
||||
FROM scheduled_contact
|
||||
WHERE id_contact IN (
|
||||
SELECT id
|
||||
FROM contact
|
||||
WHERE number = :number
|
||||
)
|
||||
)
|
||||
OR id IN (
|
||||
SELECT id_scheduled
|
||||
FROM scheduled_group
|
||||
WHERE id_group IN (
|
||||
SELECT id_group
|
||||
FROM `group_contact`
|
||||
WHERE id_contact IN (
|
||||
SELECT id
|
||||
FROM contact
|
||||
WHERE number = :number
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
';
|
||||
|
||||
$params = [
|
||||
'id_user' => $id_user,
|
||||
'date' => $date,
|
||||
'number' => $number,
|
||||
];
|
||||
|
||||
return $this->_run_query($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get scheduleds before a date.
|
||||
|
|
|
@ -112,6 +112,35 @@ namespace models;
|
|||
|
||||
return $this->_run_query($query, $params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return sendeds for an destination and a user since a date.
|
||||
*
|
||||
* @param int $id_user : User id
|
||||
* @param string $since : Date we want messages since
|
||||
* @param string $destination : Number who sent the message
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function gets_since_date_by_destination_and_user(int $id_user, string $since, string $destination)
|
||||
{
|
||||
$query = '
|
||||
SELECT *
|
||||
FROM sended
|
||||
WHERE id_user = :id_user
|
||||
AND destination = :destination
|
||||
AND at > :since
|
||||
';
|
||||
|
||||
$params = [
|
||||
'id_user' => $id_user,
|
||||
'destination' => $destination,
|
||||
'since' => $since,
|
||||
];
|
||||
|
||||
return $this->_run_query($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return sended for an uid and an adapter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue