Add uid for uniq identification by adapter of a sended sms. Usefull for tracking status
This commit is contained in:
parent
d8839a57d0
commit
89459a0285
|
@ -51,9 +51,9 @@
|
||||||
* @param string $destination : Phone number to send the sms to
|
* @param string $destination : Phone number to send the sms to
|
||||||
* @param string $text : Text of the SMS to send
|
* @param string $text : Text of the SMS to send
|
||||||
* @param bool $flash : Is the SMS a Flash SMS
|
* @param bool $flash : Is the SMS a Flash SMS
|
||||||
* @return bool : True if send, False else
|
* @return mixed Uid of the sended message if send, False else
|
||||||
*/
|
*/
|
||||||
public function send (string $destination, string $text, boolean $flash) : boolean;
|
public function send (string $destination, string $text, boolean $flash) : mixed;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,11 +66,11 @@
|
||||||
* @param string $destination : Phone number to send the sms to
|
* @param string $destination : Phone number to send the sms to
|
||||||
* @param string $text : Text of the SMS to send
|
* @param string $text : Text of the SMS to send
|
||||||
* @param bool $flash : Is the SMS a Flash SMS
|
* @param bool $flash : Is the SMS a Flash SMS
|
||||||
* @return bool : True if send, False else
|
* @return mixed Uid of the sended message if send, False else
|
||||||
*/
|
*/
|
||||||
public function send (string $destination, string $text, boolean $flash) : boolean
|
public function send (string $destination, string $text, boolean $flash) : mixed
|
||||||
{
|
{
|
||||||
return true;
|
return uniqid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,11 +66,11 @@
|
||||||
* @param string $destination : Phone number to send the sms to
|
* @param string $destination : Phone number to send the sms to
|
||||||
* @param string $text : Text of the SMS to send
|
* @param string $text : Text of the SMS to send
|
||||||
* @param bool $flash : Is the SMS a Flash SMS
|
* @param bool $flash : Is the SMS a Flash SMS
|
||||||
* @return bool : True if send, False else
|
* @return mixed Uid of the sended message if send, False else
|
||||||
*/
|
*/
|
||||||
public function send (string $destination, string $text, boolean $flash) : boolean
|
public function send (string $destination, string $text, boolean $flash) : mixed
|
||||||
{
|
{
|
||||||
return true;
|
return uniqid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,17 +31,21 @@ namespace controllers\internals;
|
||||||
* @param $text : Text of the message
|
* @param $text : Text of the message
|
||||||
* @param string $origin : Number of the sender
|
* @param string $origin : Number of the sender
|
||||||
* @param string $destination : Number of the receiver
|
* @param string $destination : Number of the receiver
|
||||||
|
* @param string $uid : Uid of the sms on the adapter service used
|
||||||
|
* @param string $adapter : Name of the adapter service used to send the message
|
||||||
* @param bool $flash : Is the sms a flash
|
* @param bool $flash : Is the sms a flash
|
||||||
* @param string $status : Status of a the sms. By default 'unknown'
|
* @param string $status : Status of a the sms. By default 'unknown'
|
||||||
* @return bool : false on error, new sended id else
|
* @return bool : false on error, new sended id else
|
||||||
*/
|
*/
|
||||||
public function create ($at, string $text, string $origin, string $destination, bool $flash = false, ?string $status = 'unknown') : bool
|
public function create ($at, string $text, string $origin, string $destination, string $uid, string $adapter, bool $flash = false, ?string $status = 'unknown') : bool
|
||||||
{
|
{
|
||||||
$sended = [
|
$sended = [
|
||||||
'at' => $at,
|
'at' => $at,
|
||||||
'text' => $text,
|
'text' => $text,
|
||||||
'origin' => $origin,
|
'origin' => $origin,
|
||||||
'destination' => $destination,
|
'destination' => $destination,
|
||||||
|
'uid' => $uid,
|
||||||
|
'adapter' => $adapter,
|
||||||
'flash' => $flash,
|
'flash' => $flash,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
];
|
];
|
||||||
|
@ -58,17 +62,21 @@ namespace controllers\internals;
|
||||||
* @param $text : Text of the message
|
* @param $text : Text of the message
|
||||||
* @param string $origin : Number of the sender
|
* @param string $origin : Number of the sender
|
||||||
* @param string $destination : Number of the receiver
|
* @param string $destination : Number of the receiver
|
||||||
|
* @param string $uid : Uid of the sms on the adapter service used
|
||||||
|
* @param string $adapter : Name of the adapter service used to send the message
|
||||||
* @param bool $flash : Is the sms a flash
|
* @param bool $flash : Is the sms a flash
|
||||||
* @param ?string $status : Status of a the sms. By default null -> unknown
|
* @param ?string $status : Status of a the sms. By default null -> unknown
|
||||||
* @return bool : false on error, true on success
|
* @return bool : false on error, true on success
|
||||||
*/
|
*/
|
||||||
public function update_for_user (int $id_user, int $id_sended, $at, string $text, string $origin, string $destination, bool $flash = false, ?string $status = null) : bool
|
public function update_for_user (int $id_user, int $id_sended, $at, string $text, string $origin, string $destination, string $uid, string $adapter, bool $flash = false, ?string $status = null) : bool
|
||||||
{
|
{
|
||||||
$sended = [
|
$sended = [
|
||||||
'at' => $at,
|
'at' => $at,
|
||||||
'text' => $text,
|
'text' => $text,
|
||||||
'origin' => $origin,
|
'origin' => $origin,
|
||||||
'destination' => $destination,
|
'destination' => $destination,
|
||||||
|
'uid' => $uid,
|
||||||
|
'adapter' => $adapter,
|
||||||
'flash' => $flash,
|
'flash' => $flash,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
];
|
];
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
class AddSenderAndUidForSended extends AbstractMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Change Method.
|
||||||
|
*
|
||||||
|
* Write your reversible migrations using this method.
|
||||||
|
*
|
||||||
|
* More information on writing migrations is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||||
|
*
|
||||||
|
* The following commands can be used in this method and Phinx will
|
||||||
|
* automatically reverse them when rolling back:
|
||||||
|
*
|
||||||
|
* createTable
|
||||||
|
* renameTable
|
||||||
|
* addColumn
|
||||||
|
* addCustomColumn
|
||||||
|
* renameColumn
|
||||||
|
* addIndex
|
||||||
|
* addForeignKey
|
||||||
|
*
|
||||||
|
* Any other destructive changes will result in an error when trying to
|
||||||
|
* rollback the migration.
|
||||||
|
*
|
||||||
|
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||||
|
* with the Table class.
|
||||||
|
*/
|
||||||
|
public function change()
|
||||||
|
{
|
||||||
|
|
||||||
|
$table = $this->table('sended');
|
||||||
|
$table->addColumn('uid', 'string', ['limit' => 500])
|
||||||
|
->addColumn('adapter', 'string', ['limit' => 50])
|
||||||
|
->update();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue