shawenguan 1 an în urmă
părinte
comite
baa71a1734
1 a modificat fișierele cu 13 adăugiri și 2 ștergeri
  1. 13 2
      Scripts/imoutai/imoutaiHelper.js

+ 13 - 2
Scripts/imoutai/imoutaiHelper.js

@@ -460,6 +460,18 @@ function getMTRequestId() {
     return `${new Date().getTime()}${getRandomNumber(11111, 99999)}`;
 }
 
+function checkShopItemIdIndex(shopObj, itemId){
+    const items = shopObj.items;
+    let retIndex = -1;
+    for(let i=0; i < items.length; i++){
+        if(items[i].itemId == itemId){
+            retIndex = i;
+            break;
+        }
+    }
+    return retIndex;
+}
+
 async function getShopItem(sessionId, itemId, token, deviceId, province, city, zeroTimeStamp) {
     return new Promise((resolve, _reject) => {
         try {
@@ -504,8 +516,7 @@ async function getShopItem(sessionId, itemId, token, deviceId, province, city, z
                             for (let i = 0; i < shops.length; i++) {
                                 const shopObj = shops[i];
                                 if(shopIds.indexOf(shopObj.shopId) > -1){
-                                    lk.log(`${itemId} shopObj=${JSON.stringify(shopObj)}`);
-                                    if (shopObj.itemId == itemId) {
+                                    if (checkShopItemIdIndex(shopObj, itemId) > -1) {
                                         lk.log(`shopObj=${JSON.stringify(shopObj)}`);
                                         ret = shopObj.shopId;
                                         break;