shish 4 tahun lalu
induk
melakukan
d3c5ef6955

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

@@ -36,25 +36,26 @@ class BaseController extends PublicController
         if (getenv('YII_ENV', 'local') != 'production') {
             //$adminId = 253;
         }
-        if (empty($adminId)) {
+        if (empty($adminId) && in_array($action->id, $this->guestAccess) == false) {
             util::notLogin();
         }
         $admin = AdminClass::getById($adminId, true);
-        if (empty($admin)) {
+        if (empty($admin) && in_array($action->id, $this->guestAccess) == false) {
             util::notLogin();
         }
         $adminId = $admin->id;
         $this->admin = $admin;
         $this->adminId = $adminId;
-        // 只能供应商访问
-        if ($admin->style != ClassesAdminClass::STYLE_HD) {
-            util::fail('请注册登录');
+        if (in_array($action->id, $this->guestAccess) == false) {
+            if ($admin->style != AdminClass::STYLE_HD) {
+                util::fail('您没有权限访问哦');
+            }
         }
         //后台
         $currentShopId = $admin->currentShopId ?? 0;
         if (empty($currentShopId)) {
             if (in_array($action->id, $this->guestAccess) == false) {
-                util::fail('您不是员工没有权限访问');
+                util::fail('请注册登录');
             }
         } else {
             $this->shopId = $currentShopId;
@@ -67,10 +68,10 @@ class BaseController extends PublicController
             if (empty($shopAdmin)) {
                 util::logout('没有找到员工信息');
             }
-            if (isset($shopAdmin->delStatus) && $shopAdmin->delStatus == 1) {
+            if (isset($shopAdmin->delStatus) == false || $shopAdmin->delStatus == 1) {
                 util::fail('您还不是员工哦');
             }
-            if (isset($shopAdmin->status) && $shopAdmin->status == 0) {
+            if (isset($shopAdmin->status) == false || $shopAdmin->status == 0) {
                 util::fail('您的帐号已被禁用');
             }
             $this->shopAdmin = $shopAdmin;

+ 3 - 0
biz-hd/admin/classes/AdminClass.php

@@ -16,6 +16,9 @@ use bizHd\base\classes\BaseClass;
 class AdminClass extends BaseClass
 {
 
+    const STYLE_GHS = 2;
+    const STYLE_HD = 1;
+
     public static $baseFile = '\bizHd\admin\models\Admin';
 
     //收益通知人