xzwebx-httpfilter 2.2.7 → 2.2.9

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.
Files changed (2) hide show
  1. package/HttpFilter.js +41 -2
  2. package/package.json +4 -1
package/HttpFilter.js CHANGED
@@ -75,6 +75,16 @@ Fun.SetRoutes = function(app, express, projectPath) {
75
75
  app.use(ModuleMap[uri].uri, router)
76
76
  }
77
77
  }
78
+ Fun.SetMsg = function(req, res, next) {
79
+ res.Msg = response
80
+ return next()
81
+ }
82
+
83
+ Fun.SetCheckUrl = function(app) {
84
+ let p = ConfigMap[app.get('_PORT_')]
85
+ app.use(p.setMsg.bind(p))
86
+ app.use(p.checkUrl.bind(p))
87
+ }
78
88
 
79
89
  class http {
80
90
  constructor(){
@@ -167,10 +177,37 @@ class http {
167
177
  continue
168
178
  }
169
179
  let fatherFieldType = fCfgItem.fieldType
180
+
181
+ if (fCfgItem.isRecursed) {
182
+ if (fatherFieldType === 'LIST') {
183
+ for (let key in msgFieldMap) {
184
+ if (key == '__FieldCfg') {
185
+ continue
186
+ }
187
+
188
+ if (!msgFieldMap[key]['__FieldCfg'] || msgFieldMap[key]['__FieldCfg'].fieldType !== 'OBJ') {
189
+ continue
190
+ }
191
+
192
+ if (!msgFieldMap[key][fCfgItem.fieldCode]) {
193
+ let msgFieldMap1 = JSON.parse(JSON.stringify(msgFieldMap))
194
+ msgFieldMap1['__FieldCfg'].ifMust = 'NO'
195
+ msgFieldMap[key][fCfgItem.fieldCode] = msgFieldMap1
196
+ }
197
+ }
198
+ } else if (fatherFieldType === 'OBJ') {
199
+ if (!msgFieldMap[fCfgItem.fieldCode]) {
200
+ let msgFieldMap1 = JSON.parse(JSON.stringify(msgFieldMap))
201
+ msgFieldMap1['__FieldCfg'].ifMust = 'NO'
202
+ msgFieldMap[fCfgItem.fieldCode] = msgFieldMap1
203
+ }
204
+ }
205
+ }
206
+
170
207
  if (fatherFieldType == 'LIST' || (fatherFieldType == 'OBJ' && fCfgItem.keyType == 'VOBJ')) {
171
208
  if (isRoot) {
172
209
  retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data)
173
- } else {
210
+ } else if (data) {
174
211
  for (let idx in data) {
175
212
  retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data[idx])
176
213
  if (retMsgData) {
@@ -182,7 +219,9 @@ class http {
182
219
  if (isRoot) {
183
220
  retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data)
184
221
  } else {
185
- retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data[fieldName])
222
+ if (data) {
223
+ retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data[fieldName])
224
+ }
186
225
  }
187
226
  }
188
227
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xzwebx-httpfilter",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "main": "HttpFilter.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -12,5 +12,8 @@
12
12
  ],
13
13
  "author": "xzwebx",
14
14
  "license": "ISC",
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org/"
17
+ },
15
18
  "description": ""
16
19
  }