update
This commit is contained in:
+1
-1
@@ -423,7 +423,7 @@ router
|
||||
if (row[0].count > 0) return n('ERR0054');
|
||||
|
||||
let q = "insert into ??.?? (`iouid`, `name`, `portnum`, `type`, `range_min`, `range_max`, `scale_min`, `scale_max`, `ctime`, `mtime`) values \
|
||||
(?, ?, ?, ?, ?, ?, ?, unix_timestamp(), unix_timestamp())";
|
||||
(?, ?, ?, ?, ?, ?, ?, ?, unix_timestamp(), unix_timestamp())";
|
||||
let p = [config.db.db5, 'aioset', arr.data.iouid, arr.data.name, arr.data.portnum, arr.data.type, arr.data.range_min, arr.data.range_max, arr.data.scale_min, arr.data.scale_max];
|
||||
res.db.query(q, p, (err, row) => {
|
||||
if (err) return n('ERR8001');
|
||||
|
||||
@@ -418,6 +418,39 @@ router
|
||||
record: []
|
||||
}
|
||||
n();
|
||||
})
|
||||
.post('/gettimezonelist', (req,res,n) => {
|
||||
exec('timedatectl list-timezones', (err, stdout, stderr) => {
|
||||
if(err) return n("ERR8000");
|
||||
|
||||
let zones = stdout.split(/\n/);
|
||||
let json = {
|
||||
zone: []
|
||||
};
|
||||
|
||||
for(let i in zones){
|
||||
let str = zones[i].trim();
|
||||
if(!str) continue;
|
||||
let tz = str.split('/');
|
||||
if(tz.length != 2) continue;
|
||||
let flag = false;
|
||||
for(let j in json.zone){
|
||||
if(json.zone[j].name == tz[0]) {
|
||||
flag = true;
|
||||
json.zone[j].location.push(tz[1]);
|
||||
}
|
||||
}
|
||||
if(!flag) json.zone.push({name: tz[0], location: [tz[1]]})
|
||||
}
|
||||
|
||||
res.api_res = {
|
||||
record: tool.checkArray(json.zone)
|
||||
}
|
||||
n();
|
||||
})
|
||||
})
|
||||
.post('/gettimezoneset', (req,res,n) => {
|
||||
|
||||
})
|
||||
.all('*', rt.send);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user