Kaynağa Gözat

加盟和直营问题

shish 3 yıl önce
ebeveyn
işleme
04237bddc5
1 değiştirilmiş dosya ile 10 ekleme ve 4 silme
  1. 10 4
      biz-ghs/product/classes/ProductClass.php

+ 10 - 4
biz-ghs/product/classes/ProductClass.php

@@ -934,9 +934,6 @@ class ProductClass extends BaseClass
             $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;
@@ -983,7 +980,16 @@ class ProductClass extends BaseClass
                         unset($params['price']);
                     }
                 }
-                self::updateById($chainProduct->id, $params);
+                if (isset($chainShop->join) && $chainShop->join == 1) {
+                    //加盟店仅同步名称等非重要因素
+                    if (isset($params['name'])) {
+                        $jmParams = ['name' => $params['name']];
+                        self::updateById($chainProduct->id, $jmParams);
+                    }
+                } else {
+                    //直营店同步价格等重要因素
+                    self::updateById($chainProduct->id, $params);
+                }
             }
         }