This commit is contained in:
2025-12-10 01:59:50 +00:00
parent 9577e94c4f
commit ea2b1ad180
7 changed files with 565 additions and 391 deletions

25
php/newpower.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
require_once __DIR__ . '/common.php';
header('Content-Type: application/json');
$dbconn = get_db_connection();
try {
$query = "SELECT lat, lon, outagen FROM newpower WHERE active = true AND cwa = 'RLX'";
$result = pg_query($dbconn, $query);
if ($result === false) {
throw new Exception('Query failed: ' . pg_last_error());
}
$data = pg_fetch_all($result) ?: [];
echo json_encode($data);
pg_free_result($result);
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
} finally {
pg_close($dbconn);
}
?>