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.
29 lines
939 B
PHP
29 lines
939 B
PHP
<?php
|
|
|
|
include('config.inc.php');
|
|
|
|
$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 );
|
|
|
|
|
|
|
|
$terminals = array();
|
|
|
|
$ts = time();
|
|
|
|
$result = array('res' => 0, 'data' => array());
|
|
|
|
$startTime = isset($_GET['st']) ? intval($_GET['st']) : ($ts - 86400);
|
|
$endTime = isset($_GET['et']) ? intval($_GET['et']) : $ts;
|
|
|
|
$stmt = $db->prepare("SELECT t1.`id`,t1.`name`,t2.`name` AS vname FROM `lines` AS t1 JOIN dy_level AS t2 ON t1.`dy_level_id`=t2.`id` WHERE t1.`status`=1 AND t2.`status`=1 ORDER BY t2.`id`,t1.`id`");
|
|
$stmt->execute();
|
|
$rows = $stmt->fetchAll();
|
|
$stmt = null;
|
|
|
|
header ('Content-type: application/json; charset=utf-8');
|
|
echo json_encode($rows, JSON_UNESCAPED_UNICODE);
|