mm_os 3.2.1 → 3.2.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.
@@ -124,7 +124,8 @@ MQTT.prototype.update_after = async function() {
124
124
  var _this = this;
125
125
  var list = this.list;
126
126
  for (var i = 0; i < list.length; i++) {
127
- if (o.config.state === 1) {
127
+ var o = list[i];
128
+ if (o.config && o.config.state === 1) {
128
129
  o.send = function(topic, msg, qos = 0, retain = false) {
129
130
  if (topic) {
130
131
  _this.send(topic, msg, qos, retain);
@@ -261,18 +262,21 @@ MQTT.prototype.receive = async function(push_topic, msg) {
261
262
  if (msg && (msg.indexOf('[') === 0) || msg.indexOf('{') === 0) {
262
263
  try {
263
264
  msg = JSON.parse(msg);
264
- } catch {}
265
+ } catch (error) {
266
+ $.log.error("消息结构体不对", error);
267
+ }
265
268
  }
266
269
  var ret;
267
270
  var list = this.list;
268
- for (var i = 0, o; o = list[i++];) {
271
+ for (var i = 0; i < list.length; i++) {
272
+ var o = list[i];
269
273
  if (o.config.state === 1) {
270
274
  var topics = o.config.topic;
271
275
  if (topics) {
272
- for (var i = 0; i < topics.length; i++) {
273
- var topic = topics[i];
276
+ for (var n = 0; n < topics.length; n++) {
277
+ var topic = topics[n];
274
278
  if (this.match(push_topic, topic)) {
275
- ret = await o.exec('handle', push_topic, msg, topic, i);
279
+ ret = await o.exec('handle', push_topic, msg, topic, n);
276
280
  }
277
281
  }
278
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {