upd: api.message (DELETE message/emergency)
This commit is contained in:
parent
2da458ad31
commit
c521cb6c66
|
@ -89,19 +89,31 @@ class message
|
||||||
public function DELETE_emergency($argv){
|
public function DELETE_emergency($argv){
|
||||||
extract($argv);
|
extract($argv);
|
||||||
|
|
||||||
|
/* (1) Create emergenct
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
/* (1) Try to create entry */
|
||||||
|
$deleted = Repo::request('emergency', 'remove', $id);
|
||||||
|
|
||||||
|
/* (2) If cannot create -> dispatch error */
|
||||||
|
if( $deleted === false )
|
||||||
|
return ['error' => new Error(Err::RepoError)];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (2) Send to WebSocket
|
||||||
|
---------------------------------------------------------*/
|
||||||
$wsi = new wsinterop("localhost",9998);
|
$wsi = new wsinterop("localhost",9998);
|
||||||
|
|
||||||
$wsi->send([
|
$wsi->send([
|
||||||
"operation" => "DelMessage",
|
'operation' => 'DelMessage',
|
||||||
"id" => $id,
|
'id' => $id,
|
||||||
"channelType" => "Emergency",
|
'channelType' => 'Emergency',
|
||||||
"channelName" => is_null($URL_0) ? "" : "$URL_0"
|
'channelName' => "$URL_0"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$wsi->close();
|
$wsi->close();
|
||||||
|
|
||||||
return ["sent" => true];
|
return ["deleted" => true];
|
||||||
//TODO: tout poster dans la BDD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function PUT_emergency($argv){
|
public function PUT_emergency($argv){
|
||||||
|
|
Loading…
Reference in New Issue