shish 2 лет назад
Родитель
Сommit
9bab8189c9
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      app-ghs/controllers/ShopController.php

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

@@ -125,16 +125,17 @@ class ShopController extends BaseController
     public function actionUpdate()
     {
         $post = Yii::$app->request->post();
-        $shopAdmin = $this->shopAdmin;
-        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
-            util::fail('超管才能修改');
-        }
+        $adminId = $this->adminId;
         $post['sjId'] = $this->sjId;
         $id = $post['id'] ?? 0;
         $shop = ShopService::getById($id);
         if (empty($shop)) {
             util::fail('没有找到门店');
         }
+        if ($adminId != $shop->adminId) {
+            util::fail('本店超管才能修改');
+        }
+
         ShopClass::valid($shop, $this->sjId);
         //手机号具有唯一性,暂时不允许修改
         unset($post['mobile']);
@@ -152,6 +153,11 @@ class ShopController extends BaseController
             util::fail('当前直营分店,请切回总店添加');
         }
 
+        $adminId = $this->adminId;
+        if ($adminId != $shop->adminId) {
+            util::fail('本店超管才能添加门店');
+        }
+
         $data = Yii::$app->request->post();
         $data['sjId'] = $this->sjId;
         $data['shopId'] = $this->shopId;