shish 3 years ago
parent
commit
da285d4890
1 changed files with 9 additions and 8 deletions
  1. 9 8
      app-hd/controllers/ShopController.php

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

@@ -34,20 +34,21 @@ class ShopController extends BaseController
         }
         $adminId = $this->adminId ?? 0;
         $staffList = ShopAdminClass::getAllByCondition(['adminId' => $adminId], null, '*', null, true);
-        $addShopList = [];
+        $mainIdList = [];
         if (!empty($staffList)) {
-            $addIds = [];
             foreach ($staffList as $staff) {
-                $shopId = $staff->shopId ?? 0;
                 $isPt = $staff->isPt ?? 0;
                 $delStatus = $staff->delStatus ?? 0;
-                if ($delStatus == 0 && $isPt == 0 && isset($shopList[$shopId]) == false) {
-                    $addIds[] = $shopId;
+                $super = $staff->super ?? 0;
+                $mainId = $staff->mainId ?? 0;
+                if ($isPt == 0 && $delStatus == 0 && $super == 1) {
+                    $mainIdList[] = $mainId;
                 }
             }
-            if (!empty($addIds)) {
-                $addShopList = ShopClass::getAllByCondition(['id' => ['in', $addIds]], null, 'id,shopName,merchantName,sjId,mainId', 'id');
-            }
+        }
+        $addShopList = [];
+        if (!empty($mainIdList)) {
+            $addShopList = ShopClass::getAllByCondition(['mainId' => ['in', $mainIdList]], null, 'id,shopName,merchantName,sjId,mainId', 'id');
         }
         $all = array_merge($shopList, $addShopList);
         $list = array_values($all);