|
|
@@ -786,14 +786,15 @@ class ProductClass extends BaseClass
|
|
|
self::updateSyncProduct($id, $product->shopId, $upData);
|
|
|
}
|
|
|
|
|
|
- //自动改价 2021.4.14
|
|
|
+ //变成自动改价 2021.4.14
|
|
|
public static function autoPriceById($productId)
|
|
|
{
|
|
|
- $product = self::getById($productId);
|
|
|
- if ($product && $product['priceLabel'] == self::PRICE_LABEL_AUTO) {
|
|
|
- $price = bcadd($product['cost'], $product['addPrice'], 2);
|
|
|
- self::changePrice($productId, $product['shopId'], $price, self::PRICE_LABEL_AUTO);
|
|
|
+ $product = self::getById($productId,true);
|
|
|
+ if(empty($product)){
|
|
|
+ return false;
|
|
|
}
|
|
|
+ $price = bcadd($product->cost, $product->addPrice, 2);
|
|
|
+ self::changePrice($product,$price, self::PRICE_LABEL_AUTO);
|
|
|
}
|
|
|
|
|
|
//获取当前门店下所有的product
|