| | |
| | | |
| | | var moment = require('moment'); |
| | | var config = require('./config'); |
| | | var queue = require('./queue'); |
| | | |
| | | module.exports.toDec = function(hex) { |
| | | if(typeof hex === 'number') { |
| | |
| | | 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); |
| | | }); |
| | | }; |
| | |
| | | |
| | | 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); |