From b5d6c7a27b0ec906f8d1af1cb8e25b0045e333bd Mon Sep 17 00:00:00 2001 From: 沈斌 <bluelazysb@hotmail.com> Date: Thu, 15 Dec 2016 13:26:44 +0800 Subject: [PATCH] 调整传感器数据结构 --- queue.js | 21 +++------------------ 1 files changed, 3 insertions(+), 18 deletions(-) diff --git a/queue.js b/queue.js index 791837d..9ebd5ab 100644 --- a/queue.js +++ b/queue.js @@ -25,24 +25,9 @@ module.exports.pushToScreen = function(data) { amqp.connect(uri, function(err, conn) { conn.createChannel(function(err, ch) { - ch.assertExchange('ex_data_screen', 'fanout', { durable: false }); - var message = { - mac: data.mac, - address: "���������������������������������", - location: { - lat:31.430616, - lng:120.988327 - }, - data: { - x1: data.x1, - x2: data.x2, - x3: data.x3, - x4: data.x4, - x5: data.x5, - x6: data.x6 - } - }; - ch.publish('ex_data_screen', '', new Buffer(message)); + var _ex = 'ex_data_screen'; + ch.assertExchange(_ex, 'fanout', { durable: false }); + ch.publish(_ex, '', new Buffer(JSON.stringify(data))); }); setTimeout(function() { conn.close(); -- Gitblit v1.8.0