shish 4 lat temu
rodzic
commit
a465f99d90

+ 7 - 3
app-ghs/controllers/AuthController.php

@@ -55,8 +55,7 @@ class AuthController extends PublicController
         if (empty($phoneNumber)) {
             util::fail('登录失败了');
         }
-        $ptStyle = dict::getDict('ptStyle', 'ghs');
-        $admin = AdminClass::getByCondition(['mobile' => $phoneNumber, 'style' => $ptStyle]);
+        $admin = AdminClass::getByCondition(['mobile' => $phoneNumber]);
         $currentShopId = $admin['currentGhsShopId'] ?? 0;
         $openShop = $admin['openGhsShop'] ?? 1;
         if (empty($currentShopId)) {
@@ -65,13 +64,18 @@ class AuthController extends PublicController
             }
             util::fail('请先注册');
         }
+        $currentShop = ShopClass::getById($currentShopId, true);
+        if (empty($currentShop)) {
+            util::fail('没有找到门店');
+        }
+        $mainId = $currentShop->mainId ?? 0;
         $adminId = $admin['id'] ?? 0;
         //1没有开店 2已申请待审核 3已开店
         $openShop = $admin['openGhsShop'] ?? 1;
         if ($openShop == 2) {
             util::fail('帐号审核中');
         }
-        $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId], true);
+        $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'mainId' => $mainId], true);
         if (empty($shopAdmin)) {
             util::fail('请先注册');
         }

+ 0 - 6
app-ghs/controllers/BaseController.php

@@ -44,12 +44,6 @@ class BaseController extends PublicController
             util::logout('帐号无效');
         }
         $this->admin = $admin;
-        // 只能供应商访问
-        if (in_array($action->id, $this->guestAccess) == false) {
-            if ($admin->style != AdminClass::STYLE_GHS) {
-                util::fail('您没有权限访问哦');
-            }
-        }
         //后台
         $currentShopId = $admin->currentGhsShopId ?? 0;
         if (empty($currentShopId)) {

+ 6 - 1
app-hd/controllers/AuthController.php

@@ -70,8 +70,13 @@ class AuthController extends PublicController
             }
             util::fail('请先注册');
         }
+        $currentShop = ShopClass::getById($currentShopId, true);
+        if (empty($currentShop)) {
+            util::fail('没有找到门店');
+        }
+        $mainId = $currentShop->mainId ?? 0;
         $adminId = $admin['id'];
-        $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId, 'shopId' => $currentShopId, 'delStatus' => 0], true);
+        $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId, 'mainId' => $mainId], true);
         if (empty($shopAdmin)) {
             util::fail('没有权限操作');
         }

+ 0 - 5
app-hd/controllers/BaseController.php

@@ -45,11 +45,6 @@ class BaseController extends PublicController
         $adminId = $admin->id ?? 0;
         $this->admin = $admin;
         $this->adminId = $adminId;
-        if (in_array($action->id, $this->guestAccess) == false) {
-            if ($admin->style != AdminClass::STYLE_HD) {
-                util::fail('您没有权限访问哦');
-            }
-        }
         //后台
         $currentShopId = $admin->currentShopId ?? 0;
         if (empty($currentShopId)) {