mm_os 4.0.9 → 4.1.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.
package/com/api/drive.js CHANGED
@@ -131,7 +131,7 @@ Drive.prototype.getParam = function (file) {
131
131
  */
132
132
  Drive.prototype._loadParam = async function (file_path) {
133
133
  if (file_path) {
134
- var p = file_path.fullname(this._getDir());
134
+ var p = file_path.fullname(this.getDir());
135
135
  var param = this.getParam(p);
136
136
  if (param) {
137
137
  this.param = param;
@@ -197,7 +197,7 @@ Drive.prototype.getSql = function (file) {
197
197
  */
198
198
  Drive.prototype._loadSql = async function (file_path) {
199
199
  if (file_path) {
200
- var p = file_path.fullname(this._getDir());
200
+ var p = file_path.fullname(this.getDir());
201
201
  var sql = this.getSql(p);
202
202
  if (sql) {
203
203
  this.sql = sql;
@@ -216,7 +216,7 @@ Drive.prototype._loadSql = async function (file_path) {
216
216
  Drive.prototype._loadOauth = function () {
217
217
  var cg = this.config.oauth;
218
218
  if (cg) {
219
- this.oauth = new Oauth(this._getDir());
219
+ this.oauth = new Oauth(this.getDir());
220
220
  this.oauth.loadObj(cg);
221
221
  }
222
222
  };
@@ -693,7 +693,7 @@ Drive.prototype.plugin = function (app, name) {
693
693
  */
694
694
  Drive.prototype.getModel = function (type) {
695
695
  let model = { ...this.config };
696
- let dir = this._getDir();
696
+ let dir = this.getDir();
697
697
  let l = $.slash;
698
698
  let app_name = dir.between('app' + l, l);
699
699
  let plugin_name = dir.between('plugin' + l, l);
package/com/api/oauth.js CHANGED
@@ -38,7 +38,7 @@ Oauth.prototype.loadObj = function (obj) {
38
38
  $.push(this.config, obj);
39
39
  var f = this.config.main;
40
40
  if (f) {
41
- var file = f.fullname(this._getDir());
41
+ var file = f.fullname(this.getDir());
42
42
  if (file.hasFile()) {
43
43
  var cs = require(file);
44
44
  if (cs) {
package/com/cmd/drive.js CHANGED
@@ -1534,7 +1534,7 @@ Drive.prototype.plugin = function (app, name) {
1534
1534
  */
1535
1535
  Drive.prototype.getModel = function (type) {
1536
1536
  let model = { ...this.config };
1537
- let dir = this._getDir();
1537
+ let dir = this.getDir();
1538
1538
  let l = $.slash;
1539
1539
  let app_name = dir.between('app' + l, l);
1540
1540
  let plugin_name = dir.between('plugin' + l, l);
package/com/db/drive.js CHANGED
@@ -1985,7 +1985,7 @@ Drive.prototype.newApi = async function (client, manage, cover) {
1985
1985
  */
1986
1986
  Drive.prototype.getModel = function (type) {
1987
1987
  let model = { ...this.config };
1988
- let dir = this._getDir();
1988
+ let dir = this.getDir();
1989
1989
  let l = $.slash;
1990
1990
  let app_name = dir.between('app' + l, l);
1991
1991
  let plugin_name = dir.between('plugin' + l, l);
@@ -35,7 +35,7 @@ class Drive extends Item {
35
35
  */
36
36
  Drive.prototype.getModel = function (type) {
37
37
  let model = { ...this.config };
38
- let dir = this._getDir();
38
+ let dir = this.getDir();
39
39
  let l = $.slash;
40
40
  let app_name = dir.between('app' + l, l);
41
41
  let plugin_name = dir.between('plugin' + l, l);
@@ -56,7 +56,7 @@ class Event extends Manager {
56
56
  * 是否懒加载
57
57
  * @type {boolean}
58
58
  */
59
- lazy_load: false,
59
+ lazy_load: true,
60
60
  /**
61
61
  * 模式
62
62
  * 1.生产模式,改变文件不会重新加载
@@ -249,6 +249,9 @@ Event.prototype.runSub = async function (list, target, ctx, db) {
249
249
  let mod = this.getMod(info.name);
250
250
  if (mod && this.isMatch(target, mod.config.target)) {
251
251
  try {
252
+ if (!mod.isLoaded()) {
253
+ await mod.call('loadScript');
254
+ }
252
255
  var ret = await mod.run(ctx, db);
253
256
  if (this.mode > 4) {
254
257
  mod.do('reload');
@@ -332,7 +335,6 @@ Event.prototype.after = async function (target, ctx, db) {
332
335
  * @returns {object} 执行结果
333
336
  */
334
337
  Event.prototype.run = async function (target, ctx, db = {}) {
335
- console.log('执行事件', target);
336
338
  var ret = await this.before(target, ctx, db);
337
339
  if (!ret) {
338
340
  ret = await this.check(target, ctx, db);
package/com/mqtt/drive.js CHANGED
@@ -662,7 +662,7 @@ Drive.prototype.plugin = function (app, name) {
662
662
  */
663
663
  Drive.prototype.getModel = function (type) {
664
664
  let model = { ...this.config };
665
- let dir = this._getDir();
665
+ let dir = this.getDir();
666
666
  let l = $.slash;
667
667
  let app_name = dir.between('app' + l, l);
668
668
  let plugin_name = dir.between('plugin' + l, l);
package/com/nav/drive.js CHANGED
@@ -688,7 +688,7 @@ Drive.prototype.updateVue = async function (route_path, cover) {
688
688
  */
689
689
  Drive.prototype.getModel = function (type) {
690
690
  let model = { ...this.config };
691
- let dir = this._getDir();
691
+ let dir = this.getDir();
692
692
  let l = $.slash;
693
693
  let app_name = dir.between('app' + l, l);
694
694
  let plugin_name = dir.between('plugin' + l, l);
@@ -488,7 +488,7 @@ Drive.prototype.main = function (model, value) {
488
488
  */
489
489
  Drive.prototype.getModel = function (type) {
490
490
  let model = { ...this.config };
491
- let dir = this._getDir();
491
+ let dir = this.getDir();
492
492
  let l = $.slash;
493
493
  let app_name = dir.between('app' + l, l);
494
494
  let plugin_name = dir.between('plugin' + l, l);
@@ -152,7 +152,7 @@ Drive.prototype.designOption = function (body) {
152
152
  */
153
153
  Drive.prototype.tpl = async function (ctx, db) {
154
154
  var html_file = this.config.template || './pendant.html';
155
- return html_file.fullname(this._getDir()).loadText();
155
+ return html_file.fullname(this.getDir()).loadText();
156
156
  };
157
157
 
158
158
  /**
@@ -164,7 +164,7 @@ Drive.prototype.tpl = async function (ctx, db) {
164
164
  Drive.prototype.main = async function (ctx, db) {
165
165
  var model = {};
166
166
  var html_file = this.config.template || './pendant.html';
167
- return db.tpl.view(html_file.fullname(this._getDir()), model);
167
+ return db.tpl.view(html_file.fullname(this.getDir()), model);
168
168
  };
169
169
 
170
170
  /**
@@ -173,7 +173,7 @@ Drive.prototype.main = async function (ctx, db) {
173
173
  * @returns {string} 打包成功返回压缩包文件地址
174
174
  */
175
175
  Drive.prototype.zip = async function (zip_dir = '/static/file/zip/') {
176
- var dir = this._getDir();
176
+ var dir = this.getDir();
177
177
  var file = ('./' + this.config.name + '.zip').fullname(zip_dir);
178
178
  file.addDir();
179
179
  await compressing.zip.compressDir(dir, file);
@@ -190,7 +190,7 @@ Drive.prototype.zip = async function (zip_dir = '/static/file/zip/') {
190
190
  */
191
191
  Drive.prototype.getModel = function (type) {
192
192
  let model = { ...this.config };
193
- let dir = this._getDir();
193
+ let dir = this.getDir();
194
194
  let l = $.slash;
195
195
  let app_name = dir.between('app' + l, l);
196
196
  let plugin_name = dir.between('plugin' + l, l);
@@ -638,7 +638,7 @@ Drive.prototype.plugin = function (app, name) {
638
638
  */
639
639
  Drive.prototype.getModel = function (type) {
640
640
  let model = { ...this.config };
641
- let dir = this._getDir();
641
+ let dir = this.getDir();
642
642
  let l = $.slash;
643
643
  let app_name = dir.between('app' + l, l);
644
644
  let plugin_name = dir.between('plugin' + l, l);
package/com/sql/drive.js CHANGED
@@ -1246,7 +1246,7 @@ Drive.prototype.count = async function (db, query, body) {
1246
1246
  */
1247
1247
  Drive.prototype.getModel = function (type) {
1248
1248
  let model = { ...this.config };
1249
- let dir = this._getDir();
1249
+ let dir = this.getDir();
1250
1250
  let l = $.slash;
1251
1251
  let app_name = dir.between('app' + l, l);
1252
1252
  let plugin_name = dir.between('plugin' + l, l);
@@ -179,7 +179,7 @@ Drive.prototype._getName = function (file) {
179
179
  */
180
180
  Drive.prototype.getModel = function (type) {
181
181
  let model = { ...this.config };
182
- let dir = this._getDir();
182
+ let dir = this.getDir();
183
183
  let l = $.slash;
184
184
  let app_name = dir.between('app' + l, l);
185
185
  let plugin_name = dir.between('plugin' + l, l);
package/com/task/drive.js CHANGED
@@ -391,7 +391,7 @@ Drive.prototype.plugin = function (app, name) {
391
391
  */
392
392
  Drive.prototype.getModel = function (type) {
393
393
  let model = { ...this.config };
394
- let dir = this._getDir();
394
+ let dir = this.getDir();
395
395
  let l = $.slash;
396
396
  let app_name = dir.between('app' + l, l);
397
397
  let plugin_name = dir.between('plugin' + l, l);
@@ -35,7 +35,7 @@ class Drive extends Item {
35
35
  Drive.prototype.zip = async function (zip_dir = "/static/file/zip/") {
36
36
  var file = ("./" + this.config.name + '.zip').fullname(zip_dir);
37
37
  file.addDir();
38
- var done = await compressing.zip.compressDir(this._getDir(), file);
38
+ var done = await compressing.zip.compressDir(this.getDir(), file);
39
39
  if (file.hasFile()) {
40
40
  return file;
41
41
  }
@@ -63,7 +63,7 @@ Drive.prototype.update = async function () {
63
63
  */
64
64
  Drive.prototype.getModel = function (type) {
65
65
  let model = { ...this.config };
66
- let dir = this._getDir();
66
+ let dir = this.getDir();
67
67
  let l = $.slash;
68
68
  let app_name = dir.between('app' + l, l);
69
69
  let plugin_name = dir.between('plugin' + l, l);
@@ -9,7 +9,10 @@ module.exports = {
9
9
  */
10
10
  async _init(apapter, eventer) {
11
11
  var event = $.admin.event('api', 'API事件');
12
- await event.call('update');
12
+ // await event.call('update', 'app/');
13
+ await event.do('init');
14
+ await event.runAll('load');
15
+ event.runAll('init');
13
16
  },
14
17
  /**
15
18
  * 主要逻辑
@@ -63,7 +63,7 @@ module.exports = {
63
63
  _setupGlobalStatic(web) {
64
64
  if ($.admin.static) {
65
65
  $.static = new $.admin.static();
66
- $.static.call('update');
66
+ $.static.call('update', 'app/');
67
67
 
68
68
  web.use(async (ctx, next) => {
69
69
  await $.static.run(ctx, next);