This commit is contained in:
Jay 2017-03-29 18:02:51 +08:00
parent 3e66691b67
commit e1ce5290da
2 changed files with 25 additions and 1 deletions

View File

@ -213,6 +213,7 @@ router
d.`uid` = ? \
and rt.`type` = ? \
and i.`uid` is not null \
and ( a.`name` is not null or rt.`type` in (1,2)) \
order by rt.`port` asc";
let param = [config.db.db6, 'jcmbrt', config.db.db5, 'device', config.db.db5, 'iolist', arr.data.type, config.db.db5, 'aioset', arr.data.id, arr.data.type];

View File

@ -23,12 +23,13 @@ router
let arr = req.query;
if(!arr.mac) return n('ERR0000');
if(!arr.devid) return n('ERR0000');
let query = "insert into ??.?? values (null, ?, ?,?,?,?,?,?,?,?,?,?,?,?,unix_timestamp())";
let param = [
config.db.db9,
'rawdata',
arr.devid || '',
arr.mac || '',
arr.val1 || '',
arr.val2 || '',
arr.val3 || '',
arr.val4 || '',
@ -58,6 +59,28 @@ router
}
n();
})
.post('/getstatus', (req,res,n) => {
let query = "select * from \
(\
select xx.*, l.`name` from ??.?? xx \
left join ??.?? l \
on l.`serialnumber` = xx.`devid` \
where xx.`timestamp` > unix_timestamp() - 10 \
order by xx.`val11` desc, xx.`timestamp` desc \
limit 65535\
) x \
group by `mac`";
let param = [config.db.db9, 'rawdata', config.db.db9, 'location']
res.db.query(query, param, (err,row) => {
if(err) return n('ERR8000');
res.api_res = {
record: tool.checkArray(row)
}
n();
})
})
.all('*', rt.send);
module.exports = router;