xzwebx-httpfilter 2.2.9 → 2.4.2
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/HttpFilter.js +7 -31
- package/package.json +1 -1
package/HttpFilter.js
CHANGED
|
@@ -5,6 +5,9 @@ const Path = require('path')
|
|
|
5
5
|
let ConfigMap = {}
|
|
6
6
|
let Fun = {}
|
|
7
7
|
|
|
8
|
+
Fun.GetHttpFilterObj = function(port) {
|
|
9
|
+
return ConfigMap[port]
|
|
10
|
+
}
|
|
8
11
|
Fun.SetModuleMap = function(port, m) {
|
|
9
12
|
if (!ConfigMap[port]) {
|
|
10
13
|
ConfigMap[port] = new http()
|
|
@@ -119,6 +122,8 @@ class http {
|
|
|
119
122
|
return res.Msg({codeKey: 'CLT_ERR', msg: ['WEBX_ERR_URL']})
|
|
120
123
|
}
|
|
121
124
|
|
|
125
|
+
req.moduleInfo = module
|
|
126
|
+
res.moduleInfo = module
|
|
122
127
|
req.interfaceInfo = this.ModuleInterfaceMap[module.id][subUri][req.method.toLowerCase()]
|
|
123
128
|
res.interfaceInfo = this.ModuleInterfaceMap[module.id][subUri][req.method.toLowerCase()]
|
|
124
129
|
return next()
|
|
@@ -177,37 +182,10 @@ class http {
|
|
|
177
182
|
continue
|
|
178
183
|
}
|
|
179
184
|
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
|
-
|
|
207
185
|
if (fatherFieldType == 'LIST' || (fatherFieldType == 'OBJ' && fCfgItem.keyType == 'VOBJ')) {
|
|
208
186
|
if (isRoot) {
|
|
209
187
|
retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data)
|
|
210
|
-
} else
|
|
188
|
+
} else {
|
|
211
189
|
for (let idx in data) {
|
|
212
190
|
retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data[idx])
|
|
213
191
|
if (retMsgData) {
|
|
@@ -219,9 +197,7 @@ class http {
|
|
|
219
197
|
if (isRoot) {
|
|
220
198
|
retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data)
|
|
221
199
|
} else {
|
|
222
|
-
|
|
223
|
-
retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data[fieldName])
|
|
224
|
-
}
|
|
200
|
+
retMsgData = this.cycleCheckParams(msgFieldMap[fieldName], data[fieldName])
|
|
225
201
|
}
|
|
226
202
|
}
|
|
227
203
|
|