Commit 0ec6fba7ec13818fd3ec2013432a517bc8167f35
1 parent
5a93fae2
Exists in
master
and in
1 other branch
update fix bug
Showing
9 changed files
with
20 additions
and
24 deletions
Show diff stats
ais-structure/src/config/config.js
@@ -37,7 +37,7 @@ var config = { | @@ -37,7 +37,7 @@ var config = { | ||
37 | statTime : 2, | 37 | statTime : 2, |
38 | detailTime : 15, | 38 | detailTime : 15, |
39 | summaryTime : 15, | 39 | summaryTime : 15, |
40 | - statInterval : 1, | 40 | + statInterval : 60, |
41 | appLogPath : './logTest/', | 41 | appLogPath : './logTest/', |
42 | summaryPath : './logTest/', | 42 | summaryPath : './logTest/', |
43 | statPath : './logTest/', | 43 | statPath : './logTest/', |
ais-structure/src/modules/customer/customer.ctrl.js
@@ -46,18 +46,7 @@ function validator(req,api) | @@ -46,18 +46,7 @@ function validator(req,api) | ||
46 | var list = []; | 46 | var list = []; |
47 | list.push([true,"queryStr","commandId","String"]); | 47 | list.push([true,"queryStr","commandId","String"]); |
48 | var err = validatorHelper(req,list,api) | 48 | var err = validatorHelper(req,list,api) |
49 | - | ||
50 | - //oc | ||
51 | - if((typeof req.query["customerId"] === 'undefined') && (typeof req.query["userType"] === 'undefined')) | ||
52 | - { | ||
53 | - var errDes = { | ||
54 | - Param : "customerId or userType", | ||
55 | - Reason : "Missing" | ||
56 | - } | ||
57 | - err.push(errDes); | ||
58 | - | ||
59 | - }else | ||
60 | - { | 49 | + |
61 | if((typeof req.query["userType"] !== 'undefined') && (typeof req.query["userData"] === 'undefined')) | 50 | if((typeof req.query["userType"] !== 'undefined') && (typeof req.query["userData"] === 'undefined')) |
62 | { | 51 | { |
63 | var errDes = { | 52 | var errDes = { |
@@ -67,8 +56,6 @@ function validator(req,api) | @@ -67,8 +56,6 @@ function validator(req,api) | ||
67 | err.push(errDes); | 56 | err.push(errDes); |
68 | } | 57 | } |
69 | 58 | ||
70 | - } | ||
71 | - | ||
72 | if(err.length > 0) | 59 | if(err.length > 0) |
73 | stats.reciveRequest(req.method,api,false); | 60 | stats.reciveRequest(req.method,api,false); |
74 | else | 61 | else |
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.json', | 9 | + app.post('/cmf/v2/customer/customerId.json', |
10 | postCustomerCtrl.postCustomer | 10 | postCustomerCtrl.postCustomer |
11 | ); | 11 | ); |
12 | }; | 12 | }; |
ais-structure/src/modules/customer/postCustomer.ctrl.js
@@ -31,9 +31,9 @@ exports.postCustomer = async function (req, res, next){ | @@ -31,9 +31,9 @@ exports.postCustomer = async function (req, res, next){ | ||
31 | const result = await connection.requestJsonToD01(objectData,sendCmd,"POST"); | 31 | const result = await connection.requestJsonToD01(objectData,sendCmd,"POST"); |
32 | 32 | ||
33 | if(typeof result.err === 'undefined'){ | 33 | if(typeof result.err === 'undefined'){ |
34 | - // console.log(result.response.body); | 34 | + console.log(result.response.body); |
35 | var resultObj = JSON.parse(result.response.body); | 35 | var resultObj = JSON.parse(result.response.body); |
36 | - // (req,cmd,data,result) | 36 | + |
37 | if(resultObj.resultCode.startsWith("40")) | 37 | if(resultObj.resultCode.startsWith("40")) |
38 | { | 38 | { |
39 | if(resultObj.resultCode != "40401") | 39 | if(resultObj.resultCode != "40401") |
ais-structure/src/modules/helper/connection.js
@@ -32,7 +32,7 @@ connection.requestJsonToD01 = function (obj,cmd,myMethod) { | @@ -32,7 +32,7 @@ connection.requestJsonToD01 = function (obj,cmd,myMethod) { | ||
32 | { | 32 | { |
33 | params.body = JSON.stringify(params.body); | 33 | params.body = JSON.stringify(params.body); |
34 | } | 34 | } |
35 | - | 35 | + |
36 | return asyncRequest(params,cmd,cfg.service.D01.Name); | 36 | return asyncRequest(params,cmd,cfg.service.D01.Name); |
37 | 37 | ||
38 | 38 | ||
@@ -55,7 +55,7 @@ function asyncRequest (params = {},cmd,node) { | @@ -55,7 +55,7 @@ function asyncRequest (params = {},cmd,node) { | ||
55 | }); | 55 | }); |
56 | } else { | 56 | } else { |
57 | // console.log("normal"); | 57 | // console.log("normal"); |
58 | - stats.reciveResponse(node,cmd,"Success"); | 58 | + // stats.reciveResponse(node,cmd,"Success"); |
59 | resolve({ | 59 | resolve({ |
60 | 'body' : body, | 60 | 'body' : body, |
61 | 'response' : response | 61 | 'response' : response |
ais-structure/src/modules/helper/log.js
@@ -39,6 +39,8 @@ logger.log = function (msg,type) | @@ -39,6 +39,8 @@ logger.log = function (msg,type) | ||
39 | default: | 39 | default: |
40 | logg.debug(msg); | 40 | logg.debug(msg); |
41 | } | 41 | } |
42 | + | ||
43 | + console.log(msg); | ||
42 | } | 44 | } |
43 | 45 | ||
44 | logger.startlog = function (cmdData,rawData) | 46 | logger.startlog = function (cmdData,rawData) |
ais-structure/src/modules/helper/responseMsg.js
@@ -12,6 +12,9 @@ responseMsg.error = function (req,cmd,code){ | @@ -12,6 +12,9 @@ responseMsg.error = function (req,cmd,code){ | ||
12 | case 40300: | 12 | case 40300: |
13 | devMsg = "Missing or invalid parameter"; | 13 | devMsg = "Missing or invalid parameter"; |
14 | break; | 14 | break; |
15 | + default: | ||
16 | + code = 50000; | ||
17 | + devMsg = "System error"; | ||
15 | } | 18 | } |
16 | 19 | ||
17 | var response = { | 20 | var response = { |
ais-structure/src/modules/helper/validator.js
@@ -63,7 +63,12 @@ function getData(req,row) | @@ -63,7 +63,12 @@ function getData(req,row) | ||
63 | if(arrayStr.length > 1) | 63 | if(arrayStr.length > 1) |
64 | { | 64 | { |
65 | for(var i=1;i<arrayStr.length;i++) | 65 | for(var i=1;i<arrayStr.length;i++) |
66 | - data = data[arrayStr[i]]; | 66 | + { |
67 | + if(data) | ||
68 | + data = data[arrayStr[i]]; | ||
69 | + | ||
70 | + } | ||
71 | + | ||
67 | } | 72 | } |
68 | break; | 73 | break; |
69 | } | 74 | } |
ais-structure/src/modules/vizcard/vizCard.ctrl.js
@@ -9,17 +9,16 @@ var log = require('../helper/log.js'); | @@ -9,17 +9,16 @@ var log = require('../helper/log.js'); | ||
9 | 9 | ||
10 | exports.vizcard = async function (req, res, next) { | 10 | exports.vizcard = async function (req, res, next) { |
11 | var getCmd = "VIZCard"; | 11 | var getCmd = "VIZCard"; |
12 | - var sendCmd = "SearchCustomer"; | 12 | + var sendCmd = "SearchCustomer" |
13 | 13 | ||
14 | log.startlog(getCmd,req); | 14 | log.startlog(getCmd,req); |
15 | log.logDetail.addInput("Client",getCmd,"Request",req); | 15 | log.logDetail.addInput("Client",getCmd,"Request",req); |
16 | 16 | ||
17 | - // (node,cmd,type,rawData,data) | ||
18 | var err = validator(req,getCmd); | 17 | var err = validator(req,getCmd); |
19 | 18 | ||
20 | if(err.length > 0) | 19 | if(err.length > 0) |
21 | { | 20 | { |
22 | - console.log(err); | 21 | + log.log(err); |
23 | 22 | ||
24 | var response = responseMsg.error(req,getCmd,40300); | 23 | var response = responseMsg.error(req,getCmd,40300); |
25 | 24 |