From a4b949bbfe5815a424d61e1536c8b994d0a37a97 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 21 Apr 2017 17:18:13 +0800 Subject: [PATCH 1/2] update --- route/api/modbus.js | 1 + 1 file changed, 1 insertion(+) diff --git a/route/api/modbus.js b/route/api/modbus.js index 3d6de7b..b500b3a 100644 --- a/route/api/modbus.js +++ b/route/api/modbus.js @@ -543,6 +543,7 @@ router if (!('func' in arr.data) || arr.data.func.length == 0) return n('ERR0055'); if (!('addr' in arr.data) || arr.data.addr.length == 0) return n('ERR0048'); if (!('value' in arr.data) || arr.data.value.length == 0) return n('ERR0049'); + if (arr.data.value > 65535) return n('ERR0049'); let cmd = `mbtcpm ${arr.data.ip} ${arr.data.node} ${arr.data.func} ${arr.data.addr} ${arr.data.value}`; res.api_res = { From 27d2209ea2cba06cf2db14f714112bcf606470b8 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 24 Apr 2017 16:25:56 +0800 Subject: [PATCH 2/2] update loss chk --- route/api/wristband.js | 5 +++-- src/components/AdminPage/Wristband/LocStatus/ListItem.js | 2 +- src/components/AdminPage/Wristband/LocStatusWloc/index.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/route/api/wristband.js b/route/api/wristband.js index 952dc53..41acfa6 100644 --- a/route/api/wristband.js +++ b/route/api/wristband.js @@ -131,8 +131,9 @@ router 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\ + case when tmp2.`wlocrtloc` = 'NG' then 1 else 0 end as loss, \ + ll.* \ + from ??.?? w \ left join ??.?? tmp2 \ on tmp2.`wlocrtmac` = w.`mac` \ left join ??.?? ll \ diff --git a/src/components/AdminPage/Wristband/LocStatus/ListItem.js b/src/components/AdminPage/Wristband/LocStatus/ListItem.js index 5744dd9..57b4e83 100644 --- a/src/components/AdminPage/Wristband/LocStatus/ListItem.js +++ b/src/components/AdminPage/Wristband/LocStatus/ListItem.js @@ -5,7 +5,7 @@ import {convertTime, padding} from '../../../../tools'; const ListItem = ({i18n, data}) => { return ( - + {data.wristband} {data.name} {data.locname} diff --git a/src/components/AdminPage/Wristband/LocStatusWloc/index.js b/src/components/AdminPage/Wristband/LocStatusWloc/index.js index c7478c3..c08ccb3 100644 --- a/src/components/AdminPage/Wristband/LocStatusWloc/index.js +++ b/src/components/AdminPage/Wristband/LocStatusWloc/index.js @@ -94,7 +94,7 @@ class LocStatusWloc extends React.Component { { t.list ? t.list.map((tt, idx) => { - let isExpire = padding(tt.timestamp, 13, 1, '0') < (Date.now() - 60000) ? true : false; + let isExpire = tt.loss == 1 ? true : false; return ( { tt.name ? (