set event in progress on api

This commit is contained in:
marcos 2020-06-02 17:26:43 +02:00
parent 6cf96a0fad
commit 7676852bd0
1 changed files with 46 additions and 0 deletions

View File

@ -16021,3 +16021,49 @@ function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType)
return;
}
}
/**
* Function to set events in progress status.
*
* @param [int] $event_id Id event (Node or Meta).
* @param [int] $server_id Id node event in tmetaconsole_event.
* @param [string] $trash2 don't use.
* @param [string] $returnType
*
* Example
* http://172.17.0.1/pandora_console/include/api.php?op=set&op2=event_in_progress&return_type=json&id=0&id2=0&apipass=1234&user=admin&pass=pandora
*
* @return void
*/
function api_set_event_in_progress($event_id, $server_id, $trash2, $returnType)
{
global $config;
if (is_metaconsole()) {
$event = db_process_sql_update(
'tmetaconsole_event',
['estado' => 2],
[
'id_source_event' => $event_id,
'server_id' => $server_id,
]
);
if ($event !== false) {
returnData($returnType, ['type' => 'string', 'data' => $event]);
} else {
returnError('id_not_found', 'string');
}
} else {
$event = db_process_sql_update(
'tevento',
['estado' => 2],
['id_evento' => $event_id]
);
if ($event !== false) {
returnData($returnType, ['type' => 'string', 'data' => $event]);
} else {
returnError('id_not_found', 'string');
}
}
}