沈斌
2016-12-22 8d11b3142471207c1dfbe7fb5fc39791551a370a
method.js
@@ -4,6 +4,7 @@
var moment = require('moment');
var config = require('./config');
var queue = require('./queue');
module.exports.toDec = function(hex) {
    if(typeof hex === 'number') {
@@ -93,7 +94,7 @@
    this.updateDeviceLastUpdated(db, mac, function(data) {});
    
    db.collection("devices").find({ mac: mac }).limit(1).next(function(err, doc){
        if (err) return;
        if (err || doc == null) return;
        callback(doc);
    });
};
@@ -168,6 +169,23 @@
    var current = moment();
    queue.pushToScreen({
        mac: mac,
        location: {
            lat: 31.430616,
            lng: 120.988327
        },
        data: {
            x1: x1,  //PM2.5 - (单位:ppm)
            x2: x3,  //PM2.5 - 0.1升0.3um量
            x3: x9,  //甲醛
            x4: x11, //温度
            x5: x10, //湿度
            x6: x14  //光线强度
        },
        time: current.valueOf()
    });
    var rank = 0;
    if(s > 0) {
        rank = this.random(1000, 99999);//this.random(1000, 99999999);