|
|
@@ -511,21 +511,7 @@ class ProductClass extends BaseClass
|
|
|
//判断是否首店
|
|
|
$shopInfo = ShopClass::getById($shopId);
|
|
|
$res = ProductClass::updateByCondition(['id' => $id, 'shopId' => $shopId], ['price' => $price, 'priceLabel' => $priceLabel]);
|
|
|
- $productData = ProductClass::getById($id);
|
|
|
- $itemId = $productData['itemId'];
|
|
|
- if($shopInfo['default']==1){
|
|
|
- //首店
|
|
|
- $sjId = $shopInfo['sjId'];
|
|
|
- $shopAll = ShopClass::getAllShop($sjId);
|
|
|
- if($shopAll){
|
|
|
- foreach ($shopAll as $s){
|
|
|
- if($s['id'] != $shopId){
|
|
|
- ProductClass::updateByCondition(['itemId' => $itemId, 'shopId' => $s['id']], ['price' => $price, 'priceLabel' => $priceLabel]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ self::updateSyncProduct($id,$shopId,['price' => $price, 'priceLabel' => $priceLabel]);
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
@@ -691,22 +677,8 @@ class ProductClass extends BaseClass
|
|
|
}
|
|
|
self::updateById($id, $upData);
|
|
|
|
|
|
- //如果是首店,则更新全部分店
|
|
|
- $shopId = $model['shopId'];
|
|
|
- $shopInfo = ShopClass::getById($shopId);
|
|
|
- $itemId = $model['itemId'];
|
|
|
- if($shopInfo['default']==1){
|
|
|
- //首店
|
|
|
- $sjId = $shopInfo['sjId'];
|
|
|
- $shopAll = ShopClass::getAllShop($sjId);
|
|
|
- if($shopAll){
|
|
|
- foreach ($shopAll as $s){
|
|
|
- if($s['id'] != $shopId){
|
|
|
- ProductClass::updateByCondition(['itemId' => $itemId, 'shopId' => $s['id']], $upData);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ //2021.7.6 linqh 如果是首店,则更新全部分店
|
|
|
+ self::updateSyncProduct($id, $model['shopId'],$upData);
|
|
|
}
|
|
|
|
|
|
//自动改价 2021.4.14
|
|
|
@@ -923,4 +895,23 @@ class ProductClass extends BaseClass
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //2021.7.6 修改花材同步其他分店
|
|
|
+ public static function updateSyncProduct($productId,$shopId,$upData)
|
|
|
+ {
|
|
|
+ $shopInfo = ShopClass::getById($shopId);
|
|
|
+ $productData = ProductClass::getById($productId);
|
|
|
+ $itemId = $productData['itemId'];
|
|
|
+ if($shopInfo['default']==1){
|
|
|
+ //首店
|
|
|
+ $sjId = $shopInfo['sjId'];
|
|
|
+ $shopAll = ShopClass::getAllShop($sjId);
|
|
|
+ if($shopAll){
|
|
|
+ foreach ($shopAll as $s){
|
|
|
+ if($s['id'] != $shopId){
|
|
|
+ ProductClass::updateByCondition(['itemId' => $itemId, 'shopId' => $s['id']], $upData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|