Commit afef30b0ffdde179658c37a8f3fc69cf32cdee80
1 parent
3aa57883
Exists in
master
and in
1 other branch
fix bug detail log and add parameter dateCreate
Showing
2 changed files
with
7 additions
and
1 deletions
Show diff stats
ais-structure/src/modules/helper/connection.js
@@ -5,6 +5,7 @@ var request = require('request'); | @@ -5,6 +5,7 @@ var request = require('request'); | ||
5 | var messageSOAP = require('../helper/messageSOAP.js'); | 5 | var messageSOAP = require('../helper/messageSOAP.js'); |
6 | var log = require('../helper/log.js'); | 6 | var log = require('../helper/log.js'); |
7 | var constants = require('../helper/constants.js'); | 7 | var constants = require('../helper/constants.js'); |
8 | +var moment = require('moment'); | ||
8 | 9 | ||
9 | var connection = []; | 10 | var connection = []; |
10 | 11 | ||
@@ -64,6 +65,9 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) { | @@ -64,6 +65,9 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) { | ||
64 | 65 | ||
65 | log.log("Connect to D01") | 66 | log.log("Connect to D01") |
66 | 67 | ||
68 | + if(myMethod === constants.METHOD.POST) | ||
69 | + obj.dateCreate = moment().format("YYYY-MM-DDTHH:mm:ss+0700"); | ||
70 | + | ||
67 | var service = cfg.service.D01; | 71 | var service = cfg.service.D01; |
68 | var retry = service[myMethod+"_"+cmd+"_Retry"]; | 72 | var retry = service[myMethod+"_"+cmd+"_Retry"]; |
69 | if(!retry) | 73 | if(!retry) |
@@ -176,6 +180,7 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) { | @@ -176,6 +180,7 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) { | ||
176 | 180 | ||
177 | 181 | ||
178 | } else if(params.method == constants.METHOD.POST) { | 182 | } else if(params.method == constants.METHOD.POST) { |
183 | + | ||
179 | params.body = JSON.stringify(params.body); | 184 | params.body = JSON.stringify(params.body); |
180 | 185 | ||
181 | var resultRes = await asyncRequest(params,objectData,funStats); | 186 | var resultRes = await asyncRequest(params,objectData,funStats); |
ais-structure/src/modules/membercard/postMembership.ctrl.js
@@ -86,7 +86,6 @@ exports.postMembership = async function (req, res, next){ | @@ -86,7 +86,6 @@ exports.postMembership = async function (req, res, next){ | ||
86 | cardId : req.body.cardId | 86 | cardId : req.body.cardId |
87 | } | 87 | } |
88 | } | 88 | } |
89 | - | ||
90 | } | 89 | } |
91 | 90 | ||
92 | if(typeof result.err === 'undefined'){ | 91 | if(typeof result.err === 'undefined'){ |
@@ -171,6 +170,7 @@ async function getCustomerD01(req, data){ | @@ -171,6 +170,7 @@ async function getCustomerD01(req, data){ | ||
171 | }; | 170 | }; |
172 | 171 | ||
173 | const resultCustomer = await connection.requestJsonToD01(req, data.reqCustomer, data.cmd, data.method); | 172 | const resultCustomer = await connection.requestJsonToD01(req, data.reqCustomer, data.cmd, data.method); |
173 | + log.logDetail.addInput(req,d01, getMethod+"_"+sendCustomerCmd, constant.RESPONSE, resultCustomer, resultCustomer.response); | ||
174 | var resultObj = resultCustomer.response | 174 | var resultObj = resultCustomer.response |
175 | 175 | ||
176 | if(typeof resultCustomer.err === 'undefined'){ | 176 | if(typeof resultCustomer.err === 'undefined'){ |
@@ -206,6 +206,7 @@ async function postMemberCardD01(req, data){ | @@ -206,6 +206,7 @@ async function postMemberCardD01(req, data){ | ||
206 | 206 | ||
207 | 207 | ||
208 | const resultCustomer = await connection.requestJsonToD01(req,data.reqMembership, data.cmd, data.method, data.filter); | 208 | const resultCustomer = await connection.requestJsonToD01(req,data.reqMembership, data.cmd, data.method, data.filter); |
209 | + log.logDetail.addInput(req,d01, data.method+"_"+sendMemberCardCmd, constant.RESPONSE, resultCustomer, resultCustomer.response); | ||
209 | var resultObj = resultCustomer.response | 210 | var resultObj = resultCustomer.response |
210 | 211 | ||
211 | if(typeof resultCustomer.err === 'undefined'){ | 212 | if(typeof resultCustomer.err === 'undefined'){ |