-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrendengine.php
More file actions
35 lines (28 loc) · 1.04 KB
/
trendengine.php
File metadata and controls
35 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once "path.php";
require_once $path_settings."db_hd.php";
if($_GET["lazy"]&&$_GET["tank"]){
$tank = $_GET["tank"];
$q = "SELECT *,UNIX_TIMESTAMP(`datetime`)*1000 AS `utc` FROM `res".$tank."_hd` WHERE `datetime`>SUBDATE(NOW(),INTERVAL 3 DAY)";
$result = $mysql_res_hd->query($q);
$json = array();
$row = $result->fetch_assoc();
while($row){
array_push($json,$row);
$row = $result->fetch_assoc();
}
echo json_encode($json);
}
if(isset($_GET['coldstart'])){//холодный старт приложения
if(isset($_GET['tends']) && isset($_GET['tanktends'])){//тенденции
$q = "SELECT `mass`,UNIX_TIMESTAMP(`datetime`)*1000 AS `utc` FROM `res".$_GET['tanktends']."_hd` WHERE `datetime`>SUBDATE(NOW(),INTERVAL 1 HOUR)";
$result = $mysql_res_hd->query($q);
$json = array();
$row = $result->fetch_assoc();
while($row){
array_push($json,$row);
$row = $result->fetch_assoc();
}
echo json_encode($json);
}
}