环境数云端接口程序代码优化,三级警报配置信息移至配置文件中
| | |
| | | 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 |
| | | ], |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | //console.log(moment().format('YYYY-MM-DD HH:mm:ss') + " => " + value); |
| | | |
| | | doWork(db, socket, value); |
| | | }); |
| | | |