From a8c5e5bce0c58f2780ed0f6daac1b62b6a1fc1e1 Mon Sep 17 00:00:00 2001
From: 沈斌 <23420800@qq.com>
Date: Tue, 31 Jan 2017 15:49:02 +0800
Subject: [PATCH] 环境数接口程序后台代码修复,同时去除调试代码等
---
server.js | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/server.js b/server.js
index ae5b574..511a5ad 100644
--- a/server.js
+++ b/server.js
@@ -19,6 +19,8 @@
"5a000001000c": 20 //������������
};
+global.configs = {};
+
function handleData(db, socket, value) {
//1.���������������
@@ -39,7 +41,6 @@
if(value.startsWith('5a0000010003')) {
var output = [ 0x6A, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6B ];
method.insertData(db, value, function(data, rank) {
- //method.insertDocument2(db, value, rank, function(data) {});
var fields = method.padLeft(rank.toString(16), 8).match(/.{2}/g);
output[6] = method.toDec(fields[0]);
output[7] = method.toDec(fields[1]);
@@ -119,6 +120,12 @@
}
console.log('Connecting to Mongo DB at ' + config.URL);
+ //���������������������������������
+ method.initConfigs(db);
+
+ //���������������������������������������
+ queue.listenToMQ("ex_data_config");
+
net.createServer().on('connection', function(socket){
console.log('CONNECTED: ' + socket.remoteAddress +':'+ socket.remotePort);
@@ -133,8 +140,6 @@
console.log("Error - invalid data - less than 12 character long");
return;
}
-
- //console.log(moment().format('YYYY-MM-DD HH:mm:ss') + " => " + value);
doWork(db, socket, value);
});
@@ -158,4 +163,4 @@
}).listen(config.PORT, config.HOST);
console.log('TCP Server listening on ' + config.HOST + ':' + config.PORT);
-});
+});
\ No newline at end of file
--
Gitblit v1.8.0