commit ae62086e3246cc7832b17095e4b7affd0cc84e3c
parent 546b6cca49706ba0a9634bac68f3bb35f039ff58
Author: LennartSchroot <[email protected]>
Date: Mon, 3 Jul 2023 13:48:55 +0200
api update
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/apii/api.php b/apii/api.php
@@ -43,13 +43,13 @@ function api(string $token, string $since, $type):string{
return '';
}
if ($type == "windchill") {
- if (check_request($token, 15)) {
+ if (check_request($token, 0)) {
return json_windchill($result);
} else {
return '';
}
}elseif ($type == "graph") {
- if (check_request($token, 1440)) {
+ if (check_request($token, 0)) {
return json_graph($result);
} else {
return '';
@@ -61,7 +61,7 @@ function api(string $token, string $since, $type):string{
function query($token, $since){
$db = new mysqli("86.92.67.21", "friedel", "hailiwa", "wap2");
$weather_data = [];
- $query = " SELECT distinct temperature, wind_speed, dew_point, date_time, DATE(date_time) as date, nl.name as city, co.country as country
+ $query = " SELECT distinct data_id, temperature, wind_speed, dew_point, date_time, DATE(date_time) as date, nl.name as city, co.country as country
FROM weather_data wd
JOIN station s ON wd.station_name = s.name
JOIN contract_station cs ON cs.station_name = s.name
@@ -110,6 +110,7 @@ function json_windchill($result):string{
while ($row = $result->fetch_assoc()) {
$wind_chill = windchill($row["temperature"], $row["wind_speed"]);
$weather_data[] = [
+ 'data_id' => $row['data_id'],
'city' => $row['city'],
'country' => $row['country'],
'date' => $row['date'],
@@ -123,6 +124,7 @@ function json_graph($result):string{
while ($row = $result->fetch_assoc()) {
$humid = humid($row['temperature'], $row['dew_point']);
$weather_data[] = [
+ 'data_id' => $row['data_id'],
'city' => $row['city'],
'date_time' => $row['date_time'],
'humidity' => $humid