mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-12 02:16:25 +00:00
Prepare to get conversation number on write
This commit is contained in:
parent
7bd0ea3af3
commit
e63237283f
@ -177,15 +177,22 @@
|
|||||||
<type>text</type>
|
<type>text</type>
|
||||||
<notnull>true</notnull>
|
<notnull>true</notnull>
|
||||||
<length>64</length>
|
<length>64</length>
|
||||||
|
<primary>true</primary>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>sms_address</name>
|
<name>user_id</name>
|
||||||
|
<type>text</type>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<length>64</length>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>phone_number</name>
|
||||||
<type>text</type>
|
<type>text</type>
|
||||||
<notnull>true</notnull>
|
<notnull>true</notnull>
|
||||||
<length>512</length>
|
<length>512</length>
|
||||||
</field>
|
</field>
|
||||||
<index>
|
<index>
|
||||||
<name>smsdata_conversations_id_address</name>
|
<name>smsdata_conversations_user_id_address</name>
|
||||||
<field>
|
<field>
|
||||||
<name>id</name>
|
<name>id</name>
|
||||||
</field>
|
</field>
|
||||||
|
@ -308,6 +308,16 @@ class SmsMapper extends Mapper {
|
|||||||
return $phoneList;
|
return $phoneList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getConversationForUserAndPhone($userId, $phoneNumber) {
|
||||||
|
$qb->select('id')
|
||||||
|
->from('ocsms_conversations')
|
||||||
|
->where($qb->expr()->andX(
|
||||||
|
$qb->expr()->eq('user_id', $qb->createNamedParameter($userId)),
|
||||||
|
$qb->expr()->in('phone_number', $qb->createNamedParameter($phoneNumber))
|
||||||
|
);
|
||||||
|
$result = $qb->execute();
|
||||||
|
}
|
||||||
|
|
||||||
public function writeToDB ($userId, $smsList, $purgeAllSmsBeforeInsert = false) {
|
public function writeToDB ($userId, $smsList, $purgeAllSmsBeforeInsert = false) {
|
||||||
$this->db->beginTransaction();
|
$this->db->beginTransaction();
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
@ -348,7 +358,7 @@ class SmsMapper extends Mapper {
|
|||||||
(int) $sms["type"]
|
(int) $sms["type"]
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->getConversationForUserAndPhone($userId, $sms["address"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user