Commit b6a5609f by zCaesar

edit length id

parent 286ef1b5
......@@ -3,6 +3,7 @@ var validator = require('./validator');
var config = require('config');
// var seneca = require('seneca')({log: 'silent'}).client({ port: config.get('device_registry_port'), host: config.get('device_registry_host') });
var seneca = require('seneca')({ log: 'silent' }).client({ port: config.get('token_registry_port'), host: config.get('token_registry_host') });
let on_register_redis = require('./redis/on_register').on_register_redis
// https://github.com/isaacs/node-lru-cache
var LRU = require("lru-cache"),
......@@ -146,7 +147,8 @@ module.exports = function (options = {}) {
// });
// }
// }
require('./redis/on_register').on_register_redis(req.body.client_id).then(status => {
on_register_redis(req.body.client_id).then(status => {
console.log('redis:status: ' + status)
if (status) {
res.send({
......
......@@ -3,12 +3,13 @@ var redis = new Redis()
function on_register_redis(deviceid) { // first time to access on authhook auth_on_register
return new Promise((resolve, reject) => {
if (deviceid.indexOf('mqtt') === 0 || deviceid.length !== 36) {
if (deviceid.indexOf('mqtt') === 0) {
resolve(true)
}
else {
var information = setValue(deviceid)
redis.hdel(information.keys, 'offline_on')
console.log(information.keys)
redis.hset(information.keys, 'status', information.status, 'register_on', information.register_on, 'last_check', information.last_check, function (err, res) {
console.log(res)
if (!res) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment