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