沈斌
2016-12-15 d0e1fc1c2e6bee83848fc5c70771ab8dc59bb5ec
bug修复 - JSON格式调整
1 files modified
21 ■■■■ changed files
queue.js 21 ●●●● patch | view | raw | blame | history
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(JSON.stringify(message)));
            var _ex = 'ex_data_screen';
            ch.assertExchange(_ex, 'fanout', { durable: false });
            ch.publish(_ex, '', new Buffer(JSON.stringify(data)));
        });
        setTimeout(function() {
            conn.close();