mm_os 2.1.5 → 2.1.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.
@@ -268,12 +268,12 @@ Drive.prototype.loadSql = async function(file_path) {
268
268
  this.sql.load(p);
269
269
  this.setSql(this.sql);
270
270
  }
271
- if (this.sql && this.param && this.param.config) {
272
- var list = this.param.config.list;
273
- if (list && list.length) {
274
- this.sql.params = list;
275
- }
276
- }
271
+ // if (this.sql && this.param && this.param.config) {
272
+ // var list = this.param.config.list;
273
+ // if (list && list.length) {
274
+ // this.sql.params = list;
275
+ // }
276
+ // }
277
277
  }
278
278
  };
279
279
 
@@ -556,6 +556,18 @@ Drive.prototype.addOrSet = async function(db, query, body) {
556
556
  return await this.addOrSet_main(db, query, body);
557
557
  };
558
558
 
559
+ /**
560
+ * 获取数据类型
561
+ * @param {String} dataType 数据库数据类型
562
+ * @returns {String} 返回数据类型
563
+ */
564
+ Drive.prototype.get_type = function(dataType) {
565
+ if (dataType.indexOf('int') !== -1) {
566
+ return 'number'
567
+ } else {
568
+ return 'string'
569
+ }
570
+ }
559
571
 
560
572
  /**
561
573
  * 获取数据
@@ -593,11 +605,13 @@ Drive.prototype.get_params = async function(db, fields) {
593
605
  var list = await db.fields();
594
606
  for (var i = 0; i < list.length; i++) {
595
607
  var o = list[i];
608
+ console.log("值", o);
596
609
  var name = o.name;
597
610
  var note = o.note ? o.note.replace(":", ":") : name;
598
611
  lt.push({
599
612
  name,
600
- title: note.left(":", true)
613
+ title: note.left(":", true),
614
+ type: this.get_type(o.type)
601
615
  });
602
616
  }
603
617
  }
@@ -792,8 +806,15 @@ Drive.prototype.export_main = async function(db, query, body) {
792
806
  if (!file) {
793
807
  file = this.save_dir + name;
794
808
  }
795
- if (!fields && query.field) {
796
- fields = query.field;
809
+ if (!fields) {
810
+ if (query.field) {
811
+ fields = query.field;
812
+ } else {
813
+ var f = this.config.field_default;
814
+ if (f.length !== "*") {
815
+ fields = f;
816
+ }
817
+ }
797
818
  }
798
819
  var params = await this.get_params(db, fields);
799
820
  var format = await this.get_format(db);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {