xzwebx-httpfilter 2.2.2 → 2.2.3

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 +38 -36
  2. package/package.json +1 -1
package/HttpFilter.js CHANGED
@@ -29,52 +29,54 @@ function Init(language, resultCodeMap, tipsMap, moduleMap, moduleInterfaceMap, f
29
29
  ModuleInterfaceMap = moduleInterfaceMap
30
30
  FieldMap = fieldMap
31
31
  }
32
- function MSG(params, rspMsgId) {
33
- if (IsCheckedRes && this.interfaceInfo.rspMsgId) {
34
- let retMsgData = cycleCheckParams(FieldMap[rspMsgId], params.data)
32
+ function MSG(params) {
33
+ if (IsCheckedRes &&
34
+ this.interfaceInfo.rspMsgId &&
35
+ params.codeKey == 'SUCC') {
36
+ let retMsgData = cycleCheckParams(FieldMap[this.interfaceInfo.rspMsgId], params.data)
35
37
  if (retMsgData) {
36
- return MSG({codeKey: 'CLT_ERR', msg: retMsgData, data: params.data})
37
- }
38
- } else {
39
- let code = ''
40
- if (ResultCodeMap[params.codeKey]) {
41
- code = ResultCodeMap[params.codeKey].rstCode
38
+ params.codeKey = 'SVC_ERR'
39
+ params.msg = retMsgData
42
40
  }
41
+ }
42
+ let code = ''
43
+ if (ResultCodeMap[params.codeKey]) {
44
+ code = ResultCodeMap[params.codeKey].rstCode
45
+ }
43
46
 
44
- let msg = ''
45
- if (!params.msg) {
46
- if (TipsMap[params.codeKey]) {
47
- msg = TipsMap[params.codeKey].tips
48
- } else {
49
- msg = ResultCodeMap[params.codeKey].codeDesc
50
- }
47
+ let msg = ''
48
+ if (!params.msg) {
49
+ if (TipsMap[params.codeKey]) {
50
+ msg = TipsMap[params.codeKey].tips
51
51
  } else {
52
- if (typeof params.msg == 'string') {
53
- msg = params.msg
54
- }
52
+ msg = ResultCodeMap[params.codeKey].codeDesc
53
+ }
54
+ } else {
55
+ if (typeof params.msg == 'string') {
56
+ msg = params.msg
57
+ }
55
58
 
56
- if (typeof params.msg == 'object' && params.msg.length) {
57
- if (TipsMap[params.msg[0]]) {
58
- msg = TipsMap[params.msg[0]].tips
59
- if (params.msg.length > 1) {
60
- for (let i = 1; i < params.msg.length; i++) {
61
- msg = Util.format(msg, params.msg[i])
62
- }
59
+ if (typeof params.msg == 'object' && params.msg.length) {
60
+ if (TipsMap[params.msg[0]]) {
61
+ msg = TipsMap[params.msg[0]].tips
62
+ if (params.msg.length > 1) {
63
+ for (let i = 1; i < params.msg.length; i++) {
64
+ msg = Util.format(msg, params.msg[i])
63
65
  }
64
- } else {
65
- msg = params.msg[0]
66
66
  }
67
+ } else {
68
+ msg = params.msg[0]
67
69
  }
68
70
  }
69
-
70
- return this.send(
71
- {
72
- code: code,
73
- msg: msg,
74
- data: params.data
75
- }
76
- )
77
71
  }
72
+
73
+ return this.send(
74
+ {
75
+ code: code,
76
+ msg: msg,
77
+ data: params.data
78
+ }
79
+ )
78
80
  }
79
81
  function SetRoutes(app, express, projectPath) {
80
82
  for (let uri in ModuleMap) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xzwebx-httpfilter",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "main": "HttpFilter.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"