Commit 0ec6fba7ec13818fd3ec2013432a517bc8167f35

Authored by sumatek
1 parent 5a93fae2
Exists in master and in 1 other branch dev

update fix bug

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