You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
925 B
PHTML
21 lines
925 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
include('config.inc.php');
|
||
|
|
||
|
$ts = time();
|
||
|
$startTime = isset($_GET['st']) ? intval($_GET['st']) : ($ts - 86400 * 7);
|
||
|
$endTime = isset($_GET['et']) ? intval($_GET['et']) : $ts;
|
||
|
|
||
|
$db = new PDO('mysql:host=' . $config['host'] . ';dbname=' . $config['database'], $config['dbuser'], $config['password'], [
|
||
|
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
|
||
|
\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8mb4'"
|
||
|
]);
|
||
|
// $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE , PDO::FETCH_ASSOC );
|
||
|
$termId = intval($_GET['termid']);
|
||
|
|
||
|
$stmt = $db->query("SELECT term_id,cmdid,version,bs_id,FROM_UNIXTIME(update_time) AS update_time FROM terminal_basic_info_history WHERE term_id=" . $termId . " AND update_time BETWEEN " . $startTime . " AND " . $endTime . " ORDER BY update_time desc");
|
||
|
$rows = $stmt->fetchAll();
|
||
|
|
||
|
header ('Content-type: application/json; charset=utf-8');
|
||
|
echo json_encode($rows, JSON_UNESCAPED_UNICODE);
|