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.
@@ -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 (!_this.drives[clientid]) {
309
- _this.drives[clientid] = {};
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
- _this.drives[clientid].online = 1;
313
- _this.drives[clientid].time_last = time_last;
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
- if (!device.online) {
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "2.3.3",
3
+ "version": "2.3.5",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {