add wristband path history info
This commit is contained in:
@@ -307,6 +307,53 @@ router
|
||||
n();
|
||||
})
|
||||
})
|
||||
.post('/getwristbandlocpath', (req, res, n) => {
|
||||
if (!config.permission.wristband) return n('ERR9000');
|
||||
let arr = req.body;
|
||||
if (!arr.data) return n('ERR0000');
|
||||
if (!arr.data.mac) return n('ERR0060');
|
||||
if (!arr.data.stime || !arr.data.etime) return n('ERR0015');
|
||||
|
||||
let pros = [];
|
||||
let query = "select log.*, dev.`name` as devname \
|
||||
from ??.?? log \
|
||||
left join ??.?? dev \
|
||||
on dev.`serialnumber` = log.`wloclogloc` \
|
||||
where \
|
||||
log.`wloclogmac` = ? \
|
||||
and log.`wloclogtst` >= ? \
|
||||
and log.`wloclogtst` <= ? \
|
||||
order by log.`wloclogtst` desc";
|
||||
let param = [config.db.db9, 'wlocationlog', config.db.db9, 'location', arr.data.mac, arr.data.stime, arr.data.etime];
|
||||
pros.push(tool.promiseQuery(res, query, param, 'record'));
|
||||
|
||||
let rtq = "select * from ??.?? where `mac` = ?";
|
||||
let rtp = [config.db.db9, 'wristband', arr.data.mac];
|
||||
pros.push(tool.promiseQuery(res, rtq, rtp, 'rt'));
|
||||
|
||||
res.api_res = {
|
||||
record: [],
|
||||
rt: {
|
||||
wristband: []
|
||||
}
|
||||
}
|
||||
|
||||
Promise.all(pros)
|
||||
.then(d => {
|
||||
for (let i in d) {
|
||||
let tmp = d[i];
|
||||
if (tmp.key == 'rt') {
|
||||
res.api_res.rt.wristband = tool.checkArray(tmp.data);
|
||||
}
|
||||
if (tmp.key == 'record') {
|
||||
res.api_res.record = tool.checkArray(tmp.data);
|
||||
}
|
||||
}
|
||||
return n();
|
||||
})
|
||||
.catch(err => rt.err(res, err, n, 'ERR8000'));
|
||||
|
||||
})
|
||||
.post('/getlocationlist', (req, res, n) => {
|
||||
if (!config.permission.wristband) return n('ERR9000');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user