doomiwork 4.0.2 → 4.0.4

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.
@@ -201,7 +201,7 @@ class controller {
201
201
  * 返回数据结果的记录总数
202
202
  * @param {*} data
203
203
  */
204
- async getListRecordCount(data){
204
+ async getListRecordCount(result){
205
205
  return result.rows[1][0].total;
206
206
  }
207
207
  /*
@@ -29,6 +29,14 @@ class Database {
29
29
  escape(value) {
30
30
  return mysql.escape(value);
31
31
  }
32
+ /**
33
+ * 给字段名添加``
34
+ * @param {*} value
35
+ * @returns
36
+ */
37
+ escapeId(value){
38
+ return mysql.escapeId(value)
39
+ }
32
40
  /**
33
41
  * 记录错误日志
34
42
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doomiwork",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "doomisoft nodejs web framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@ const moment = require('moment')
9
9
  * 或者已固定的方式解析关键字
10
10
  */
11
11
  module.exports.parseKeyValue=(req,str)=>{
12
- if (!str) return str;
12
+ if (!str) return str||'';
13
13
  const strItems = str.split('.');
14
14
  if (strItems.length===1)
15
15
  {
@@ -26,7 +26,7 @@ module.exports.parseKeyValue=(req,str)=>{
26
26
  return null;
27
27
  case "now()": return moment().format('YYYY-MM-DD HH:mm:ss');
28
28
  case "null()": return null;
29
- default: return (req.body && req.body[str])||(req.query && req.query[str]);
29
+ default: return (req.body && req.body[str])||(req.query && req.query[str])||'';
30
30
  }
31
31
  }
32
32
  else
@@ -43,7 +43,7 @@ module.exports.parseKeyValue=(req,str)=>{
43
43
  case "user": collection = req.user || {}; break;
44
44
  default: collection = req.body; break;
45
45
  }
46
- if (collection) return collection[strItems[1]];
46
+ if (collection) return collection[strItems[1]] || '';
47
47
  return '';
48
48
  }
49
49
  }
@@ -63,7 +63,7 @@ module.exports.parseTagInSql = (req, sql, allowNull = true) => {
63
63
  ///是否有格式要求
64
64
  let validformat = matchValue.split('|');
65
65
  matchValue = validformat[0];
66
- let keyValue = parseKeyValue(req, matchValue) + ''; //utility.ifNull(keyParse.parseKeyValue(req, matchValue), '')+'';
66
+ let keyValue = (parseKeyValue(req, matchValue) || '')+''; //utility.ifNull(keyParse.parseKeyValue(req, matchValue), '')+'';
67
67
  if (!keyValue) {
68
68
  parseKeyWordIsNull = true;
69
69
  } else if (typeof (keyValue) === 'string') {