Commit fbd30c5058f76a85fbd1f40fc950227eb2a159f3

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

update fix bug url and log

ais-structure/src/modules/helper/connection.js
@@ -98,9 +98,7 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) { @@ -98,9 +98,7 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) {
98 98
99 var result = {}; 99 var result = {};
100 result.response = {}; 100 result.response = {};
101 - result.response.resultData = [];  
102 -  
103 - 101 + var resultData = [];
104 102
105 if(params.method == constants.METHOD.GET) 103 if(params.method == constants.METHOD.GET)
106 { 104 {
@@ -132,7 +130,9 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) { @@ -132,7 +130,9 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) {
132 dataRes[i].err = "Miss resultDescription" 130 dataRes[i].err = "Miss resultDescription"
133 131
134 132
  133 +
135 dataRes[i].data = data.resultData; 134 dataRes[i].data = data.resultData;
  135 + // console.log(dataRes[i].data);
136 136
137 } 137 }
138 138
@@ -140,19 +140,21 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) { @@ -140,19 +140,21 @@ connection.requestJsonToD01 = async function (req,obj,cmd,myMethod,filter) {
140 140
141 for (var i = 0; i < multiSend.length; i++) { 141 for (var i = 0; i < multiSend.length; i++) {
142 142
143 - result.response.resultData = result.response.resultData.concat(dataRes[i].data); 143 + resultData = resultData.concat(dataRes[i].data);
144 if(dataRes[i].err) 144 if(dataRes[i].err)
145 result.err = dataRes[i].err; 145 result.err = dataRes[i].err;
  146 +
  147 +
146 } 148 }
147 149
148 if(!result.err) 150 if(!result.err)
149 { 151 {
150 result.response = constants.RESPONSECONN.MESSAGE.SUCCESS; 152 result.response = constants.RESPONSECONN.MESSAGE.SUCCESS;
  153 + result.response.resultData = resultData;
151 // result.response.resultCode = "20000"; 154 // result.response.resultCode = "20000";
152 // result.response.developerMessage = "Success"; 155 // result.response.developerMessage = "Success";
153 } 156 }
154 157
155 -  
156 }else 158 }else
157 { 159 {
158 // console.log("single Send"); 160 // console.log("single Send");
@@ -237,10 +239,15 @@ async function parallelRequest(multiParams,objectData,funStat) @@ -237,10 +239,15 @@ async function parallelRequest(multiParams,objectData,funStat)
237 // for(var i=0;i<res.length;i++) 239 // for(var i=0;i<res.length;i++)
238 // { 240 // {
239 // if(!res[i].err) 241 // if(!res[i].err)
240 - // stats.receiveResponse(node,cmd,"Success"); 242 + // {
  243 + // console.log(res[i].body);
  244 + // }
  245 + // // stats.receiveResponse(node,cmd,"Success");
  246 +
241 247
242 // } 248 // }
243 249
  250 +
244 251
245 return res; 252 return res;
246 } 253 }
@@ -248,12 +255,15 @@ async function parallelRequest(multiParams,objectData,funStat) @@ -248,12 +255,15 @@ async function parallelRequest(multiParams,objectData,funStat)
248 function asyncRequest (params = {},objectData,funStat) { 255 function asyncRequest (params = {},objectData,funStat) {
249 256
250 // console.log(objectData); 257 // console.log(objectData);
251 - funStat.start(); 258 +
252 259
253 // console.log("Start : "+new Date().toISOString()); 260 // console.log("Start : "+new Date().toISOString());
254 return new Promise((resolve, reject) => { 261 return new Promise((resolve, reject) => {
255 request(params, function (error, response, body) { 262 request(params, function (error, response, body) {
256 263
  264 + funStat.start();
  265 + log.log("URL : "+params.url);
  266 +
257 if (error) { 267 if (error) {
258 268
259 if( objectData.maxRetry == objectData.curRetry-1) 269 if( objectData.maxRetry == objectData.curRetry-1)
@@ -287,6 +297,7 @@ function asyncRequest (params = {},objectData,funStat) { @@ -287,6 +297,7 @@ function asyncRequest (params = {},objectData,funStat) {
287 } else { 297 } else {
288 298
289 // stats.receiveResponse(node,cmd,"Success"); 299 // stats.receiveResponse(node,cmd,"Success");
  300 + log.log("Response : "+body);
290 resolve({ 301 resolve({
291 'body' : body, 302 'body' : body,
292 'response' : response 303 'response' : response
@@ -326,7 +337,7 @@ function getUrl(params,limit) @@ -326,7 +337,7 @@ function getUrl(params,limit)
326 }; 337 };
327 338
328 339
329 - // params.body = {}; 340 + params.body = {};
330 // params.body.a = "aaa"; 341 // params.body.a = "aaa";
331 // params.body.b = "bbb"; 342 // params.body.b = "bbb";
332 // params.body.papa = []; 343 // params.body.papa = [];
@@ -343,7 +354,9 @@ function getUrl(params,limit) @@ -343,7 +354,9 @@ function getUrl(params,limit)
343 // params.body.commandId.push("8"); 354 // params.body.commandId.push("8");
344 // params.body.c = "ccc"; 355 // params.body.c = "ccc";
345 // params.body.fields = "a,b,c,d"; 356 // params.body.fields = "a,b,c,d";
346 - // console.log(params.body); 357 + params.body.customerId = ["1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6","1b6a768e52e9a1e11518a1c6"];
  358 + limit = 100;
  359 + console.log(params.body);
347 if(params.body) 360 if(params.body)
348 { 361 {
349 var first = true; 362 var first = true;
@@ -382,7 +395,7 @@ function getUrl(params,limit) @@ -382,7 +395,7 @@ function getUrl(params,limit)
382 } 395 }
383 396
384 397
385 - var myUrl = url+"?filter=("+filter.base+")"+fields; 398 + var myUrl = url+"?filter=:"+filter.base+":"+fields;
386 var freeSpace = cfg.Uri_length - myUrl.length; 399 var freeSpace = cfg.Uri_length - myUrl.length;
387 400
388 401
@@ -413,8 +426,8 @@ function getUrl(params,limit) @@ -413,8 +426,8 @@ function getUrl(params,limit)
413 // console.log(filter); 426 // console.log(filter);
414 // console.log(fields); 427 // console.log(fields);
415 428
416 - for(var i=0;i<returnData.length;i++)  
417 - log.log("URL "+[i+1]+" : "+returnData[i]); 429 + // for(var i=0;i<returnData.length;i++)
  430 + // log.log("URL "+[i+1]+" : "+returnData[i]);
418 431
419 return returnData; 432 return returnData;
420 } 433 }
@@ -484,7 +497,7 @@ function arrayUrl(arrUrl,url,filter,fields,freeSpace,arrData) @@ -484,7 +497,7 @@ function arrayUrl(arrUrl,url,filter,fields,freeSpace,arrData)
484 { 497 {
485 if(loopUrl != "") 498 if(loopUrl != "")
486 { 499 {
487 - arrUrl.push(url+"?filter=("+filter+"(|"+loopUrl+")"+fields); 500 + arrUrl.push(url+"?filter=("+filter+"(|"+loopUrl+"))"+fields);
488 501
489 loopUrl = arrData[i]; 502 loopUrl = arrData[i];
490 loopSpace = freeSpace - arrData[i].length; 503 loopSpace = freeSpace - arrData[i].length;
@@ -503,7 +516,7 @@ function checkResponse(result,funStats) @@ -503,7 +516,7 @@ function checkResponse(result,funStats)
503 { 516 {
504 if(result.err) 517 if(result.err)
505 { 518 {
506 - log.log(result.err,'error'); 519 + log.log("Final Response : "+result.err,'error');
507 if(result.err.code == constants.RESPONSECONN.STATS.ETIMEDOUT){ 520 if(result.err.code == constants.RESPONSECONN.STATS.ETIMEDOUT){
508 result.response = constants.RESPONSECONN.MESSAGE.ETIMEDOUT; 521 result.response = constants.RESPONSECONN.MESSAGE.ETIMEDOUT;
509 // result.response.resultCode = "50003"; 522 // result.response.resultCode = "50003";
@@ -524,7 +537,7 @@ function checkResponse(result,funStats) @@ -524,7 +537,7 @@ function checkResponse(result,funStats)
524 } 537 }
525 funStats.error(result.response) 538 funStats.error(result.response)
526 }else 539 }else
527 - log.log(JSON.stringify(result)); 540 + log.log("Final Response : "+JSON.stringify(result));
528 541
529 return result; 542 return result;
530 } 543 }
ais-structure/src/modules/main.route.js
@@ -49,6 +49,10 @@ module.exports = function (app) { @@ -49,6 +49,10 @@ module.exports = function (app) {
49 default: next(); 49 default: next();
50 break; 50 break;
51 } 51 }
  52 +
  53 +
  54 +
  55 +
52 }); 56 });
53 57
54 function doVizcard(objectData) 58 function doVizcard(objectData)
@@ -72,6 +76,7 @@ module.exports = function (app) { @@ -72,6 +76,7 @@ module.exports = function (app) {
72 // "/cmf/v1/customers/:userType/:userData", 76 // "/cmf/v1/customers/:userType/:userData",
73 // "/cmf/v1/customers" 77 // "/cmf/v1/customers"
74 78
  79 + // console.log(objectData.modules);
75 var doAction = function(){ 80 var doAction = function(){
76 81
77 if(objectData.method == constants.METHOD.GET) 82 if(objectData.method == constants.METHOD.GET)