mm_os 1.8.4 → 1.8.6

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.
@@ -657,30 +657,40 @@ Drive.prototype.import_main = async function(db, file) {
657
657
  var params = await this.get_params(db);
658
658
  var format = await this.get_format(db);
659
659
 
660
- file = file.replace(this.url_path, this.save_dir);
661
- var path;
662
- if ($.config.path) {
663
- path = $.config.path.user || $.config.path.static || "/static/";
664
- } else {
665
- path = "/static/";
660
+ if (file.indexOf($.runPath) !== 0) {
661
+ file = file.replace(this.url_path, this.save_dir);
662
+ var path;
663
+ if ($.config.path) {
664
+ path = $.config.path.user || $.config.path.static || "/static/";
665
+ } else {
666
+ path = "/static/";
667
+ }
668
+ file = file.fullname(path);
666
669
  }
667
- file = file.fullname(path);
670
+
668
671
  if (!file.hasFile()) {
669
672
  return $.ret.error(30001, file + "文件不存在!");
670
673
  }
671
- var excel = new Excel({
672
- file,
673
- params,
674
- format
675
- });
674
+
676
675
  var jarr = [];
677
- try {
678
- jarr = await excel.load();
679
- } catch (e) {
680
- $.log.error("导入文件", e);
681
- } finally {
682
- excel.clear();
683
- excel = null;
676
+ if (file.endsWith(".json")) {
677
+ jarr = file.loadJson();
678
+ } else if (file.endsWith(".xml")) {
679
+ jarr = file.loadXml();
680
+ } else {
681
+ var excel = new Excel({
682
+ file,
683
+ params,
684
+ format
685
+ });
686
+ try {
687
+ jarr = await excel.load();
688
+ } catch (e) {
689
+ $.log.error("导入文件", e);
690
+ } finally {
691
+ excel.clear();
692
+ excel = null;
693
+ }
684
694
  }
685
695
 
686
696
  var list = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -36,7 +36,7 @@
36
36
  "koa-websocket": "^7.0.0",
37
37
  "mm_check": "^1.4.4",
38
38
  "mm_excel": "^1.1.5",
39
- "mm_expand": "^1.6.7",
39
+ "mm_expand": "^1.6.9",
40
40
  "mm_html": "^1.1.1",
41
41
  "mm_koa_proxy": "^1.0.0",
42
42
  "mm_logs": "^1.1.2",
@@ -48,7 +48,7 @@
48
48
  "mm_ret": "^1.3.7",
49
49
  "mm_session": "^1.4.1",
50
50
  "mm_statics": "^1.4.0",
51
- "mm_tpl": "^2.2.5",
51
+ "mm_tpl": "^2.2.7",
52
52
  "mm_xml": "^1.1.3",
53
53
  "mosca": "^2.8.3",
54
54
  "mqtt": "^4.3.7"