Browse Source

超管能力

shish 4 years ago
parent
commit
e5af556f99

+ 3 - 5
app-ghs/controllers/ShopAdminController.php

@@ -231,12 +231,10 @@ class ShopAdminController extends BaseController
     public function actionDelete()
     {
         $id = Yii::$app->request->get('id');
-
-        $shopAdmin = $this->shopAdmin->attributes;
-        if ($shopAdmin['super'] != 1) {
-            util::fail('超管才能操作');
+        $shopAdmin = $this->shopAdmin;
+        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
+            util::fail('没有权限');
         }
-
         $relation = ShopAdminClass::getById($id, true);
         \biz\shop\classes\ShopAdminClass::deleteShopAdmin($relation, $this->shopAdminId, $this->shopId);
         util::complete();

+ 2 - 2
biz/shop/classes/ShopAdminClass.php

@@ -168,8 +168,8 @@ class ShopAdminClass extends BaseClass
     public static function deleteShopAdmin($relation, $thisShopAdminId, $thisShopId)
     {
         $id = $relation->id ?? 0;
-        if ($relation->super == 1) {
-            util::fail("管理员不能删除");
+        if ($relation->founder == 2) {
+            util::fail("管不能删除");
         }
         if ($id == $thisShopAdminId) {
             util::fail("不能删自己");