shish před 3 roky
rodič
revize
551ec5f543
1 změnil soubory, kde provedl 9 přidání a 4 odebrání
  1. 9 4
      app-hd/controllers/ShopController.php

+ 9 - 4
app-hd/controllers/ShopController.php

@@ -46,13 +46,18 @@ class ShopController extends BaseController
                 }
             }
         }
-        $addShopList = [];
         if (!empty($mainIdList)) {
             $addShopList = ShopClass::getAllByCondition(['mainId' => ['in', $mainIdList]], null, 'id,shopName,merchantName,sjId,mainId', 'id');
+            if (!empty($addShopList)) {
+                foreach ($addShopList as $addShop) {
+                    $addShopId = $addShop['id'] ?? 0;
+                    if (isset($shopList[$addShopId]) == false) {
+                        $shopList[$addShopId] = $addShop;
+                    }
+                }
+            }
         }
-        $all = array_merge($shopList, $addShopList);
-        $all = array_unique($all);
-        $list = array_values($all);
+        $list = array_values($shopList);
         util::success(['list' => $list]);
     }