diff --git a/ais-structure/src/modules/customer/customer.ctrl.js b/ais-structure/src/modules/customer/customer.ctrl.js index a66e97d..8353c09 100644 --- a/ais-structure/src/modules/customer/customer.ctrl.js +++ b/ais-structure/src/modules/customer/customer.ctrl.js @@ -2,11 +2,15 @@ var stats = require('../helper/stats.js'); var validatorHelper = require('../helper/validator.js'); var connection = require('../helper/connection.js'); var responseMsg = require('../helper/responseMsg.js'); +var log = require('../helper/log.js'); exports.customer = async function (req, res, next) { var getCmd = "Customer"; var sendCmd = "Customer"; + log.startlog(getCmd,req); + log.logDetail.addInput("Client",getCmd,"Request",req); + var err = validator(req,getCmd); if(err.length > 0) @@ -37,6 +41,9 @@ exports.customer = async function (req, res, next) { if(!response) var response = responseMsg.error(req,getCmd,50000); + log.logDetail.addOutput("Client",getCmd,"Response",response,response); + log.logDetail.write(); + // log.logSummary(); res.status(200).json(response); }; diff --git a/ais-structure/src/modules/helper/connection.js b/ais-structure/src/modules/helper/connection.js index 9d06067..b5f8c97 100644 --- a/ais-structure/src/modules/helper/connection.js +++ b/ais-structure/src/modules/helper/connection.js @@ -88,19 +88,14 @@ connection.requestJsonToD01 = async function (obj,cmd,myMethod) { params.url = genUrl[0]; delete params.body; - var result = await asyncRequest(params,cmd,cfg.service.D01.Name); + var result = await asyncRequest(params,cmd,service.Name); // console.log(result); if(result.response) { var data = JSON.parse(result.response.body); result.response = data; - - if(!data.resultCode) - result.err = "Miss resultCode"; - - if(!data.resultDescription) - result.err = "Miss resultDescription"; + } } @@ -109,23 +104,24 @@ connection.requestJsonToD01 = async function (obj,cmd,myMethod) { { params.body = JSON.stringify(params.body); - var resultRes = await asyncRequest(params,cmd,cfg.service.D01.Name); + var resultRes = await asyncRequest(params,cmd,service.Name); result.response = JSON.parse(resultRes.body); - // resultRes.body = JSON.parse(resultRes.body); - - // if(resultRes.body.resultCode === "20000"){ - // result.response.resultCode = resultRes.body.resultCode; - // result.response.developerMessage = "Success"; - // } else { - // result.response.resultCode = "50000"; - // result.response.developerMessage = "System error"; - // } + } + if(!result.response.resultCode) + result.err = "Miss resultCode"; + + if(!result.response.resultDescription) + result.err = "Miss resultDescription"; + // console.log(result); // delete result.body; + if(result.err) + stats.reciveResponse(service.Name,cmd,"Error"); + return result; @@ -190,24 +186,23 @@ function getUrl(params,limit) }; - params.body = {}; - params.body.a = "aaa"; - params.body.b = "bbb"; - params.body.papa = []; - params.body.papa.push("1"); - params.body.papa.push("2"); - params.body.commandId = []; - params.body.commandId.push("1"); - params.body.commandId.push("2"); - params.body.commandId.push("3"); - params.body.commandId.push("4"); - params.body.commandId.push("5"); - params.body.commandId.push("6"); - params.body.commandId.push("7"); - params.body.commandId.push("8"); - params.body.c = "ccc"; - - params.body.fields = "a,b,c,d"; + // params.body = {}; + // params.body.a = "aaa"; + // params.body.b = "bbb"; + // params.body.papa = []; + // params.body.papa.push("1"); + // params.body.papa.push("2"); + // params.body.commandId = []; + // params.body.commandId.push("1"); + // params.body.commandId.push("2"); + // params.body.commandId.push("3"); + // params.body.commandId.push("4"); + // params.body.commandId.push("5"); + // params.body.commandId.push("6"); + // params.body.commandId.push("7"); + // params.body.commandId.push("8"); + // params.body.c = "ccc"; + // params.body.fields = "a,b,c,d"; // console.log(params.body); if(params.body) { @@ -280,7 +275,7 @@ function getUrl(params,limit) // console.log(filter); // console.log(fields); - console.log(returnData); + // console.log(returnData); return returnData; } -- libgit2 0.21.2