forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1004 B
39 lines
1004 B
2 years ago
|
<?php
|
||
|
|
||
|
namespace app\Middleware;
|
||
|
|
||
|
use app\Interfaces\IApi;
|
||
|
|
||
|
|
||
|
class ApiInfo implements IApi
|
||
|
{
|
||
|
function router($rota, $request)
|
||
|
{
|
||
|
$this->showConf();
|
||
|
}
|
||
|
function retorno($mensagem, $status = null, $dados = null)
|
||
|
{
|
||
|
//{ "status": "success", "message": "register created!", "data": [ "id": 20 ] }
|
||
|
$data = [];
|
||
|
$data['message'] = utf8_encode($mensagem);
|
||
|
|
||
|
if (!empty($status)) {
|
||
|
$data['status'] = "success";
|
||
|
} else {
|
||
|
$data['status'] = "error";
|
||
|
}
|
||
|
if (!empty($dados)) {
|
||
|
$data['data'] = $dados;
|
||
|
}
|
||
|
echo json_encode($data);
|
||
|
}
|
||
|
|
||
|
function showConf()
|
||
|
{
|
||
|
$dados['version_system'] = INFO_VERSION_SYSTEM;
|
||
|
$dados['conf_db_host'] = CONF_DB_HOST;
|
||
|
$dados['conf_db_port'] = CONF_DB_PORT;
|
||
|
$dados['conf_middleware_redirect'] = CONF_MIDDLEWARE_REDIRECT;
|
||
|
$this->retorno('Sucesso', "success", [$dados]);
|
||
|
}
|
||
|
}
|