Commit 5a93fae2575364f4f6edd5b3d975ed60e6034b2c
1 parent
095909b9
Exists in
master
and in
1 other branch
fix bug
Showing
3 changed files
with
1 additions
and
25 deletions
Show diff stats
ais-structure/src/modules/customer/customer.ctrl.js
| @@ -12,24 +12,15 @@ exports.customer = async function (req, res, next) { | @@ -12,24 +12,15 @@ exports.customer = async function (req, res, next) { | ||
| 12 | if(err.length > 0) | 12 | if(err.length > 0) |
| 13 | { | 13 | { |
| 14 | console.log(err); | 14 | console.log(err); |
| 15 | - | ||
| 16 | var response = responseMsg.error(req,getCmd,40300); | 15 | var response = responseMsg.error(req,getCmd,40300); |
| 17 | - | ||
| 18 | // res.status(200).json(response); | 16 | // res.status(200).json(response); |
| 19 | }else | 17 | }else |
| 20 | { | 18 | { |
| 21 | - | ||
| 22 | var objectData = req.query; | 19 | var objectData = req.query; |
| 23 | - | ||
| 24 | const result = await connection.requestJsonToD01(objectData,sendCmd,"GET"); | 20 | const result = await connection.requestJsonToD01(objectData,sendCmd,"GET"); |
| 25 | - | ||
| 26 | - | ||
| 27 | if(typeof result.err === 'undefined'){ | 21 | if(typeof result.err === 'undefined'){ |
| 28 | - | ||
| 29 | // console.log(result.response.body); | 22 | // console.log(result.response.body); |
| 30 | - | ||
| 31 | var resultObj = JSON.parse(result.response.body); | 23 | var resultObj = JSON.parse(result.response.body); |
| 32 | - | ||
| 33 | if(resultObj.resultCode == "20000") | 24 | if(resultObj.resultCode == "20000") |
| 34 | { | 25 | { |
| 35 | if(resultObj.resultData && resultObj.resultData.length>0) | 26 | if(resultObj.resultData && resultObj.resultData.length>0) |
| @@ -39,13 +30,8 @@ exports.customer = async function (req, res, next) { | @@ -39,13 +30,8 @@ exports.customer = async function (req, res, next) { | ||
| 39 | { | 30 | { |
| 40 | var response = responseMsg.error(req,getCmd,40300); | 31 | var response = responseMsg.error(req,getCmd,40300); |
| 41 | } | 32 | } |
| 42 | - | ||
| 43 | } | 33 | } |
| 44 | - | ||
| 45 | - | ||
| 46 | } | 34 | } |
| 47 | - | ||
| 48 | - | ||
| 49 | } | 35 | } |
| 50 | 36 | ||
| 51 | if(!response) | 37 | if(!response) |
ais-structure/src/modules/customer/customer.route.js
| @@ -6,7 +6,7 @@ module.exports = function (app) { | @@ -6,7 +6,7 @@ module.exports = function (app) { | ||
| 6 | customerCtrl.customer | 6 | customerCtrl.customer |
| 7 | ); | 7 | ); |
| 8 | 8 | ||
| 9 | - app.post('/cmf/v2/customer/customerId.json', | 9 | + app.post('/cmf/v2/customer.json', |
| 10 | postCustomerCtrl.postCustomer | 10 | postCustomerCtrl.postCustomer |
| 11 | ); | 11 | ); |
| 12 | }; | 12 | }; |
ais-structure/src/modules/customer/postCustomer.ctrl.js
| @@ -30,14 +30,9 @@ exports.postCustomer = async function (req, res, next){ | @@ -30,14 +30,9 @@ exports.postCustomer = async function (req, res, next){ | ||
| 30 | 30 | ||
| 31 | const result = await connection.requestJsonToD01(objectData,sendCmd,"POST"); | 31 | const result = await connection.requestJsonToD01(objectData,sendCmd,"POST"); |
| 32 | 32 | ||
| 33 | - | ||
| 34 | - | ||
| 35 | if(typeof result.err === 'undefined'){ | 33 | if(typeof result.err === 'undefined'){ |
| 36 | - | ||
| 37 | // console.log(result.response.body); | 34 | // console.log(result.response.body); |
| 38 | - | ||
| 39 | var resultObj = JSON.parse(result.response.body); | 35 | var resultObj = JSON.parse(result.response.body); |
| 40 | - | ||
| 41 | // (req,cmd,data,result) | 36 | // (req,cmd,data,result) |
| 42 | if(resultObj.resultCode.startsWith("40")) | 37 | if(resultObj.resultCode.startsWith("40")) |
| 43 | { | 38 | { |
| @@ -47,14 +42,9 @@ exports.postCustomer = async function (req, res, next){ | @@ -47,14 +42,9 @@ exports.postCustomer = async function (req, res, next){ | ||
| 47 | } | 42 | } |
| 48 | 43 | ||
| 49 | var response = responseMsg.direct(req,getCmd,resultObj,{customerId:objectData.customerId}); | 44 | var response = responseMsg.direct(req,getCmd,resultObj,{customerId:objectData.customerId}); |
| 50 | - | ||
| 51 | } | 45 | } |
| 52 | - | ||
| 53 | - | ||
| 54 | } | 46 | } |
| 55 | 47 | ||
| 56 | - | ||
| 57 | - | ||
| 58 | if(!response) | 48 | if(!response) |
| 59 | var response = responseMsg.error(req,getCmd,5000); | 49 | var response = responseMsg.error(req,getCmd,5000); |
| 60 | 50 |