Ver Fonte

我的门店

shish há 3 anos atrás
pai
commit
2c40253eeb
1 ficheiros alterados com 38 adições e 0 exclusões
  1. 38 0
      app-ghs/controllers/ShopController.php

+ 38 - 0
app-ghs/controllers/ShopController.php

@@ -27,6 +27,44 @@ class ShopController extends BaseController
 
     public $guestAccess = ['all'];
 
+    //我的可以进入的门店 ssh 20230424
+    public function actionMyShop()
+    {
+        $staff = $this->shopAdmin;
+        $shopList = [];
+        if (isset($staff->super) && $staff->super == 1) {
+            $sjId = $this->sjId ?? 0;
+            $shopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, 'id,shopName,merchantName,sjId,mainId', 'id');
+        }
+        $adminId = $this->adminId ?? 0;
+        $staffList = ShopAdminClass::getAllByCondition(['adminId' => $adminId], null, '*', null, true);
+        $mainIdList = [];
+        if (!empty($staffList)) {
+            foreach ($staffList as $staff) {
+                $isPt = $staff->isPt ?? 0;
+                $delStatus = $staff->delStatus ?? 0;
+                $super = $staff->super ?? 0;
+                $mainId = $staff->mainId ?? 0;
+                if ($isPt == 0 && $delStatus == 0 && $super == 1) {
+                    $mainIdList[] = $mainId;
+                }
+            }
+        }
+        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;
+                    }
+                }
+            }
+        }
+        $list = array_values($shopList);
+        util::success(['list' => $list]);
+    }
+
     //绑定零售店 ssh 20220430
     public function actionBindLsShop()
     {