mm_os 1.6.9 → 1.7.0

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.
@@ -127,6 +127,7 @@ function api_admin(scope, title) {
127
127
  }
128
128
  return obj;
129
129
  }
130
+
130
131
  /**
131
132
  * @module 导出API管理器
132
133
  */
@@ -315,13 +315,7 @@ if (!$.pool.event) {
315
315
  $.pool.event = {};
316
316
  }
317
317
 
318
- /**
319
- * Event管理器,用于创建缓存
320
- * @param {String} scope 作用域
321
- * @param {string} title 标题
322
- * @return {Object} 返回一个缓存类
323
- */
324
- $.event_admin = function(scope, title) {
318
+ function event_admin(scope, title) {
325
319
  if (!scope) {
326
320
  scope = $.val.scope + '';
327
321
  }
@@ -331,4 +325,12 @@ $.event_admin = function(scope, title) {
331
325
  obj = $.pool.event[scope];
332
326
  }
333
327
  return obj;
334
- }
328
+ }
329
+
330
+ /**
331
+ * Event管理器,用于创建缓存
332
+ * @param {String} scope 作用域
333
+ * @param {string} title 标题
334
+ * @return {Object} 返回一个缓存类
335
+ */
336
+ $.event_admin = event_admin;
@@ -118,13 +118,7 @@ if (!$.pool.mqtt) {
118
118
  $.pool.mqtt = {};
119
119
  }
120
120
 
121
- /**
122
- * mqtt管理器, 用于管理插件
123
- * @param {string} scope 作用域
124
- * @param {string} title 标题
125
- * @return {Object} 返回一个缓存类
126
- */
127
- $.mqtt_admin = function (scope, title) {
121
+ function mqtt_admin(scope, title) {
128
122
  if (!scope) {
129
123
  scope = $.val.scope + '';
130
124
  }
@@ -135,4 +129,12 @@ $.mqtt_admin = function (scope, title) {
135
129
  }
136
130
  return obj;
137
131
  }
132
+
133
+ /**
134
+ * mqtt管理器, 用于管理插件
135
+ * @param {string} scope 作用域
136
+ * @param {string} title 标题
137
+ * @return {Object} 返回一个缓存类
138
+ */
139
+ $.mqtt_admin = mqtt_admin;
138
140
 
@@ -177,4 +177,4 @@ function nav_admin(scope, title) {
177
177
  /**
178
178
  * @module 导出nav管理器
179
179
  */
180
- exports.nav_admin = nav_admin;
180
+ $.nav_admin = nav_admin;
@@ -97,7 +97,8 @@ function param_admin(scope, title) {
97
97
  }
98
98
  return obj;
99
99
  }
100
+
100
101
  /**
101
102
  * @module 导出Param管理器
102
103
  */
103
- exports.param_admin = param_admin;
104
+ $.param_admin = param_admin;
@@ -157,13 +157,7 @@ if (!$.pool.plugin) {
157
157
  $.pool.plugin = {};
158
158
  }
159
159
 
160
- /**
161
- * plugin管理器, 用于管理插件
162
- * @param {string} scope 作用域
163
- * @param {string} title 标题
164
- * @return {Object} 返回一个缓存类
165
- */
166
- $.plugin_admin = function(scope, title) {
160
+ function plugin_admin(scope, title) {
167
161
  if (!scope) {
168
162
  scope = $.val.scope + '';
169
163
  }
@@ -173,4 +167,12 @@ $.plugin_admin = function(scope, title) {
173
167
  obj = $.pool.plugin[scope];
174
168
  }
175
169
  return obj;
176
- }
170
+ }
171
+
172
+ /**
173
+ * plugin管理器, 用于管理插件
174
+ * @param {string} scope 作用域
175
+ * @param {string} title 标题
176
+ * @return {Object} 返回一个缓存类
177
+ */
178
+ $.plugin_admin = plugin_admin;
@@ -101,7 +101,8 @@ function sql_admin(scope, title) {
101
101
  }
102
102
  return obj;
103
103
  }
104
+
104
105
  /**
105
106
  * @module 导出Sql管理器
106
107
  */
107
- exports.sql_admin = sql_admin;
108
+ $.sql_admin = sql_admin;
@@ -1,7 +1,6 @@
1
1
  const Index = require('mm_machine').Index;
2
2
  const Drive = require('./drive');
3
3
 
4
-
5
4
  /**
6
5
  * 任务类
7
6
  * @extends {Index}
@@ -116,4 +115,4 @@ function task_admin(scope, title) {
116
115
  /**
117
116
  * @module 导出Task管理器
118
117
  */
119
- exports.task_admin = task_admin;
118
+ $.task_admin = task_admin;
package/index.js CHANGED
@@ -28,6 +28,7 @@ class Soa {
28
28
  "cache": "memory",
29
29
  "lang": "zh_CN",
30
30
  "game": false,
31
+ "task": false,
31
32
  "log": false
32
33
  },
33
34
  "web": {
@@ -123,9 +124,13 @@ Soa.prototype.loadModule = function(config) {
123
124
  $.app = new App();
124
125
  this.com = $.com;
125
126
  this.app = $.app;
126
- if (config.sys.game) {
127
- $.game = new Game();
128
- this.game = $.game;
127
+
128
+ $.task = $.task_admin('sys');
129
+ if (config.sys) {
130
+ if (config.sys.game) {
131
+ $.game = new Game();
132
+ this.game = $.game;
133
+ }
129
134
  }
130
135
  }
131
136
 
@@ -140,10 +145,10 @@ Soa.prototype.init = function(config) {
140
145
  this.initBase(this.config);
141
146
  }
142
147
 
143
- /**
144
- * 运行基础数据
145
- * @param {Object} cg - 配置对象
146
- */
148
+ /**
149
+ * 运行基础数据
150
+ * @param {Object} cg - 配置对象
151
+ */
147
152
  Soa.prototype.initBase = function(cg) {
148
153
  var middleware = $.middleware;
149
154
  middleware.init();
@@ -197,6 +202,9 @@ Soa.prototype.initBase = function(cg) {
197
202
  $.sql.open();
198
203
  }
199
204
  }
205
+
206
+ // 启动计时器
207
+ $.timer.run();
200
208
  }
201
209
 
202
210
 
@@ -221,6 +229,12 @@ Soa.prototype.main = async function(state) {
221
229
  this.mqtt.run();
222
230
  tip += " mqtt";
223
231
  }
232
+
233
+ if (cg.sys && cg.sys.task) {
234
+ console.log('启动定时任务~');
235
+ $.task.update();
236
+ $.task.run();
237
+ }
224
238
  console.log(tip);
225
239
  };
226
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "1.6.9",
3
+ "version": "1.7.0",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {