upd: api.message (DELETE message/emergency)

This commit is contained in:
xdrm-brackets 2017-12-08 04:17:30 +01:00
parent 512bd699de
commit 11761e16e2
1 changed files with 18 additions and 6 deletions

View File

@ -89,19 +89,31 @@ class message
public function DELETE_emergency($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->send([
"operation" => "DelMessage",
"id" => $id,
"channelType" => "Emergency",
"channelName" => is_null($URL_0) ? "" : "$URL_0"
'operation' => 'DelMessage',
'id' => $id,
'channelType' => 'Emergency',
'channelName' => "$URL_0"
]);
$wsi->close();
return ["sent" => true];
//TODO: tout poster dans la BDD
return ["deleted" => true];
}
public function PUT_emergency($argv){