瀏覽代碼

我的门店

shish 3 年之前
父節點
當前提交
e74386c755
共有 1 個文件被更改,包括 32 次插入0 次删除
  1. 32 0
      app-hd/controllers/ShopController.php

+ 32 - 0
app-hd/controllers/ShopController.php

@@ -6,6 +6,7 @@ use biz\shop\classes\ShopClass;
 use biz\sj\services\MerchantExtendService;
 use bizGhs\admin\classes\AdminClass;
 use bizGhs\custom\classes\CustomClass;
+use bizHd\admin\classes\ShopAdminClass;
 use bizHd\merchant\services\ShopService;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\saas\services\RegionService;
@@ -22,6 +23,37 @@ class ShopController extends BaseController
 
     public $guestAccess = ['all', 'gathering-img-url', 'check-shop'];
 
+    //我的可以进入的门店 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);
+        $addShopList = [];
+        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;
+                }
+            }
+            if (!empty($addIds)) {
+                $addShopList = ShopClass::getAllByCondition(['id' => ['in', $addIds]], null, 'id,shopName,merchantName,sjId,mainId', 'id');
+            }
+        }
+        $all = array_merge($shopList, $addShopList);
+        $list = array_values($all);
+        util::success(['list' => $list]);
+    }
+
     //是否开启完整功能 ssh 20230226
     public function actionChangeOnlyCg()
     {