Новые роуты API для статистики и мониторинга

- /api/version
- /api/health
- /api/stats
This commit is contained in:
2025-11-01 00:58:25 +08:00
parent c75da39b87
commit b5d3b60356
4 changed files with 162 additions and 84 deletions

View File

@@ -49,8 +49,9 @@ class BasicController
* @param array $data
* @return ResponseInterface
*/
protected function responseJson(ResponseInterface $response, int $status, array $data): ResponseInterface
protected function responseJson(ResponseInterface $response, int $status, mixed $data): ResponseInterface
{
is_scalar($data) && $data = [$data];
$data = array_merge(['timestamp' => time()], $data);
$json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);