Commit 3aa57883cda6942995793bcab92ffe603f6e3317
1 parent
03f3be38
Exists in
master
and in
1 other branch
fix bug
Showing
2 changed files
with
9 additions
and
9 deletions
Show diff stats
ais-structure/src/modules/helper/connection.js
... | ... | @@ -508,7 +508,7 @@ function arrayUrl(arrUrl,url,filter,fields,freeSpace,arrData) |
508 | 508 | } |
509 | 509 | |
510 | 510 | if(loopUrl != "") |
511 | - arrUrl.push(url+"?filter=("+filter+"(|"+loopUrl+")"+fields); | |
511 | + arrUrl.push(url+"?filter=("+filter+"(|"+loopUrl+"))"+fields); | |
512 | 512 | return arrUrl; |
513 | 513 | } |
514 | 514 | ... | ... |
ais-structure/src/modules/membercard/postMembership.ctrl.js
... | ... | @@ -34,7 +34,6 @@ exports.postMembership = async function (req, res, next){ |
34 | 34 | if(err.length > 0) |
35 | 35 | { |
36 | 36 | log.addErrorSummary(req,req.body.clientName, postMethod+"_"+getCmd, "null", "Fail"); |
37 | - // console.log(err); | |
38 | 37 | var response = responseMsg.error(req, getCmd, 40300); |
39 | 38 | }else |
40 | 39 | { |
... | ... | @@ -99,7 +98,6 @@ exports.postMembership = async function (req, res, next){ |
99 | 98 | log.addSuccessSummary(req,d01,getMethod+"_"+sendMemberCardCmd,resultObj.resultCode,resultObj.resultDescription); |
100 | 99 | |
101 | 100 | var todo = await checkOwnerCard(resultObj.resultData,objectData); |
102 | - // console.log(todo); | |
103 | 101 | if(todo){ |
104 | 102 | var getCustomer = await getCustomerD01(req, objDataGetCustomer); |
105 | 103 | var response = await getCustomerHandler(req, getCustomer, resultObj, objDataMembership); |
... | ... | @@ -145,7 +143,6 @@ exports.postMembership = async function (req, res, next){ |
145 | 143 | |
146 | 144 | function validator(req, api) |
147 | 145 | { |
148 | - // console.log(req.body); | |
149 | 146 | var list = []; |
150 | 147 | list.push([true, "body", "commandId", "int"]); |
151 | 148 | list.push([true, "body", "clientName", "string"]); |
... | ... | @@ -207,7 +204,6 @@ async function postMemberCardD01(req, data){ |
207 | 204 | isDirect : false |
208 | 205 | }; |
209 | 206 | |
210 | - // console.log(data) | |
211 | 207 | |
212 | 208 | const resultCustomer = await connection.requestJsonToD01(req,data.reqMembership, data.cmd, data.method, data.filter); |
213 | 209 | var resultObj = resultCustomer.response |
... | ... | @@ -232,7 +228,6 @@ async function postMemberCardD01(req, data){ |
232 | 228 | |
233 | 229 | async function getCustomerHandler(req, getCustomer, getMemberCard, objDataMembership){ |
234 | 230 | |
235 | - // console.log(getCustomer.response) | |
236 | 231 | if(!getCustomer.isErr){ |
237 | 232 | //if get data exits post membercard |
238 | 233 | if(!getCustomer.isDataNotFound){ |
... | ... | @@ -267,7 +262,14 @@ async function getCustomerHandler(req, getCustomer, getMemberCard, objDataMember |
267 | 262 | return result; |
268 | 263 | } |
269 | 264 | |
270 | - var getResult = await getResultTodo(req, getMemberCard, objDataMembership); | |
265 | + if(!getMemberCard.resultData){ // get membercard data not found do post | |
266 | + var getResult = { | |
267 | + doPost : true, | |
268 | + doNothing : false | |
269 | + } | |
270 | + } else { // get data exits check todo | |
271 | + var getResult = await getResultTodo(req, getMemberCard, objDataMembership); | |
272 | + } | |
271 | 273 | |
272 | 274 | if(getResult.doNothing){ |
273 | 275 | var response = responseMsg.success(req,getCmd) |
... | ... | @@ -332,7 +334,6 @@ async function checkOwnerCard(resultData,objectData){ |
332 | 334 | } |
333 | 335 | |
334 | 336 | for(var i = 0 ; i < resultData.length ; i++){ |
335 | - // console.log(resultData[i]) | |
336 | 337 | if(resultData[i].cardOwnerIdList.includes(customerId)){ |
337 | 338 | dataCount.userOwnCardCount = dataCount.userOwnCardCount++; |
338 | 339 | } |
... | ... | @@ -344,7 +345,6 @@ async function checkOwnerCard(resultData,objectData){ |
344 | 345 | return dataCount; |
345 | 346 | }; |
346 | 347 | var count = await countf(resultData); |
347 | - // console.log(count); | |
348 | 348 | |
349 | 349 | if(count.userOwnCardCount < userMembershipCardLimit |
350 | 350 | && count.cardOwnUserCount < userOwnerCardLimit){ | ... | ... |