Commit 9354f8c50c38b41682e1d9744afcd5a56f86d88d
1 parent
0ec6fba7
Exists in
master
and in
1 other branch
fix bug
Showing
4 changed files
with
24 additions
and
7 deletions
Show diff stats
ais-structure/src/config/config.js
... | ... | @@ -25,9 +25,9 @@ var config = { |
25 | 25 | }, |
26 | 26 | D01:{ |
27 | 27 | Name : "CMF DB", |
28 | - GET_Customer_URL : "http://10.1.2.144:8080", | |
28 | + GET_Customer_URL : "http://localhost:8080", | |
29 | 29 | GET_Customer_Timeout : 10, |
30 | - POST_Customer_URL : "http://10.1.2.144:8080", | |
30 | + POST_Customer_URL : "http://localhost:8080", | |
31 | 31 | POST_Customer_Timeout : 10 |
32 | 32 | |
33 | 33 | } | ... | ... |
ais-structure/src/modules/customer/postCustomer.ctrl.js
... | ... | @@ -31,7 +31,7 @@ exports.postCustomer = async function (req, res, next){ |
31 | 31 | const result = await connection.requestJsonToD01(objectData,sendCmd,"POST"); |
32 | 32 | |
33 | 33 | if(typeof result.err === 'undefined'){ |
34 | - console.log(result.response.body); | |
34 | + // console.log(result.response.body); | |
35 | 35 | var resultObj = JSON.parse(result.response.body); |
36 | 36 | |
37 | 37 | if(resultObj.resultCode.startsWith("40")) | ... | ... |
ais-structure/src/modules/helper/connection.js
... | ... | @@ -5,7 +5,7 @@ var request = require('request'); |
5 | 5 | var messageSOAP = require('../helper/messageSOAP.js'); |
6 | 6 | var connection = []; |
7 | 7 | |
8 | -connection.requestSoapToSPW = function (soap,cmd,myMethod) { | |
8 | +connection.requestSoapToSPW = async function (soap,cmd,myMethod) { | |
9 | 9 | |
10 | 10 | var params = { |
11 | 11 | url : cfg.service.SPW[myMethod+"_"+cmd+"_URL"], |
... | ... | @@ -15,7 +15,7 @@ connection.requestSoapToSPW = function (soap,cmd,myMethod) { |
15 | 15 | |
16 | 16 | return asyncRequest(params,cmd,cfg.service.SPW.Name); |
17 | 17 | }; |
18 | -connection.requestJsonToD01 = function (obj,cmd,myMethod) { | |
18 | +connection.requestJsonToD01 = async function (obj,cmd,myMethod) { | |
19 | 19 | |
20 | 20 | // JSON.stringify(json) |
21 | 21 | var params = { |
... | ... | @@ -32,8 +32,23 @@ connection.requestJsonToD01 = function (obj,cmd,myMethod) { |
32 | 32 | { |
33 | 33 | params.body = JSON.stringify(params.body); |
34 | 34 | } |
35 | + | |
36 | + var result = await asyncRequest(params,cmd,cfg.service.D01.Name); | |
37 | + | |
38 | + | |
39 | + // console.log(result); | |
40 | + if(result.response) | |
41 | + { | |
42 | + var data = JSON.parse(result.response.body); | |
43 | + | |
44 | + if(!data.resultCode) | |
45 | + result.err = "Miss resultCode"; | |
46 | + | |
47 | + if(!data.resultDescription) | |
48 | + result.err = "Miss resultDescription" | |
49 | + } | |
35 | 50 | |
36 | - return asyncRequest(params,cmd,cfg.service.D01.Name); | |
51 | + return result; | |
37 | 52 | |
38 | 53 | |
39 | 54 | }; | ... | ... |
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 | +var log = require('../helper/log.js'); | |
3 | 4 | |
4 | 5 | var nodeName = cfg.app_name; |
5 | 6 | var stat = []; |
... | ... | @@ -26,7 +27,8 @@ stat.sendResponse = function (method,cmd,result){ |
26 | 27 | }; |
27 | 28 | |
28 | 29 | function writeStats(string) { |
29 | - console.log(string); | |
30 | + log.log(string); | |
31 | + // console.log(string); | |
30 | 32 | // console.log(cfg); |
31 | 33 | } |
32 | 34 | ... | ... |