From 99e92a5304ec93d5fd0b9d739215bbc73945f005 Mon Sep 17 00:00:00 2001 From: 沈斌 <23420800@qq.com> Date: Tue, 31 Jan 2017 15:22:51 +0800 Subject: [PATCH] 环境数云端接口程序代码优化,三级警报配置信息移至配置文件中 --- config.js | 20 ++++++++++++++++++++ method.js | 22 ++-------------------- server.js | 2 -- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/config.js b/config.js index 47bb405..c35988b 100644 --- a/config.js +++ b/config.js @@ -9,6 +9,26 @@ URL: "mongodb://moral_user:m2o0r1a6l_passw0rd@127.0.0.1:27017/moral_db", COLLECTION: "documents", + ALARM_DEFAULTS: { + address: "���������������������������������", + location: { + lat:31.430616, + lng:120.988327 + }, + notice: { + tel: "15950198162", + email: "it01@moral.org.cn", + open_id: "o-RTuwvMHWotyirPHLmdSB_dKoQU" + }, + options: { + 1: [1000, 2000, 3000], + 2: [1000, 2000, 3000], + 3: [1000, 2000, 3000], + 4: [1000, 2000, 3000], + 5: [1000, 2000, 3000] + } + }, + OUTPUT_1: [ 0x6A, 0x00, 0x00, 0x01, 0x00, 0x01, 0xA1, 0x1A, 0xC7, 0x6B ], diff --git a/method.js b/method.js index 3cad431..cdbe1e8 100644 --- a/method.js +++ b/method.js @@ -173,26 +173,8 @@ var _config = global.configs[mac]; if(_config == null) { - _config = { - mac: mac, - address: "���������������������������������", - location: { - lat:31.430616, - lng:120.988327 - }, - notice: { - tel: "15950198162", - email: "it01@moral.org.cn", - open_id: "o-RTuwvMHWotyirPHLmdSB_dKoQU" - }, - options: { - 1: [1000, 2000, 3000], - 2: [1000, 2000, 3000], - 3: [1000, 2000, 3000], - 4: [1000, 2000, 3000], - 5: [1000, 2000, 3000] - } - }; + _config = config.ALARM_DEFAULTS; + _config.mac = mac; configs[mac] = _config; } diff --git a/server.js b/server.js index ccbe491..511a5ad 100644 --- a/server.js +++ b/server.js @@ -141,8 +141,6 @@ return; } - //console.log(moment().format('YYYY-MM-DD HH:mm:ss') + " => " + value); - doWork(db, socket, value); }); -- Gitblit v1.8.0