From 5a93fae2575364f4f6edd5b3d975ed60e6034b2c Mon Sep 17 00:00:00 2001 From: Nattapon Wongpaet Date: Fri, 17 Aug 2018 14:33:26 +0700 Subject: [PATCH] fix bug --- ais-structure/src/modules/customer/customer.ctrl.js | 14 -------------- ais-structure/src/modules/customer/customer.route.js | 2 +- ais-structure/src/modules/customer/postCustomer.ctrl.js | 10 ---------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/ais-structure/src/modules/customer/customer.ctrl.js b/ais-structure/src/modules/customer/customer.ctrl.js index 912b6a1..c0a9e8f 100644 --- a/ais-structure/src/modules/customer/customer.ctrl.js +++ b/ais-structure/src/modules/customer/customer.ctrl.js @@ -12,24 +12,15 @@ exports.customer = async function (req, res, next) { if(err.length > 0) { console.log(err); - var response = responseMsg.error(req,getCmd,40300); - // res.status(200).json(response); }else { - var objectData = req.query; - const result = await connection.requestJsonToD01(objectData,sendCmd,"GET"); - - if(typeof result.err === 'undefined'){ - // console.log(result.response.body); - var resultObj = JSON.parse(result.response.body); - if(resultObj.resultCode == "20000") { if(resultObj.resultData && resultObj.resultData.length>0) @@ -39,13 +30,8 @@ exports.customer = async function (req, res, next) { { var response = responseMsg.error(req,getCmd,40300); } - } - - } - - } if(!response) diff --git a/ais-structure/src/modules/customer/customer.route.js b/ais-structure/src/modules/customer/customer.route.js index 28ef46c..0624229 100644 --- a/ais-structure/src/modules/customer/customer.route.js +++ b/ais-structure/src/modules/customer/customer.route.js @@ -6,7 +6,7 @@ module.exports = function (app) { customerCtrl.customer ); - app.post('/cmf/v2/customer/customerId.json', + app.post('/cmf/v2/customer.json', postCustomerCtrl.postCustomer ); }; diff --git a/ais-structure/src/modules/customer/postCustomer.ctrl.js b/ais-structure/src/modules/customer/postCustomer.ctrl.js index bb43d0f..ea1f476 100644 --- a/ais-structure/src/modules/customer/postCustomer.ctrl.js +++ b/ais-structure/src/modules/customer/postCustomer.ctrl.js @@ -30,14 +30,9 @@ 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); - var resultObj = JSON.parse(result.response.body); - // (req,cmd,data,result) if(resultObj.resultCode.startsWith("40")) { @@ -47,14 +42,9 @@ exports.postCustomer = async function (req, res, next){ } var response = responseMsg.direct(req,getCmd,resultObj,{customerId:objectData.customerId}); - } - - } - - if(!response) var response = responseMsg.error(req,getCmd,5000); -- libgit2 0.21.2