mm_os 3.0.2 → 3.0.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.
- package/index.js +9 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -90,9 +90,9 @@ OS.prototype.initData = function(config) {
|
|
|
90
90
|
} else if (p.substring(p.length - 1) !== $.slash) {
|
|
91
91
|
config.runPath += $.slash;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
$.runPath = config.runPath;
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
// 初始化公共函数
|
|
97
97
|
$.func = {};
|
|
98
98
|
|
|
@@ -151,9 +151,6 @@ OS.prototype.loadModule = function(cg) {
|
|
|
151
151
|
$.sql = $.mysql_admin('sys', $.runPath);
|
|
152
152
|
if (cg.mysql) {
|
|
153
153
|
$.sql.setConfig(cg.mysql);
|
|
154
|
-
if (cg.mysql.state) {
|
|
155
|
-
$.sql.open();
|
|
156
|
-
}
|
|
157
154
|
}
|
|
158
155
|
|
|
159
156
|
if (!cg.sys.hot_reload) {
|
|
@@ -201,8 +198,6 @@ OS.prototype.initBase = function(cg) {
|
|
|
201
198
|
this.mqtt = mqtt;
|
|
202
199
|
}
|
|
203
200
|
|
|
204
|
-
// 启动计时器
|
|
205
|
-
$.timer.run();
|
|
206
201
|
}
|
|
207
202
|
|
|
208
203
|
/**
|
|
@@ -210,6 +205,9 @@ OS.prototype.initBase = function(cg) {
|
|
|
210
205
|
* @param {String} state 状态
|
|
211
206
|
*/
|
|
212
207
|
OS.prototype.main = async function(state) {
|
|
208
|
+
// 启动计时器
|
|
209
|
+
$.timer.run();
|
|
210
|
+
|
|
213
211
|
var cg = this.config;
|
|
214
212
|
var web_server = this.web_server;
|
|
215
213
|
var mqtt_server = this.mqtt_server;
|
|
@@ -243,6 +241,10 @@ OS.prototype.main = async function(state) {
|
|
|
243
241
|
* @param {String} state 状态
|
|
244
242
|
*/
|
|
245
243
|
OS.prototype.before = async function(state) {
|
|
244
|
+
var mysql = this.config.mysql;
|
|
245
|
+
if (mysql && mysql.state) {
|
|
246
|
+
await $.sql.open();
|
|
247
|
+
}
|
|
246
248
|
this.app = $.app_admin('sys');
|
|
247
249
|
await this.app.update();
|
|
248
250
|
await this.app.exec(null, 'init');
|