diff --git a/ais-structure/src/config/config.js b/ais-structure/src/config/config.js index cb1c862..f024ef7 100644 --- a/ais-structure/src/config/config.js +++ b/ais-structure/src/config/config.js @@ -25,9 +25,9 @@ var config = { }, D01:{ Name : "CMF DB", - GET_Customer_URL : "http://10.1.2.144:8080", + GET_Customer_URL : "http://localhost:8080", GET_Customer_Timeout : 10, - POST_Customer_URL : "http://10.1.2.144:8080", + POST_Customer_URL : "http://localhost:8080", POST_Customer_Timeout : 10 } diff --git a/ais-structure/src/modules/customer/postCustomer.ctrl.js b/ais-structure/src/modules/customer/postCustomer.ctrl.js index c7b2219..e56290d 100644 --- a/ais-structure/src/modules/customer/postCustomer.ctrl.js +++ b/ais-structure/src/modules/customer/postCustomer.ctrl.js @@ -31,7 +31,7 @@ exports.postCustomer = async function (req, res, next){ const result = await connection.requestJsonToD01(objectData,sendCmd,"POST"); if(typeof result.err === 'undefined'){ - console.log(result.response.body); + // console.log(result.response.body); var resultObj = JSON.parse(result.response.body); if(resultObj.resultCode.startsWith("40")) diff --git a/ais-structure/src/modules/helper/connection.js b/ais-structure/src/modules/helper/connection.js index cd3484d..f77b5ad 100644 --- a/ais-structure/src/modules/helper/connection.js +++ b/ais-structure/src/modules/helper/connection.js @@ -5,7 +5,7 @@ var request = require('request'); var messageSOAP = require('../helper/messageSOAP.js'); var connection = []; -connection.requestSoapToSPW = function (soap,cmd,myMethod) { +connection.requestSoapToSPW = async function (soap,cmd,myMethod) { var params = { url : cfg.service.SPW[myMethod+"_"+cmd+"_URL"], @@ -15,7 +15,7 @@ connection.requestSoapToSPW = function (soap,cmd,myMethod) { return asyncRequest(params,cmd,cfg.service.SPW.Name); }; -connection.requestJsonToD01 = function (obj,cmd,myMethod) { +connection.requestJsonToD01 = async function (obj,cmd,myMethod) { // JSON.stringify(json) var params = { @@ -32,8 +32,23 @@ connection.requestJsonToD01 = function (obj,cmd,myMethod) { { params.body = JSON.stringify(params.body); } + + var result = await asyncRequest(params,cmd,cfg.service.D01.Name); + + + // console.log(result); + if(result.response) + { + var data = JSON.parse(result.response.body); + + if(!data.resultCode) + result.err = "Miss resultCode"; + + if(!data.resultDescription) + result.err = "Miss resultDescription" + } - return asyncRequest(params,cmd,cfg.service.D01.Name); + return result; }; diff --git a/ais-structure/src/modules/helper/stats.js b/ais-structure/src/modules/helper/stats.js index e109a61..8ae5f25 100644 --- a/ais-structure/src/modules/helper/stats.js +++ b/ais-structure/src/modules/helper/stats.js @@ -1,5 +1,6 @@ var env = process.env.NODE_ENV || 'development'; var cfg = require('../../config/config.js').get(env); +var log = require('../helper/log.js'); var nodeName = cfg.app_name; var stat = []; @@ -26,7 +27,8 @@ stat.sendResponse = function (method,cmd,result){ }; function writeStats(string) { - console.log(string); + log.log(string); + // console.log(string); // console.log(cfg); } -- libgit2 0.21.2