更新脚本
parent
8bb9ce7c7d
commit
6b54267f7e
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
include('config.inc.php');
|
||||||
|
|
||||||
|
$result = array('code' => 0);
|
||||||
|
|
||||||
|
function OutputResult($res)
|
||||||
|
{
|
||||||
|
echo json_encode($res, JSON_UNESCAPED_UNICODE);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIPAddress()
|
||||||
|
{
|
||||||
|
//whether ip is from the share internet
|
||||||
|
if(!empty($_SERVER['HTTP_CLIENT_IP']))
|
||||||
|
{
|
||||||
|
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
|
}
|
||||||
|
//whether ip is from the proxy
|
||||||
|
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
|
||||||
|
{
|
||||||
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
}
|
||||||
|
//whether ip is from the remote address
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
}
|
||||||
|
return $ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$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'"
|
||||||
|
]);
|
||||||
|
|
||||||
|
header ('Content-type: application/json; charset=utf-8');
|
||||||
|
$request = ($_SERVER['REQUEST_METHOD'] == 'POST') ? $_POST : $_GET;
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO mntn_cmd_results(`cid`,`result`,`content`) VALUES(:cid,:result,:content)';
|
||||||
|
$stmt = $db->prepare($sql);
|
||||||
|
$stmt->execute(array('cid' => intval($request['cid']), 'result' => intval($request['res']), 'content' => empty($request['content']) ? '' : $request['content']));
|
||||||
|
|
||||||
|
OutputResult($result);
|
@ -0,0 +1,170 @@
|
|||||||
|
<?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'"
|
||||||
|
]);
|
||||||
|
|
||||||
|
$action = isset($_GET['act']) ? $_GET['act'] : '';
|
||||||
|
|
||||||
|
if ($action == 'q')
|
||||||
|
{
|
||||||
|
$cmdid = isset($_GET['cmdid']) ? $_GET['cmdid'] : '';
|
||||||
|
|
||||||
|
$result = array('code' => 0, 'data' => array());
|
||||||
|
|
||||||
|
if (isset($_GET['mntn']) && $_GET['mntn'] == 1)
|
||||||
|
{
|
||||||
|
$values['cmdName'] = 'upd_cfg';
|
||||||
|
|
||||||
|
$sql = "SELECT `id` FROM terminals WHERE cmdid=:cmdid LIMIT 1";
|
||||||
|
$stmt = $db->prepare($sql);
|
||||||
|
$stmt->execute(array('cmdid' => $cmdid));
|
||||||
|
$terminal = $stmt->fetch();
|
||||||
|
|
||||||
|
if ($terminal)
|
||||||
|
{
|
||||||
|
$termId = $terminal['id'];
|
||||||
|
$sql = "DELETE FROM mntn_cmds WHERE term_id=:termid AND `name`=:cmdName LIMIT 1";
|
||||||
|
$stmt1 = $db->prepare($sql);
|
||||||
|
|
||||||
|
$sql = "INSERT INTO mntn_cmds(term_id,`name`,`cmd`,`desc`) VALUES(:termId,:cmdName,:cmd,:cmdDesc)";
|
||||||
|
$stmt2 = $db->prepare($sql);
|
||||||
|
|
||||||
|
$path_parts = pathinfo($_GET['filename']);
|
||||||
|
|
||||||
|
$idx = 0;
|
||||||
|
$cmd = array();
|
||||||
|
$cmd['path'] = $path_parts['dirname'];
|
||||||
|
$cmd['fileName'] = $path_parts['basename'];
|
||||||
|
|
||||||
|
$configs = array();
|
||||||
|
foreach ($_GET['cfgName'] as $cfgName)
|
||||||
|
{
|
||||||
|
if (empty($cfgName))
|
||||||
|
{
|
||||||
|
$idx++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cfg = array();
|
||||||
|
|
||||||
|
$cfg['name'] = $cfgName;
|
||||||
|
$cfg['type'] = intval($_GET['cfgType'][$idx]);
|
||||||
|
if (strlen($_GET['cfgValue'][$idx]) == 0)
|
||||||
|
{
|
||||||
|
$cfg['value'] = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($cfg['type'] == 0)
|
||||||
|
{
|
||||||
|
$cfg['value'] = intval($_GET['cfgValue'][$idx]);
|
||||||
|
}
|
||||||
|
else if ($cfg['type'] == 1)
|
||||||
|
{
|
||||||
|
$cfg['value'] = strval($_GET['cfgValue'][$idx]);
|
||||||
|
}
|
||||||
|
else if ($cfg['type'] == 2)
|
||||||
|
{
|
||||||
|
$cfg['value'] = floatval($_GET['cfgValue'][$idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$configs[] = $cfg;
|
||||||
|
$idx++;
|
||||||
|
}
|
||||||
|
$cmd['configs'] = $configs;
|
||||||
|
if (!empty($_GET['packageName']))
|
||||||
|
{
|
||||||
|
$cmd['packageName'] = $_GET['packageName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = array('termId' => $termId, 'cmd' => json_encode($cmd), 'cmdDesc' => '修改配置', 'cmdName' => 'upd_cfg');
|
||||||
|
|
||||||
|
if (!empty($action))
|
||||||
|
{
|
||||||
|
$res = $stmt1->execute(array('termid' => $termId, 'cmdName' => $values['cmdName']));
|
||||||
|
if (!$res)
|
||||||
|
{
|
||||||
|
// print_r($stmt1->errorInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $stmt2->execute($values);
|
||||||
|
|
||||||
|
if (!$res)
|
||||||
|
{
|
||||||
|
// print_r($stmt2->errorInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($res)
|
||||||
|
{
|
||||||
|
$result['data'][] = $termId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "false";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// http://dev.xinyingpower.com:40101/web/api/queryCfg.php?act=q&filename=data%2Fchannels%2F1.json
|
||||||
|
$path = str_replace('com.xypower.mpapp/', '', $_GET['filename']);
|
||||||
|
$cmd = $config['xympadmn_path'] . ' --act=cfg --server=' . $config['cma_server'] . ' --port=' . $config['cma_port'] .' --cmdid="' . $cmdid . '" --pathType=1 --updateType=0 --path="' . $path . '"';
|
||||||
|
// --name1=osd.leftTop --type1=1 --value1="OSD for LeftTop %%CH%%" --name2=osd.rightTop --type2=255 --value2="OSD for rIGHTTop %%CH%%" --name3=usbCamera --type3=0 --value3=1 --clientid=5 --reqid=TS';
|
||||||
|
|
||||||
|
if (!apcu_exists('xympadmn.requestid'))
|
||||||
|
{
|
||||||
|
apcu_store('xympadmn.requestid', time());
|
||||||
|
}
|
||||||
|
|
||||||
|
$requestId = apcu_inc('xympadmn.requestid');
|
||||||
|
|
||||||
|
$cmd .= ' --clientid=' . $config['clientId'] . ' --reqid=' . $requestId;
|
||||||
|
header('Cmd:' . $cmd);
|
||||||
|
|
||||||
|
$result_code = 1;
|
||||||
|
$res = exec($cmd, $output, $result_code);
|
||||||
|
if ($res !== false && $result_code === 0)
|
||||||
|
{
|
||||||
|
$result['clientId'] = $config['clientId'];
|
||||||
|
$result['requestId'] = $requestId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result['code'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$clientId = intval($_GET['clientId']);
|
||||||
|
$requestId = intval($_GET['reqId']);
|
||||||
|
|
||||||
|
$sql = 'SELECT * FROM request_results WHERE client_id=:clientId AND request_id=:reqId';
|
||||||
|
|
||||||
|
$stmt = $db->prepare($sql);
|
||||||
|
$stmt->execute(array('clientId' => $clientId, 'reqId' => $requestId));
|
||||||
|
$row = $stmt->fetch();
|
||||||
|
|
||||||
|
if (isset($row['data']))
|
||||||
|
{
|
||||||
|
$row['data'] = json_decode($row['data'], true);
|
||||||
|
|
||||||
|
if (isset($row['data']['content']))
|
||||||
|
{
|
||||||
|
$row['data']['content'] = json_decode(base64_decode($row['data']['content']), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result['data'] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
header ('Access-Control-Allow-Origin: *');
|
||||||
|
header ('Content-type: application/json; charset=utf-8');
|
||||||
|
// $result['code'] = $res ? 0 : 1;
|
||||||
|
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|
@ -0,0 +1,178 @@
|
|||||||
|
<?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'"
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$action = isset($_POST['act']) ? $_POST['act'] : '';
|
||||||
|
$cmdid = isset($_POST['cmdid']) ? $_POST['cmdid'] : '';
|
||||||
|
|
||||||
|
$result = array('code' => 0, 'data' => array());
|
||||||
|
|
||||||
|
if (isset($_POST['mntn']) && $_POST['mntn'] == 1)
|
||||||
|
{
|
||||||
|
$values['cmdName'] = 'upd_cfg';
|
||||||
|
|
||||||
|
$sql = "SELECT `id` FROM terminals WHERE cmdid=:cmdid LIMIT 1";
|
||||||
|
$stmt = $db->prepare($sql);
|
||||||
|
$stmt->execute(array('cmdid' => $cmdid));
|
||||||
|
$terminal = $stmt->fetch();
|
||||||
|
|
||||||
|
if ($terminal)
|
||||||
|
{
|
||||||
|
$termId = $terminal['id'];
|
||||||
|
$sql = "DELETE FROM mntn_cmds WHERE term_id=:termid AND `name`=:cmdName LIMIT 1";
|
||||||
|
$stmt1 = $db->prepare($sql);
|
||||||
|
|
||||||
|
$sql = "INSERT INTO mntn_cmds(term_id,`name`,`cmd`,`desc`) VALUES(:termId,:cmdName,:cmd,:cmdDesc)";
|
||||||
|
$stmt2 = $db->prepare($sql);
|
||||||
|
|
||||||
|
$path_parts = pathinfo($_POST['filename']);
|
||||||
|
|
||||||
|
$idx = 0;
|
||||||
|
$cmd = array();
|
||||||
|
$cmd['path'] = $path_parts['dirname'];
|
||||||
|
$cmd['fileName'] = $path_parts['basename'];
|
||||||
|
|
||||||
|
$configs = array();
|
||||||
|
foreach ($_POST['cfgName'] as $cfgName)
|
||||||
|
{
|
||||||
|
if (empty($cfgName))
|
||||||
|
{
|
||||||
|
$idx++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cfg = array();
|
||||||
|
|
||||||
|
$cfg['name'] = $cfgName;
|
||||||
|
$cfg['type'] = intval($_POST['cfgType'][$idx]);
|
||||||
|
if (strlen($_POST['cfgValue'][$idx]) == 0)
|
||||||
|
{
|
||||||
|
$cfg['value'] = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($cfg['type'] == 0)
|
||||||
|
{
|
||||||
|
$cfg['value'] = intval($_POST['cfgValue'][$idx]);
|
||||||
|
}
|
||||||
|
else if ($cfg['type'] == 1)
|
||||||
|
{
|
||||||
|
$cfg['value'] = strval($_POST['cfgValue'][$idx]);
|
||||||
|
}
|
||||||
|
else if ($cfg['type'] == 2)
|
||||||
|
{
|
||||||
|
$cfg['value'] = floatval($_POST['cfgValue'][$idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$configs[] = $cfg;
|
||||||
|
$idx++;
|
||||||
|
}
|
||||||
|
$cmd['configs'] = $configs;
|
||||||
|
if (!empty($_POST['packageName']))
|
||||||
|
{
|
||||||
|
$cmd['packageName'] = $_POST['packageName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = array('termId' => $termId, 'cmd' => json_encode($cmd), 'cmdDesc' => '修改配置', 'cmdName' => 'upd_cfg');
|
||||||
|
|
||||||
|
if (!empty($action))
|
||||||
|
{
|
||||||
|
$res = $stmt1->execute(array('termid' => $termId, 'cmdName' => $values['cmdName']));
|
||||||
|
if (!$res)
|
||||||
|
{
|
||||||
|
// print_r($stmt1->errorInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $stmt2->execute($values);
|
||||||
|
|
||||||
|
if (!$res)
|
||||||
|
{
|
||||||
|
// print_r($stmt2->errorInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($res)
|
||||||
|
{
|
||||||
|
$result['data'][] = $termId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "false";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$path = str_replace('com.xypower.mpapp/', '', $_POST['filename']);
|
||||||
|
$cmd = $config['xympadmn_path'] . ' --act=cfg --server=' . $config['cma_server'] . ' --port=' . $config['cma_port'] .' --cmdid="' . $cmdid . '" --pathType=1 --updateType=0 --path="' . $path . '"';
|
||||||
|
// --name1=osd.leftTop --type1=1 --value1="OSD for LeftTop %%CH%%" --name2=osd.rightTop --type2=255 --value2="OSD for rIGHTTop %%CH%%" --name3=usbCamera --type3=0 --value3=1 --clientid=5 --reqid=TS';
|
||||||
|
|
||||||
|
if (!empty($_POST['packageName']))
|
||||||
|
{
|
||||||
|
$cmd .= ' --reboot=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!apcu_exists('xympadmn.requestid'))
|
||||||
|
{
|
||||||
|
apcu_store('xympadmn.requestid', time());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$requestId = apcu_inc('xympadmn.requestid');
|
||||||
|
|
||||||
|
$idx = 0;
|
||||||
|
$configs = '';
|
||||||
|
foreach ($_POST['cfgName'] as $cfgName)
|
||||||
|
{
|
||||||
|
if (empty($cfgName))
|
||||||
|
{
|
||||||
|
$idx++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cfgType = intval($_POST['cfgType'][$idx]);
|
||||||
|
|
||||||
|
$configs .= ' --name' . ($idx + 1) . '="' . $cfgName . '" --type' . ($idx + 1) . '=' . intval($_POST['cfgType'][$idx]) . ' --value' . ($idx + 1) . '=';
|
||||||
|
|
||||||
|
if ($cfgType == 0)
|
||||||
|
{
|
||||||
|
$configs .= intval($_POST['cfgValue'][$idx]);
|
||||||
|
}
|
||||||
|
else if ($cfgType == 1)
|
||||||
|
{
|
||||||
|
$configs .= '"' . strval($_POST['cfgValue'][$idx]) . '"';
|
||||||
|
}
|
||||||
|
else if ($cfgType == 2)
|
||||||
|
{
|
||||||
|
$configs .= floatval($_POST['cfgValue'][$idx]);
|
||||||
|
}
|
||||||
|
$idx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cmd .= ' --configs=' . $idx . $configs . ' --clientid=' . $config['clientId'] . ' --reqid=' . $requestId;
|
||||||
|
header('Cmd:' . $cmd);
|
||||||
|
|
||||||
|
$result_code = 1;
|
||||||
|
$res = exec($cmd, $output, $result_code);
|
||||||
|
if ($res !== false && $result_code === 0)
|
||||||
|
{
|
||||||
|
$result['clientId'] = 11;
|
||||||
|
$result['requestId'] = $requestId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result['code'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header ('Access-Control-Allow-Origin: *');
|
||||||
|
header ('Content-type: application/json; charset=utf-8');
|
||||||
|
// $result['code'] = $res ? 0 : 1;
|
||||||
|
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|
@ -0,0 +1,24 @@
|
|||||||
|
<?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'"
|
||||||
|
]);
|
||||||
|
|
||||||
|
$values['term_id'] = empty($_GET['id']) ? 0 : intval($_GET['id']);
|
||||||
|
$values['comment'] = empty($_GET['comment']) ? '' : $_GET['comment'];
|
||||||
|
|
||||||
|
$result = array('res' => 0, 'data' => array('id' => $values['term_id']));
|
||||||
|
|
||||||
|
$sql = "UPDATE mntn_status SET `comment`=:comment WHERE `term_id`=:term_id";
|
||||||
|
$stmt = $db->prepare($sql);
|
||||||
|
if (!$stmt->execute($values))
|
||||||
|
{
|
||||||
|
$result['res'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
header ('Access-Control-Allow-Origin: *');
|
||||||
|
header ('Content-type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|
@ -0,0 +1,42 @@
|
|||||||
|
<?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'"
|
||||||
|
]);
|
||||||
|
|
||||||
|
$result = array('res' => 0, 'data' => array());
|
||||||
|
|
||||||
|
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
|
||||||
|
$action = empty($_GET['act']) ? '' : $_GET['act'];
|
||||||
|
|
||||||
|
if ($action == 'del')
|
||||||
|
{
|
||||||
|
$values = array('id' => $id);
|
||||||
|
$sql = "SELECT `id`,`path` FROM mntn_uploads WHERE `id`=:id";
|
||||||
|
$stmt = $db->prepare($sql);
|
||||||
|
$stmt->execute($values);
|
||||||
|
|
||||||
|
$rows = $stmt->fetchAll();
|
||||||
|
$stmt = null;
|
||||||
|
|
||||||
|
$sql = "DELETE FROM mntn_uploads WHERE `id`=:id LIMIT 1";
|
||||||
|
$stmt = $db->prepare($sql);
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$dest = $config['term_logs_root'] . $row['path'];
|
||||||
|
if (unlink($dest))
|
||||||
|
{
|
||||||
|
$stmt->execute(array('id' => $row['id']));
|
||||||
|
$result['data'][] = $row['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
header ('Access-Control-Allow-Origin: *');
|
||||||
|
header ('Content-type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|
@ -0,0 +1,77 @@
|
|||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>APP配置设置</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
||||||
|
<script language="javascript" type="text/javascript" src="js/jquery-3.7.1.min.js"></script>
|
||||||
|
<script
|
||||||
|
language="javascript"
|
||||||
|
type="text/javascript"
|
||||||
|
src="js/jquery.cookie.js"
|
||||||
|
></script>
|
||||||
|
<script language="javascript" type="text/javascript" src="js/common.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<form action="../api/updCfg.php" method="post" >
|
||||||
|
<div class="item">
|
||||||
|
<label for="cmdid">装置编号</label></label>
|
||||||
|
<input name="cmdid" type="text">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="item">
|
||||||
|
<label for="cfgName">通讯规约 </label></label>
|
||||||
|
<input name="cfgName[]" type="hidden" value="protocol">
|
||||||
|
<input name="cfgType[]" type="hidden" value="0">
|
||||||
|
<select name="cfgValue[]">
|
||||||
|
<option value="65281">65281-安徽</option>
|
||||||
|
<option value="65282">65282-江苏</option>
|
||||||
|
<option value="65283">65283-湖南</option>
|
||||||
|
<option value="65284">65284-浙江</option>
|
||||||
|
<option value="65285">65285-河南</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<label for="cfgName">网络协议 </label></label>
|
||||||
|
<input name="cfgName[]" type="hidden" value="networProtocol">
|
||||||
|
<input name="cfgType[]" type="hidden" value="0">
|
||||||
|
<select name="cfgValue[]">
|
||||||
|
<option value="0">TCP</option>
|
||||||
|
<option value="1">UDP</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<label for="cfgName">分包大小 </label></label>
|
||||||
|
<input name="cfgName[]" type="hidden" value="packageSize">
|
||||||
|
<input name="cfgType[]" type="hidden" value="0">
|
||||||
|
<input name="cfgValue[]" type="text">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div id="dlBtn" class="btn">
|
||||||
|
<input id="" type="submit" value="确认" />
|
||||||
|
<input name="act" type="hidden" value="upd_cfg">
|
||||||
|
<input name="packageName" type="hidden" value="com.xypower.mpapp">
|
||||||
|
<input name="filename" type="hidden" value="com.xypower.mpapp/data/App.json">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function clickFileName(name) {
|
||||||
|
$('#filename').val('com.xypower.mpapp/data/' + name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//判断是否敲击了Enter键
|
||||||
|
$(document).keyup(function(event){
|
||||||
|
if(event.keyCode ==13){
|
||||||
|
$("#dlBtn").trigger("click");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
@ -0,0 +1,66 @@
|
|||||||
|
<!--
|
||||||
|
function ConvertProtocolName(p)
|
||||||
|
{
|
||||||
|
if (p == 0)
|
||||||
|
{
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF00)
|
||||||
|
{
|
||||||
|
return "I1";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF01)
|
||||||
|
{
|
||||||
|
return "安徽";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF02)
|
||||||
|
{
|
||||||
|
return "江苏";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF03)
|
||||||
|
{
|
||||||
|
return "湖南";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF04)
|
||||||
|
{
|
||||||
|
return "浙江";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF05)
|
||||||
|
{
|
||||||
|
return "河南";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF06)
|
||||||
|
{
|
||||||
|
return "郑州";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF10)
|
||||||
|
{
|
||||||
|
return "陕西";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUrlParameter(name)
|
||||||
|
{
|
||||||
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
||||||
|
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
||||||
|
var results = regex.exec(location.search);
|
||||||
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
function AppendTable(table)
|
||||||
|
{
|
||||||
|
if (arguments.length <= 1) return false;
|
||||||
|
|
||||||
|
var tr = table.insertRow(-1);
|
||||||
|
for (idx = 1; idx < arguments.length; idx++)
|
||||||
|
{
|
||||||
|
var td = tr.insertCell(-1);
|
||||||
|
td.innerHTML = arguments[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
return tr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-->
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,114 @@
|
|||||||
|
/*!
|
||||||
|
* jQuery Cookie Plugin v1.4.1
|
||||||
|
* https://github.com/carhartl/jquery-cookie
|
||||||
|
*
|
||||||
|
* Copyright 2006, 2014 Klaus Hartl
|
||||||
|
* Released under the MIT license
|
||||||
|
*/
|
||||||
|
(function (factory) {
|
||||||
|
if (typeof define === "function" && define.amd) {
|
||||||
|
// AMD (Register as an anonymous module)
|
||||||
|
define(["jquery"], factory);
|
||||||
|
} else if (typeof exports === "object") {
|
||||||
|
// Node/CommonJS
|
||||||
|
module.exports = factory(require("jquery"));
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
factory(jQuery);
|
||||||
|
}
|
||||||
|
})(function ($) {
|
||||||
|
var pluses = /\+/g;
|
||||||
|
|
||||||
|
function encode(s) {
|
||||||
|
return config.raw ? s : encodeURIComponent(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
function decode(s) {
|
||||||
|
return config.raw ? s : decodeURIComponent(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stringifyCookieValue(value) {
|
||||||
|
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseCookieValue(s) {
|
||||||
|
if (s.indexOf('"') === 0) {
|
||||||
|
// This is a quoted cookie as according to RFC2068, unescape...
|
||||||
|
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Replace server-side written pluses with spaces.
|
||||||
|
// If we can't decode the cookie, ignore it, it's unusable.
|
||||||
|
// If we can't parse the cookie, ignore it, it's unusable.
|
||||||
|
s = decodeURIComponent(s.replace(pluses, " "));
|
||||||
|
return config.json ? JSON.parse(s) : s;
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function read(s, converter) {
|
||||||
|
var value = config.raw ? s : parseCookieValue(s);
|
||||||
|
return $.isFunction(converter) ? converter(value) : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
var config = ($.cookie = function (key, value, options) {
|
||||||
|
// Write
|
||||||
|
|
||||||
|
if (arguments.length > 1 && !$.isFunction(value)) {
|
||||||
|
options = $.extend({}, config.defaults, options);
|
||||||
|
|
||||||
|
if (typeof options.expires === "number") {
|
||||||
|
var days = options.expires,
|
||||||
|
t = (options.expires = new Date());
|
||||||
|
t.setMilliseconds(t.getMilliseconds() + days * 864e5);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (document.cookie = [
|
||||||
|
encode(key),
|
||||||
|
"=",
|
||||||
|
stringifyCookieValue(value),
|
||||||
|
options.expires ? "; expires=" + options.expires.toUTCString() : "", // use expires attribute, max-age is not supported by IE
|
||||||
|
options.path ? "; path=" + options.path : "",
|
||||||
|
options.domain ? "; domain=" + options.domain : "",
|
||||||
|
options.secure ? "; secure" : "",
|
||||||
|
].join(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read
|
||||||
|
|
||||||
|
var result = key ? undefined : {},
|
||||||
|
// To prevent the for loop in the first place assign an empty array
|
||||||
|
// in case there are no cookies at all. Also prevents odd result when
|
||||||
|
// calling $.cookie().
|
||||||
|
cookies = document.cookie ? document.cookie.split("; ") : [],
|
||||||
|
i = 0,
|
||||||
|
l = cookies.length;
|
||||||
|
|
||||||
|
for (; i < l; i++) {
|
||||||
|
var parts = cookies[i].split("="),
|
||||||
|
name = decode(parts.shift()),
|
||||||
|
cookie = parts.join("=");
|
||||||
|
|
||||||
|
if (key === name) {
|
||||||
|
// If second argument (value) is a function it's a converter...
|
||||||
|
result = read(cookie, value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent storing a cookie that we couldn't decode.
|
||||||
|
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||||
|
result[name] = cookie;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
config.defaults = {};
|
||||||
|
|
||||||
|
$.removeCookie = function (key, options) {
|
||||||
|
// Must not alter options, thus extending a fresh object...
|
||||||
|
$.cookie(key, "", $.extend({}, options, { expires: -1 }));
|
||||||
|
return !$.cookie(key);
|
||||||
|
};
|
||||||
|
});
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,248 @@
|
|||||||
|
A {
|
||||||
|
font-size: 9pt;
|
||||||
|
line-height: 150%;
|
||||||
|
}
|
||||||
|
|
||||||
|
A:link {
|
||||||
|
color: midnightblue;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
A:visited {
|
||||||
|
color: midnightblue;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
A:hover {
|
||||||
|
color: red; /*#6600CC;*/
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
BODY {
|
||||||
|
font-family: tahoma, sans-serif;
|
||||||
|
font-size: 9pt;
|
||||||
|
background-color: white;
|
||||||
|
/*margin: 2 2 0 0;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
DIV {
|
||||||
|
font-family: tahoma, sans-serif;
|
||||||
|
font-size: 9pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
TABLE {
|
||||||
|
font-family: tahoma, sans-serif;
|
||||||
|
font-size: 9pt;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
font-family: tahoma, sans-serif;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 9pt;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
TD {
|
||||||
|
font-family: tahoma, sans-serif;
|
||||||
|
font-size: 9pt;
|
||||||
|
color: black;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 9pt;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
TR.title {
|
||||||
|
height: 28px;
|
||||||
|
background-image: url(images/table_title_bg.gif);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
background-color: #d3dce3;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
TR.light {
|
||||||
|
background-color: #cee9e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
TR.green TD {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.thinborder {
|
||||||
|
border-top: 1px solid #dcdcdc;
|
||||||
|
border-left: 1px solid #dcdcdc;
|
||||||
|
border-right: 0px;
|
||||||
|
border-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thinborder TD,
|
||||||
|
.thinborder TH {
|
||||||
|
border-top: 1px solid #ffffff;
|
||||||
|
border-left: 1px solid #ffffff;
|
||||||
|
border-right: 1px solid #dcdcdc;
|
||||||
|
border-bottom: 1px solid #dcdcdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
MARQUEE {
|
||||||
|
font-size: 9pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.fixedheader {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.fixedheader thead {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.fixedheader thead {
|
||||||
|
background-color: #dcdcdc;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.fixedheader thead tr th {
|
||||||
|
background-color: #dcdcdc;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thinborder.fixedheader TH {
|
||||||
|
border-top: 1px solid #ffffff;
|
||||||
|
border-left: 1px solid #ffffff;
|
||||||
|
border-right: 1px solid #dcdcdc;
|
||||||
|
border-bottom: 1px solid #dcdcdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
TD.merged {
|
||||||
|
background-color: #add8e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
TD.merged-dark {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-size: 9pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submenu {
|
||||||
|
left: 0;
|
||||||
|
background-color: #c0c0c0;
|
||||||
|
position: absolute;
|
||||||
|
text-align: left;
|
||||||
|
padding: 12px;
|
||||||
|
/*border-style: solid solid solid none;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mntn-detail {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hid-area {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-area {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sent {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.in_maintain,
|
||||||
|
td.in_maintain {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.in_maintain {
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.online-hb {
|
||||||
|
color: #67c23a;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offline-hb {
|
||||||
|
color: #f56c6c;
|
||||||
|
}
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.headBox {
|
||||||
|
width: 100%;
|
||||||
|
height: 48px;
|
||||||
|
line-height: 48px;
|
||||||
|
background: linear-gradient(#141e30, #243b55);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.headBox h3 {
|
||||||
|
padding-left: 32px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.headBox .userInfo {
|
||||||
|
padding-right: 32px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.headBox .userInfo .user-avator img {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 28px;
|
||||||
|
}
|
||||||
|
.downRow {
|
||||||
|
margin-left: 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.headBox .userInfo .nameInfo {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
.logOut {
|
||||||
|
width: 100%;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
background: linear-gradient(#141e30, #243b55);
|
||||||
|
font-size: 14px;
|
||||||
|
color: #fff;
|
||||||
|
position: absolute;
|
||||||
|
top: 48px;
|
||||||
|
z-index: 999999;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.logOut:hover {
|
||||||
|
background: #000;
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,71 @@
|
|||||||
|
<?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 );
|
||||||
|
|
||||||
|
$result = array('res' => 0, 'data' => array());
|
||||||
|
$action = isset($_GET['act']) ? $_GET['act'] : '';
|
||||||
|
$lineId = isset($_GET['lineId']) ? intval($_GET['lineId']) : 0;
|
||||||
|
|
||||||
|
$ts = time() - 86400 * 30;
|
||||||
|
$sql = 'SELECT t1.`id`, t1.cmdid,t1.`display_name`,t1.`protocol`,t2.`name` AS tower_name,t3.`name` AS line_name FROM terminals AS t1 JOIN towers AS t2 ON t1.tower_id=t2.id JOIN `lines` AS t3 ON t2.line_id=t3.id';
|
||||||
|
if ($lineId != 0)
|
||||||
|
{
|
||||||
|
$sql .= ' WHERE t2.line_id=' . $lineId;
|
||||||
|
}
|
||||||
|
$stmt = $db->query($sql);
|
||||||
|
$terminals = $stmt->fetchAll();
|
||||||
|
|
||||||
|
$sql = 'SELECT term_id,battery_voltage,battery_capacity,FROM_UNIXTIME(ws_update_time) AS ws_update_time FROM terminal_working_status_history WHERE term_id=:term_id AND ws_update_time>=' . $ts . ' ORDER BY ws_update_time';
|
||||||
|
header('SQL: ' . $sql);
|
||||||
|
$stmt = $db->prepare($sql);
|
||||||
|
|
||||||
|
$values['term_id'] = 0;
|
||||||
|
foreach ($terminals as &$terminal)
|
||||||
|
{
|
||||||
|
|
||||||
|
$terminal['records'] = 0;
|
||||||
|
$terminal['bc'] = '';
|
||||||
|
$terminal['bcTime'] = '';
|
||||||
|
$terminal['bv'] = '';
|
||||||
|
$terminal['bvTime'] = '';
|
||||||
|
$terminal['validBv'] = 0;
|
||||||
|
$terminal['lowBv'] = 0;
|
||||||
|
$terminal['validBc'] = 0;
|
||||||
|
|
||||||
|
$values['term_id'] = $terminal['id'];
|
||||||
|
$stmt->execute($values);
|
||||||
|
$rows = $stmt->fetchAll();
|
||||||
|
|
||||||
|
foreach ($rows as &$row)
|
||||||
|
{
|
||||||
|
$terminal['records'] += 1;
|
||||||
|
if ($row['battery_voltage'] > 0)
|
||||||
|
{
|
||||||
|
$terminal['bv'] = $row['battery_voltage'];
|
||||||
|
$terminal['bvTime'] = $row['ws_update_time'];
|
||||||
|
$terminal['validBv'] += 1;
|
||||||
|
if ($row['battery_voltage'] < 13)
|
||||||
|
{
|
||||||
|
$terminal['lowBv'] += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row['battery_capacity'] > 0)
|
||||||
|
{
|
||||||
|
$terminal['bc'] = $row['battery_capacity'];
|
||||||
|
$terminal['bcTime'] = $row['ws_update_time'];
|
||||||
|
$terminal['validBc'] += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$result['data'] = $terminals;
|
||||||
|
header ('Content-type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|
@ -0,0 +1,201 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>电源状态统计</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<link href="styles/style.css" rel="stylesheet" type="text/css">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||||
|
<script language="javascript" type="text/javascript" src="js/jquery.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<table border=0 borderColorLight="#99ccff" borderColorDark="#FFFFFF" cellpadding=4 cellspacing=0 width="100%">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<select id="lines">
|
||||||
|
<option value="0"> 全部线路 </option> <span id="term-cnt"></span>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span id="rpt-date"></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
<div id="div-result">
|
||||||
|
<table id="tbl-result" border="1" borderColorLight="#99ccff" borderColorDark="#FFFFFF" cellpadding="4" cellspacing="0" class="fixedheader thinborder">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th rowspan="2">序号</th>
|
||||||
|
<th rowspan="2">Id</th>
|
||||||
|
<th rowspan="2">线路</th>
|
||||||
|
<th rowspan="2">杆塔</th>
|
||||||
|
<th rowspan="2">装置名称</th>
|
||||||
|
<th colspan="2">最新有效电压</th>
|
||||||
|
<th rowspan="2">有效电压数量</th>
|
||||||
|
<th rowspan="2">有效低电压数量</th>
|
||||||
|
<th colspan="2">最新有效电量</th>
|
||||||
|
<th rowspan="2">详情</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>电压值</th>
|
||||||
|
<th>上报时间</th>
|
||||||
|
<th>电量值</th>
|
||||||
|
<th>上报时间</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody-result">
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
</body>
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
|
||||||
|
$('#btn-refresh').click(function() {
|
||||||
|
|
||||||
|
loadData();
|
||||||
|
});
|
||||||
|
|
||||||
|
function ConvertProtocolName(p)
|
||||||
|
{
|
||||||
|
if (p == 0)
|
||||||
|
{
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
else if (p == 2)
|
||||||
|
{
|
||||||
|
return "南网";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF00)
|
||||||
|
{
|
||||||
|
return "I1";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF01)
|
||||||
|
{
|
||||||
|
return "安徽";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF02)
|
||||||
|
{
|
||||||
|
return "江苏";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF03)
|
||||||
|
{
|
||||||
|
return "湖南";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF04)
|
||||||
|
{
|
||||||
|
return "浙江";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF05)
|
||||||
|
{
|
||||||
|
return "河南";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF06)
|
||||||
|
{
|
||||||
|
return "郑州";
|
||||||
|
}
|
||||||
|
else if (p == 0xFF10)
|
||||||
|
{
|
||||||
|
return "陕西";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadData() {
|
||||||
|
|
||||||
|
var line_id = $("#lines").val();
|
||||||
|
|
||||||
|
var tableResult = $('#tbody-result')[0];
|
||||||
|
while (tableResult.rows.length > 0)
|
||||||
|
{
|
||||||
|
tableResult.deleteRow(tableResult.rows.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#term-cnt').text();
|
||||||
|
|
||||||
|
var urlTarget = '/rpts/api/queryPs.php';
|
||||||
|
var params = {'act': 'list', 'lineId': line_id};
|
||||||
|
|
||||||
|
$.getJSON(urlTarget, params, function(result) {
|
||||||
|
|
||||||
|
$('#term-cnt').text("装置数量:" + result.data.length);
|
||||||
|
var tableResult = $('#tbody-result')[0];
|
||||||
|
|
||||||
|
for (var idx = 0; idx < result.data.length; idx++)
|
||||||
|
{
|
||||||
|
var td1 = idx + 1;
|
||||||
|
var td2 = result.data[idx].id;
|
||||||
|
var td3 = '<span class="longtext" title="' + result.data[idx].line_name + '">' + result.data[idx].line_name + '</span>';
|
||||||
|
var td4 = '<span class="longtext" title="' + result.data[idx].tower_name + '">' + result.data[idx].tower_name + '</span>';
|
||||||
|
var td5 = (result.data[idx].display_name == null || result.data[idx].display_name.length == 0) ? result.data[idx].cmdid : result.data[idx].display_name;
|
||||||
|
|
||||||
|
|
||||||
|
var detailUrl = "ws-his.html?term_id=" + result.data[idx].id + "&cmdid=" + result.data[idx].cmdid;
|
||||||
|
// var td8 = '<a href="' + biDetailUrl + '" target="_blank"><span title="' + result.data[idx].ws_update_time + '">' + shortUpdateTime + "</span></a>";
|
||||||
|
var td6 = result.data[idx].bv;
|
||||||
|
var td7 = result.data[idx].bvTime;
|
||||||
|
var td8 = result.data[idx].validBv;
|
||||||
|
var td9 = result.data[idx].lowBv;
|
||||||
|
var td10 = result.data[idx].bc;
|
||||||
|
var td11 = result.data[idx].bcTime;
|
||||||
|
var td12 = '<a href="' + detailUrl + '" target="_blank">详情</a>';
|
||||||
|
|
||||||
|
|
||||||
|
var tr = AppendTable(tableResult, td1, td2, td3, td4, td5, td6, td7, td8, td9, td10, td11, td12);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
var urlTarget = '/rpts/api/queryLine.php';
|
||||||
|
var params = {};
|
||||||
|
|
||||||
|
$.getJSON(urlTarget, params, function(result) {
|
||||||
|
|
||||||
|
for (var idx = 0; idx < result.length; idx++)
|
||||||
|
{
|
||||||
|
$("#lines").append("<option value='" + result[idx].id + "'>" + result[idx].vname + " - " + result[idx].name + "</option>");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
loadData();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#lines").on("change", function () {
|
||||||
|
loadData();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function AppendTable(table)
|
||||||
|
{
|
||||||
|
if (arguments.length <= 1) return false;
|
||||||
|
|
||||||
|
var tr = table.insertRow(-1);
|
||||||
|
for (idx = 1; idx < arguments.length; idx++)
|
||||||
|
{
|
||||||
|
var td = tr.insertCell(-1);
|
||||||
|
td.innerHTML = arguments[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
return tr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</html>
|
Binary file not shown.
Loading…
Reference in New Issue