update
This commit is contained in:
parent
b8ccbe4cd3
commit
05e38c2e2d
@ -61,6 +61,8 @@
|
|||||||
"ERR0059": "timezone設定失敗",
|
"ERR0059": "timezone設定失敗",
|
||||||
"ERR0060": "手環ID輸入錯誤",
|
"ERR0060": "手環ID輸入錯誤",
|
||||||
"ERR0061": "手環ID已存在",
|
"ERR0061": "手環ID已存在",
|
||||||
|
"ERR0062": "機器序號輸入錯誤",
|
||||||
|
"ERR0063": "機器序號已存在",
|
||||||
|
|
||||||
"ERR7000": "命令執行失敗",
|
"ERR7000": "命令執行失敗",
|
||||||
|
|
||||||
|
@ -311,6 +311,18 @@ router
|
|||||||
.post('/addlocation', (req, res, n) => {
|
.post('/addlocation', (req, res, n) => {
|
||||||
if (!config.permission.wristband) return n('ERR9000');
|
if (!config.permission.wristband) return n('ERR9000');
|
||||||
if (!tool.checkPermission(req)) return n('ERR9000');
|
if (!tool.checkPermission(req)) return n('ERR9000');
|
||||||
|
let arr = req.body;
|
||||||
|
if (!arr.data) return n('ERR0000');
|
||||||
|
if (!arr.data.sn) return n("ERR0062");
|
||||||
|
if (!arr.data.name) return n('ERR0026');
|
||||||
|
|
||||||
|
let query = "select count(*) as c from ??.?? where `serialnumber` = ?";
|
||||||
|
let param = [config.db.db9, 'location', arr.data.sn];
|
||||||
|
|
||||||
|
res.db.query(query, param, (err, row) => {
|
||||||
|
if (err || row.length == 0) return rt.err(res, err, n, 'ERR8000');
|
||||||
|
if (row[0].c > 0) return n('ERR0063');
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.all('*', rt.send);
|
.all('*', rt.send);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user