mm_os 2.4.4 → 2.4.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.
|
@@ -388,7 +388,7 @@ exports.init = function() {
|
|
|
388
388
|
}
|
|
389
389
|
_this.drives[clientid].online = 1;
|
|
390
390
|
_this.drives[clientid].time_last = new Date().getTime();
|
|
391
|
-
console.log("心跳", clientid, _this.drives[clientid]);
|
|
391
|
+
// console.log("心跳", clientid, _this.drives[clientid]);
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
/**
|
|
@@ -87,6 +87,14 @@ exports.delete_member = async function(clientid, uuid) {
|
|
|
87
87
|
return
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
exports.sleep = async function(longtime, param) {
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
resolve(param);
|
|
94
|
+
}, longtime);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
90
98
|
/**
|
|
91
99
|
* 批量删除成员
|
|
92
100
|
* @param {String} clientid 客户端ID
|
|
@@ -97,7 +105,7 @@ exports.delete_member_batch = async function(clientid, arr, longtime) {
|
|
|
97
105
|
if (!this.drives[clientid]) {
|
|
98
106
|
this.drives[clientid] = {};
|
|
99
107
|
}
|
|
100
|
-
if (this.drives[clientid].pushing
|
|
108
|
+
if (this.drives[clientid].pushing) {
|
|
101
109
|
return {
|
|
102
110
|
detail: "busy"
|
|
103
111
|
}
|
|
@@ -117,8 +125,21 @@ exports.delete_member_batch = async function(clientid, arr, longtime) {
|
|
|
117
125
|
var res = await this.push("delete_face", clientid, {
|
|
118
126
|
"per_id": customId,
|
|
119
127
|
"type": 0
|
|
120
|
-
});
|
|
121
|
-
if (res
|
|
128
|
+
}, 10000);
|
|
129
|
+
if (!res) {
|
|
130
|
+
await this.sleep(60000);
|
|
131
|
+
res = await this.push("delete_face", clientid, {
|
|
132
|
+
"per_id": customId,
|
|
133
|
+
"type": 0
|
|
134
|
+
}, 10000);
|
|
135
|
+
}
|
|
136
|
+
if (!res) {
|
|
137
|
+
error_info.push({
|
|
138
|
+
customId,
|
|
139
|
+
errcode: -1,
|
|
140
|
+
time_create: now
|
|
141
|
+
});
|
|
142
|
+
} else if (res.message == "ACK") {
|
|
122
143
|
success++;
|
|
123
144
|
success_info.push({
|
|
124
145
|
customId,
|
|
@@ -176,10 +197,10 @@ exports.set_device_time = async function(clientid, datetime) {
|
|
|
176
197
|
"datetime": datetime
|
|
177
198
|
}
|
|
178
199
|
});
|
|
179
|
-
|
|
180
200
|
if (!res) {
|
|
181
201
|
return "请求超时!"
|
|
182
202
|
}
|
|
203
|
+
|
|
183
204
|
if (res.message !== "ACK") {
|
|
184
205
|
return res.code;
|
|
185
206
|
}
|
|
@@ -192,15 +213,15 @@ exports.set_device_time = async function(clientid, datetime) {
|
|
|
192
213
|
* @param {Boolean} member 是否恢复成员,true为恢复
|
|
193
214
|
* @param {Boolean} log 是否恢复请求日志,true为恢复
|
|
194
215
|
*/
|
|
195
|
-
exports.reset_device =
|
|
216
|
+
exports.reset_device = function(clientid, record = true, member = false, log = true) {
|
|
196
217
|
if (record) {
|
|
197
218
|
// 清空记录
|
|
198
|
-
|
|
219
|
+
this.push("delete_record", clientid, {});
|
|
199
220
|
}
|
|
200
221
|
|
|
201
222
|
if (member) {
|
|
202
223
|
// 删除所有成员
|
|
203
|
-
|
|
224
|
+
this.push("delete_face", clientid, {
|
|
204
225
|
type: 4
|
|
205
226
|
});
|
|
206
227
|
}
|
|
@@ -210,7 +231,7 @@ exports.reset_device = async function(clientid, record = true, member = false, l
|
|
|
210
231
|
* 查询下发进度(未完成)
|
|
211
232
|
* @param {String} clientid 设备sn
|
|
212
233
|
*/
|
|
213
|
-
exports.get_progress = function(clientid) {
|
|
234
|
+
exports.get_progress = async function(clientid) {
|
|
214
235
|
if (!this.drives[clientid]) {
|
|
215
236
|
this.drives[clientid] = {};
|
|
216
237
|
}
|
|
@@ -293,6 +314,9 @@ exports.get_member = async function(clientid, uuid, name) {
|
|
|
293
314
|
qy.name = name;
|
|
294
315
|
}
|
|
295
316
|
var res = await this.push("query_face", qy);
|
|
317
|
+
if (!res) {
|
|
318
|
+
return "请求超时!"
|
|
319
|
+
}
|
|
296
320
|
if (res.code) {
|
|
297
321
|
return res.pers_id;
|
|
298
322
|
}
|
|
@@ -370,7 +394,7 @@ exports.update_member_batch = async function(clientid, list, longtime = 0) {
|
|
|
370
394
|
if (!this.drives[clientid]) {
|
|
371
395
|
this.drives[clientid] = {};
|
|
372
396
|
}
|
|
373
|
-
if (this.drives[clientid].pushing
|
|
397
|
+
if (this.drives[clientid].pushing) {
|
|
374
398
|
return {
|
|
375
399
|
detail: "busy"
|
|
376
400
|
}
|
|
@@ -387,8 +411,18 @@ exports.update_member_batch = async function(clientid, list, longtime = 0) {
|
|
|
387
411
|
var now = new Date().toStr("yyyy-MM-dd hh:mm:ss");
|
|
388
412
|
for (var i = 0; i < list.length; i++) {
|
|
389
413
|
var user = list[i];
|
|
390
|
-
var res = await this.push("update_face_ex", clientid, this.member_model_out(user));
|
|
391
|
-
if (res
|
|
414
|
+
var res = await this.push("update_face_ex", clientid, this.member_model_out(user), 10000);
|
|
415
|
+
if (!res) {
|
|
416
|
+
await this.sleep(60000);
|
|
417
|
+
res = await this.push("update_face_ex", clientid, this.member_model_out(user), 10000);
|
|
418
|
+
}
|
|
419
|
+
if (!res) {
|
|
420
|
+
error_info.push({
|
|
421
|
+
customId: user.customId,
|
|
422
|
+
errcode: -1,
|
|
423
|
+
time_create: now
|
|
424
|
+
});
|
|
425
|
+
} else if (res.message == "ACK") {
|
|
392
426
|
success++;
|
|
393
427
|
success_info.push({
|
|
394
428
|
customId: user.customId,
|
|
@@ -470,7 +504,6 @@ exports.set_qrcode_mode = async function(clientid, mode = 1) {
|
|
|
470
504
|
mode
|
|
471
505
|
}
|
|
472
506
|
});
|
|
473
|
-
|
|
474
507
|
if (!res) {
|
|
475
508
|
return "请求超时!"
|
|
476
509
|
}
|
|
@@ -491,7 +524,6 @@ exports.send_led = async function(clientid, color = 1) {
|
|
|
491
524
|
color
|
|
492
525
|
}
|
|
493
526
|
});
|
|
494
|
-
|
|
495
527
|
if (!res) {
|
|
496
528
|
return "请求超时!"
|
|
497
529
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_os",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.5",
|
|
4
4
|
"description": "这是超级美眉服务端框架,用于快速构建应用程序。",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"mm_redis": "^1.4.2",
|
|
49
49
|
"mm_ret": "^1.3.9",
|
|
50
50
|
"mm_session": "^1.4.8",
|
|
51
|
-
"mm_statics": "^1.4.
|
|
51
|
+
"mm_statics": "^1.4.8",
|
|
52
52
|
"mm_tpl": "^2.3.9",
|
|
53
53
|
"mm_xml": "^1.1.5",
|
|
54
54
|
"mosca": "^2.8.3",
|