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.
32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
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 );
|
|
|
|
$term_id = intval($_GET['term_id']);
|
|
$st = intval($_GET['st']);
|
|
$et = intval($_GET['et']);
|
|
$channel = isset($_GET['channel']) ? intval($_GET['channel']) : 0;
|
|
|
|
$result = array('res' => 0, 'data' => array());
|
|
$channelCond = '';
|
|
if ($channel > 0)
|
|
{
|
|
$channelCond = ' AND channel_id=' . $channel;
|
|
}
|
|
$sql = "SELECT id,orginal_id,channel_id,preset_id,media_type, FROM_UNIXTIME(photo_time) AS photo_time,`path`,`thumb`,FROM_UNIXTIME(`recv_time`) AS recv_time " .
|
|
"FROM terminal_photos WHERE term_id=" . $term_id . " AND photo_time BETWEEN " . $st . " AND " . $et . $channelCond . " AND media_type<>2 ORDER BY photo_time DESC";
|
|
|
|
$stmt = $db->prepare($sql);
|
|
$stmt->execute();
|
|
$rows = $stmt->fetchAll();
|
|
|
|
|
|
header ('Content-type: application/json; charset=utf-8');
|
|
echo json_encode($rows, JSON_UNESCAPED_UNICODE);
|