Commit d923574ef52283a889d3a8fb1f52b3dab3337ddb
Exists in
master
and in
1 other branch
Merge branch 'master' of http://git.sourcecode.co.th/nattaponw/spw
Showing
5 changed files
with
29 additions
and
13 deletions
Show diff stats
ais-structure/src/config/express.js
ais-structure/src/modules/helper/constants.js
... | ... | @@ -37,23 +37,23 @@ module.exports = Object.freeze({ |
37 | 37 | RESPONSERESULT:{ |
38 | 38 | SUCCESS:{ |
39 | 39 | resultCode : '20000', |
40 | - resultDescription : 'Success' | |
40 | + developerMessage : 'Success' | |
41 | 41 | }, |
42 | 42 | MISSING_INVALID:{ |
43 | 43 | resultCode : '40300', |
44 | - resultDescription : 'Missing or invalid parameter' | |
44 | + developerMessage : 'Missing or invalid parameter' | |
45 | 45 | }, |
46 | 46 | DATA_NOT_FOUND:{ |
47 | 47 | resultCode : '40401', |
48 | - resultDescription : 'Data Not Found' | |
48 | + developerMessage : 'Data Not Found' | |
49 | 49 | }, |
50 | 50 | DATA_EXIST:{ |
51 | 51 | resultCode : '40301', |
52 | - resultDescription : 'Data Exist' | |
52 | + developerMessage : 'Data Exist' | |
53 | 53 | }, |
54 | 54 | ERROR:{ |
55 | 55 | resultCode : '50000', |
56 | - resultDescription : 'System error' | |
56 | + developerMessage : 'System error' | |
57 | 57 | }, |
58 | 58 | UNKNOW:{ |
59 | 59 | resultCode : '40400', | ... | ... |
ais-structure/src/modules/helper/responseMsg.js
... | ... | @@ -20,9 +20,6 @@ responseMsg.error = function (req,cmd,code){ |
20 | 20 | case 50000: |
21 | 21 | response = constants.RESPONSERESULT.ERROR; |
22 | 22 | break; |
23 | - case 40400: | |
24 | - response = constants.RESPONSERESULT.UNKNOW; | |
25 | - break; | |
26 | 23 | default: |
27 | 24 | response = constants.RESPONSERESULT.ERROR; |
28 | 25 | } |
... | ... | @@ -66,6 +63,12 @@ responseMsg.direct = function (req,cmd,result,data) |
66 | 63 | return response; |
67 | 64 | }; |
68 | 65 | |
69 | - | |
66 | +responseMsg.unknow = function (req) | |
67 | +{ | |
68 | + var response = constants.RESPONSERESULT.UNKNOW; | |
69 | + stats.receiveUnknow(response.developerMessage); | |
70 | + stats.sendUnknow(response.developerMessage); | |
71 | + return response; | |
72 | +}; | |
70 | 73 | |
71 | 74 | module.exports = responseMsg; |
72 | 75 | \ No newline at end of file | ... | ... |
ais-structure/src/modules/helper/stats.js
1 | 1 | var env = process.env.NODE_ENV || 'development'; |
2 | 2 | var cfg = require('../../config/config.js').get(env); |
3 | 3 | var log = require('../helper/log.js'); |
4 | +var constants = require('../helper/constants.js'); | |
4 | 5 | |
5 | 6 | var nodeName = cfg.app_name; |
6 | 7 | var stat = []; |
... | ... | @@ -57,7 +58,16 @@ stat.receiveBadResponse = function (fromNode,cmd,result){ |
57 | 58 | writeStats(nodeName+" Receive "+fromNode+" Bad "+cmd+" Response "); |
58 | 59 | }; |
59 | 60 | |
61 | +//unknow | |
62 | +// CMF Receive Unknown URL Request | |
63 | +// CMF Send Unknown URL | |
64 | +stat.receiveUnknow = function(message){ | |
65 | + writeStats(nodeName+" Receive "+message+" "+constants.REQUEST); | |
66 | +}; | |
60 | 67 | |
68 | +stat.sendUnknow = function(message){ | |
69 | + writeStats(nodeName+" Send "+message); | |
70 | +}; | |
61 | 71 | |
62 | 72 | function writeStats(string) { |
63 | 73 | log.log(string); | ... | ... |
ais-structure/src/modules/vizcard/vizCard.ctrl.js
... | ... | @@ -82,10 +82,13 @@ exports.vizcard = async function (req, res, next) { |
82 | 82 | stats.receiveSACFResponse(sacf,sendCmd,"Error"); |
83 | 83 | } |
84 | 84 | |
85 | - log.logDetail.addOutput(sacf,getCmd,constant.RESPONSE,response,response); | |
86 | - res.status(200).json(response); | |
87 | - next(); | |
85 | + | |
88 | 86 | } |
87 | + | |
88 | + // console.log(response); | |
89 | + log.logDetail.addOutput(sacf,getCmd,constant.RESPONSE,response,response); | |
90 | + res.status(200).json(response); | |
91 | + next(); | |
89 | 92 | }; |
90 | 93 | |
91 | 94 | ... | ... |