add locStatus with location
This commit is contained in:
+11
-10
@@ -128,26 +128,25 @@ router
|
||||
.post('/getstatus', (req, res, n) => {
|
||||
if (!config.permission.wristband) return n('ERR9000');
|
||||
|
||||
let query = "select w.`name`, w.`mac` as wristband, coalesce(l.`name`, l2.`name`) as locname, ll.*\
|
||||
let query = "select w.`name`, w.`mac` as wristband, \
|
||||
coalesce(l.`name`, l2.`name`) as locname, \
|
||||
coalesce(case when tmp2.`wlocrtloc` = 'NG' then null else tmp2.`wlocrtloc` end, ll.`devid`) as locid, \
|
||||
ll.*\
|
||||
from ??.?? w\
|
||||
left join ( \
|
||||
select * from ( \
|
||||
select * from ??.?? \
|
||||
where `timestamp` > unix_timestamp() - 30 order by conv(`val11`, 16, 10) desc limit 65535000\
|
||||
) tmp group by `mac` \
|
||||
) tmp2 \
|
||||
on tmp2.`mac` = w.`mac` \
|
||||
left join ??.?? tmp2 \
|
||||
on tmp2.`wlocrtmac` = w.`mac` \
|
||||
left join ??.?? ll \
|
||||
on ll.`mac` = w.`mac` \
|
||||
left join ??.?? l \
|
||||
on \
|
||||
l.`serialnumber` = tmp2.`devid` \
|
||||
l.`serialnumber` = tmp2.`wlocrtloc` \
|
||||
and tmp2.`wlocrtloc` != 'NG' \
|
||||
left join ??.?? l2\
|
||||
on \
|
||||
l2.`serialnumber` = ll.`devid` \
|
||||
where \
|
||||
w.`switch` = 1 ";
|
||||
let param = [config.db.db9, 'wristband', config.db.db9, 'rawdata', config.db.db9, 'lastdata', config.db.db9, 'location', config.db.db9, 'location', ];
|
||||
let param = [config.db.db9, 'wristband', config.db.db9, 'wlocationrt', config.db.db9, 'lastdata', config.db.db9, 'location', config.db.db9, 'location', ];
|
||||
|
||||
let sortfield = '';
|
||||
let sortorder = '';
|
||||
@@ -177,6 +176,8 @@ router
|
||||
case 'time':
|
||||
query += 'order by ll.`timestamp` ' + sortorder;
|
||||
break;
|
||||
case 'name':
|
||||
query += `order by w.name ${sortorder}`;
|
||||
default:
|
||||
query += 'order by w.`uid`';
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user