Explorar o código

修改门店信息

shish %!s(int64=3) %!d(string=hai) anos
pai
achega
19ee01649d

+ 2 - 2
app-ghs/controllers/ProductController.php

@@ -498,7 +498,7 @@ class ProductController extends BaseController
         $join = $shop->join ?? 0;
         $default = $shop->default ?? 0;
         if ($join == 0 && $default == 0) {
-            util::fail('当前直营分店,请切回总店修改');
+            util::fail('当前直营分店,只能回总店修改价格');
         }
 
         $shopAdmin = $this->shopAdmin;
@@ -685,7 +685,7 @@ class ProductController extends BaseController
         $shop = $this->shop;
         $default = $shop->default ?? 0;
         if ($default == 0) {
-            util::fail('当前直营分店,请切回总店修改');
+            util::fail('当前直营分店,只能回总店修改');
         }
 
         $shopAdmin = $this->shopAdmin;

+ 6 - 13
app-ghs/controllers/ShopController.php

@@ -124,29 +124,22 @@ class ShopController extends BaseController
     //更新门店 ssh 2020.2.29
     public function actionUpdate()
     {
-        $data = Yii::$app->request->post();
-
-        $shop = $this->shop;
-        if (isset($shop->default) == false || $shop->default != 1) {
-            util::fail('当前直营分店,请切回总店修改');
-        }
-
+        $post = Yii::$app->request->post();
         $shopAdmin = $this->shopAdmin;
         if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
             util::fail('超管才能修改');
         }
-
-        $data['sjId'] = $this->sjId;
-        $id = $data['id'] ?? 0;
+        $post['sjId'] = $this->sjId;
+        $id = $post['id'] ?? 0;
         $shop = ShopService::getById($id);
         if (empty($shop)) {
             util::fail('没有找到门店');
         }
         ShopClass::valid($shop, $this->sjId);
         //手机号具有唯一性,暂时不允许修改
-        unset($data['mobile']);
-        $data['img'] = isset($data['img']) && is_array($data['img']) ? json_encode($data['img']) : '';
-        \biz\shop\classes\ShopClass::updateShop($shop, $data);
+        unset($post['mobile']);
+        $post['img'] = isset($post['img']) && is_array($post['img']) ? json_encode($post['img']) : '';
+        \biz\shop\classes\ShopClass::updateShop($shop, $post);
         util::complete();
     }