mm_os 2.5.2 → 2.5.3

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.
@@ -143,11 +143,11 @@ Eventer.prototype.do_after = function() {
143
143
  /**
144
144
  * 执行事件
145
145
  */
146
- Eventer.prototype.doing = async function(o, msg) {
146
+ Eventer.prototype.doing = async function(o, ...msg) {
147
147
  o.num++;
148
148
  var ret;
149
149
  try {
150
- ret = o.func(msg, o.param, o.num);
150
+ ret = o.func(...msg, o.param, o.num);
151
151
  if (types.isPromise(ret)) {
152
152
  ret = await ret;
153
153
  }
@@ -167,10 +167,10 @@ Eventer.prototype.doing = async function(o, msg) {
167
167
  * 运行事件
168
168
  * @param {Array} list 列表
169
169
  * @param {String} type 类型
170
- * @param {Object} msg 事件消息
171
170
  * @param {Boolean} isBreak 是否中断
171
+ * @param {Object} msg 事件消息
172
172
  */
173
- Eventer.prototype.run_sub = async function(list, msg, isBreak = false) {
173
+ Eventer.prototype.run_sub = async function(list, isBreak, ...msg) {
174
174
  var ret;
175
175
  if (list) {
176
176
  for (var i = 0; i < list.length; i++) {
@@ -179,7 +179,7 @@ Eventer.prototype.run_sub = async function(list, msg, isBreak = false) {
179
179
  if (o.state == 1) {
180
180
  // 判断是否还需要执行
181
181
  if (o.count < 0 || o.num < o.count) {
182
- ret = await this.doing(o, msg);
182
+ ret = await this.doing(o, ...msg);
183
183
  if (ret && isBreak) {
184
184
  break;
185
185
  }
@@ -201,19 +201,19 @@ Eventer.prototype.run_sub = async function(list, msg, isBreak = false) {
201
201
  * @param {String} type 类型
202
202
  * @param {Object} msg 事件消息
203
203
  */
204
- Eventer.prototype.run = async function(type, msg) {
204
+ Eventer.prototype.run = async function(type, ...msg) {
205
205
  this.do_before();
206
206
  var ret;
207
207
  var dt = this.dict[type];
208
208
  if (dt) {
209
- ret = await this.run_sub(dt.before, msg, false);
210
- ret = await this.run_sub(dt.check, msg, true);
209
+ ret = await this.run_sub(dt.before, false, ...msg);
210
+ ret = await this.run_sub(dt.check, true, ...msg);
211
211
  if (ret) {
212
212
  return ret
213
213
  }
214
- ret = await this.run_sub(dt.main, msg, false);
214
+ ret = await this.run_sub(dt.main, false, ...msg);
215
215
  if (ret) {
216
- var ret_new = await this.run_sub(dt.after, msg, false);
216
+ var ret_new = await this.run_sub(dt.after, false, ...msg);
217
217
  ret = ret_new || ret;
218
218
  }
219
219
  }
@@ -305,6 +305,18 @@ Drive.prototype.pushS = function(clientid, msg, longtime) {
305
305
  });
306
306
  }
307
307
 
308
+ /**
309
+ *
310
+ * @param {Object} clientid
311
+ * @param {Object} online
312
+ * @param {Object} ip
313
+ */
314
+ Drive.prototype.save_online = async function(clientid, online, ip) {
315
+ if (!clientid) {
316
+
317
+ }
318
+ }
319
+
308
320
  /**
309
321
  * 更新设备在线
310
322
  * @param {String} clientid 客户端ID
@@ -203,8 +203,8 @@ Server.prototype.exec_log = async function(clientid, log) {
203
203
  */
204
204
  Server.prototype.check_device = async function(clientid, key) {
205
205
  var tip;
206
- var db2 = dbs.new("face_device", "device_id");
207
- var device = await db2.getObj({
206
+ var db_device = dbs.new("face_device", "device_id");
207
+ var device = await db_device.getObj({
208
208
  clientid
209
209
  });
210
210
  if (device) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -37,14 +37,14 @@
37
37
  "koa-websocket": "^7.0.0",
38
38
  "mm_check": "^1.4.8",
39
39
  "mm_excel": "^1.2.0",
40
- "mm_expand": "^1.7.3",
40
+ "mm_expand": "^1.7.4",
41
41
  "mm_html": "^1.1.6",
42
42
  "mm_koa_proxy": "^1.0.0",
43
43
  "mm_logs": "^1.1.4",
44
44
  "mm_machine": "^1.7.8",
45
45
  "mm_mongodb": "^1.4.2",
46
46
  "mm_mqtt": "^1.0.6",
47
- "mm_mysql": "^1.8.1",
47
+ "mm_mysql": "^1.8.3",
48
48
  "mm_redis": "^1.4.2",
49
49
  "mm_ret": "^1.3.9",
50
50
  "mm_session": "^1.4.8",