|
|
@@ -586,30 +586,20 @@ class ProductClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//单个修改价格 lqh 2021.1.28
|
|
|
- public static function changeSinglePrice($shop, $ptItemId, $price)
|
|
|
+ public static function changeSinglePrice($shop, $ptItemId, $price, $skPrice = null)
|
|
|
{
|
|
|
$mainId = $shop->mainId ?? 0;
|
|
|
$productInfo = ProductClass::getByCondition(['itemId' => $ptItemId, 'mainId' => $mainId], true);
|
|
|
if (empty($productInfo)) {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
$productInfo->price = $price;
|
|
|
-
|
|
|
- $addPrice = $productInfo->addPrice ?? 0;
|
|
|
-
|
|
|
- $skAddPrice = $productInfo->skAddPrice ?? 0;
|
|
|
- $sk = bcsub($addPrice, $skAddPrice, 2);
|
|
|
- $productInfo->skPrice = bcsub($price, $sk, 2);
|
|
|
-
|
|
|
- $hjAddPrice = $productInfo->hjAddPrice ?? 0;
|
|
|
- $hj = bcsub($addPrice, $hjAddPrice, 2);
|
|
|
- $productInfo->hjPrice = bcsub($price, $hj, 2);
|
|
|
-
|
|
|
- $zsAddPrice = $productInfo->zsAddPrice ?? 0;
|
|
|
- $zs = bcsub($addPrice, $zsAddPrice, 2);
|
|
|
- $productInfo->zsPrice = bcsub($price, $zs, 2);
|
|
|
-
|
|
|
+ if (empty($skPrice)) {
|
|
|
+ $skMore = $productInfo->skMore ?? 0;
|
|
|
+ $productInfo->skPrice = bcadd($price, $skMore, 2);
|
|
|
+ } else {
|
|
|
+ $productInfo->skPrice = $skPrice;
|
|
|
+ }
|
|
|
$productInfo->save();
|
|
|
}
|
|
|
|