mm_os 2.3.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/com/mqtt/drive.js +10 -10
- package/package.json +1 -1
package/core/com/mqtt/drive.js
CHANGED
|
@@ -303,23 +303,23 @@ Drive.prototype.pushS = function(clientid, msg, longtime) {
|
|
|
303
303
|
/**
|
|
304
304
|
* 更新设备在线
|
|
305
305
|
* @param {String} clientid 客户端ID
|
|
306
|
+
* @param {Boolean} online 是否在线 0为没在线 1为在线
|
|
306
307
|
*/
|
|
307
|
-
Drive.prototype.update_online = async function(clientid) {
|
|
308
|
-
if (!
|
|
309
|
-
|
|
308
|
+
Drive.prototype.update_online = async function(clientid, online = 1) {
|
|
309
|
+
if (!this.drives[clientid]) {
|
|
310
|
+
this.drives[clientid] = {};
|
|
310
311
|
}
|
|
311
312
|
var time_last = new Date().getTime(); // 跟新时间戳
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
this.drives[clientid].online = online;
|
|
314
|
+
if (online) {
|
|
315
|
+
this.drives[clientid].time_last = time_last;
|
|
316
|
+
}
|
|
314
317
|
var {
|
|
315
318
|
tip,
|
|
316
319
|
device
|
|
317
320
|
} = await $.server.check_device(clientid);
|
|
318
|
-
if (device) {
|
|
319
|
-
|
|
320
|
-
device.online = 1;
|
|
321
|
-
}
|
|
322
|
-
device.time_last = time_last;
|
|
321
|
+
if (device && online && !device.online) {
|
|
322
|
+
device.online = online;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
|