Kaynağa Gözat

同步问题

shish 3 yıl önce
ebeveyn
işleme
feb2809973

+ 27 - 5
app-ghs/controllers/ProductController.php

@@ -495,7 +495,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;
@@ -708,7 +708,7 @@ class ProductController extends BaseController
             }
         }
 
-        //首店修改同步到所有直营
+        //总店修改同步到所有门
         $sjId = $shop->sjId ?? 0;
         $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
 
@@ -770,7 +770,7 @@ class ProductController extends BaseController
             }
         }
 
-        //首店修改同步到所有直营
+        //总店修改同步到所有门
         $sjId = $shop->sjId ?? 0;
         $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
 
@@ -883,7 +883,7 @@ class ProductController extends BaseController
 
         $ptItemId = $product->itemId ?? 0;
         if (isset($shop->default) && $shop->default == 1) {
-            //首店修改同步到所有直营
+            //总店修改同步到所有门
             $sjId = $shop->sjId ?? 0;
             $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
             foreach ($chainShopList as $chainShop) {
@@ -925,7 +925,7 @@ class ProductController extends BaseController
         $shop = $this->shop;
         $default = $shop->default ?? 0;
         if ($default == 0) {
-            util::fail('请在默认门店添加花材,分店只能修改花材');
+            util::fail('请在店添加花材,分店只能修改花材');
         }
         $shopAdmin = $this->shopAdmin;
         if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
@@ -1060,6 +1060,28 @@ class ProductController extends BaseController
             $item->classId = $classId;
             $item->save();
         }
+        $shop = $this->shop;
+        if (isset($shop->default) && $shop->default == 1) {
+            //总店修改同步到所有门店
+            $sjId = $shop->sjId ?? 0;
+            $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
+            foreach ($chainShopList as $chainShop) {
+                $chainShopId = $chainShop->id ?? 0;
+                if (isset($chainShop->join) && $chainShop->join == 1) {
+                    continue;
+                }
+                if ($chainShopId == $shop->id) {
+                    continue;
+                }
+                $chainMainId = $chainShop->mainId ?? 0;
+                $chainProduct = ProductClass::getByCondition(['mainId' => $chainMainId, 'itemId' => $ptItemId], true);
+                if (!empty($chainProduct)) {
+                    $chainProduct->delStatus = $delStatus;
+                    $chainProduct->save();
+                }
+            }
+        }
+
         util::complete();
     }
 

+ 1 - 1
app-ghs/controllers/ShopAdminController.php

@@ -240,7 +240,7 @@ class ShopAdminController extends BaseController
         $join = $shop->join ?? 0;
         $default = $shop->default ?? 0;
         if ($join == 0 && $default == 0) {
-            util::fail('请在默认门店操作');
+            util::fail('请在店操作');
         }
 
         $shopAdmin = $this->shopAdmin;

+ 1 - 1
app-ghs/controllers/ShopController.php

@@ -114,7 +114,7 @@ class ShopController extends BaseController
         $join = $shop->join ?? 0;
         $default = $shop->default ?? 0;
         if ($join == 0 && $default == 0) {
-            util::fail('请在默认门店操作');
+            util::fail('请在店操作');
         }
 
         $data = Yii::$app->request->post();

+ 1 - 1
biz-ghs/product/classes/ProductClass.php

@@ -1354,7 +1354,7 @@ class ProductClass extends BaseClass
         unset($upData['status']);
 
         if (isset($shop->default) && $shop->default == 1) {
-            //首店修改同步到所有直营店,暂不同时修改加盟
+            //总店修改同步到所有门
             $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
             foreach ($chainShopList as $chainShop) {
                 $chainShopId = $chainShop->id ?? 0;

+ 1 - 1
biz-hd/item/classes/ItemClass.php

@@ -125,7 +125,7 @@ class ItemClass extends BaseClass
         self::updateById($id, $upData);
 
         if (isset($shop->default) && $shop->default == 1) {
-            //首店修改同步到所有直营
+            //总店修改同步到所有门
             $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
             foreach ($chainShopList as $chainShop) {
                 $chainShopId = $chainShop->id ?? 0;