Commit 5a93fae2575364f4f6edd5b3d975ed60e6034b2c

Authored by Nattapon Wongpaet
1 parent 095909b9
Exists in master and in 1 other branch dev

fix bug

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