瀏覽代碼

限制管理员才能操作

shish 4 年之前
父節點
當前提交
ca2cf9e00d
共有 1 個文件被更改,包括 4 次插入10 次删除
  1. 4 10
      app-ghs/controllers/CustomController.php

+ 4 - 10
app-ghs/controllers/CustomController.php

@@ -206,11 +206,8 @@ class CustomController extends BaseController
     public function actionUpdateDebtLimit()
     {
         $shopAdmin = $this->shopAdmin;
-        $roleId = $shopAdmin['roleId'] ?? 0;
-        $role = AdminRoleClass::getById($roleId);
-        $roleName = $role['roleName'] ?? '';
-        if ($roleName == '员工') {
-            util::fail('您没有权限操作哦');
+        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
+            util::fail('管理员才能操作');
         }
 
         $get = Yii::$app->request->get();
@@ -230,11 +227,8 @@ class CustomController extends BaseController
     public function actionChangeDiscount()
     {
         $shopAdmin = $this->shopAdmin;
-        $roleId = $shopAdmin['roleId'] ?? 0;
-        $role = AdminRoleClass::getById($roleId);
-        $roleName = $role['roleName'] ?? '';
-        if ($roleName == '员工') {
-            util::fail('您没有权限操作哦');
+        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
+            util::fail('管理员才能操作');
         }
 
         $get = Yii::$app->request->get();