|
|
@@ -324,7 +324,7 @@ class ProductController extends BaseController
|
|
|
if (empty($data) || empty($type)) {
|
|
|
util::fail("参数错误");
|
|
|
}
|
|
|
- if (in_array($type, ['inTurn', 'addPrice', 'qtAddPrice', 'byAddPrice', 'hjAddPrice', 'zsAddPrice', 'cost', 'weight', 'ratio', 'ratio', 'price', 'stockWarning', 'shelfLife']) == false) {
|
|
|
+ if (in_array($type, ['inTurn', 'addPrice', 'skAddPrice', 'hjAddPrice', 'zsAddPrice', 'cost', 'weight', 'ratio', 'ratio', 'price', 'stockWarning', 'shelfLife']) == false) {
|
|
|
util::fail('非法数据修改');
|
|
|
}
|
|
|
$data = json_decode($data, true);
|
|
|
@@ -374,18 +374,15 @@ class ProductController extends BaseController
|
|
|
$costIds = is_array($arrIds) ? $arrIds : [];
|
|
|
if (!empty($costIds) && in_array($id, $costIds)) {
|
|
|
$newAddPrice = bcsub($val, $product->cost, 2);
|
|
|
- $qtDiff = bcsub($product->addPrice, $product->qtAddPrice, 2);
|
|
|
- $newQtAddPrice = bcsub($newAddPrice, $qtDiff, 2);
|
|
|
- $byDiff = bcsub($product->addPrice, $product->byAddPrice, 2);
|
|
|
- $newByAddPrice = bcsub($newAddPrice, $byDiff, 2);
|
|
|
+ $qtDiff = bcsub($product->addPrice, $product->skAddPrice, 2);
|
|
|
+ $newSkAddPrice = bcsub($newAddPrice, $qtDiff, 2);
|
|
|
$hjDiff = bcsub($product->addPrice, $product->hjAddPrice, 2);
|
|
|
$newHjAddPrice = bcsub($newAddPrice, $hjDiff, 2);
|
|
|
$zsDiff = bcsub($product->addPrice, $product->zsAddPrice, 2);
|
|
|
$newZsAddPrice = bcsub($newAddPrice, $zsDiff, 2);
|
|
|
$params = [];
|
|
|
$params['addPrice'] = $newAddPrice;
|
|
|
- $params['qtAddPrice'] = $newQtAddPrice;
|
|
|
- $params['byAddPrice'] = $newByAddPrice;
|
|
|
+ $params['skAddPrice'] = $newSkAddPrice;
|
|
|
$params['hjAddPrice'] = $newHjAddPrice;
|
|
|
$params['zsAddPrice'] = $newZsAddPrice;
|
|
|
|
|
|
@@ -423,15 +420,10 @@ class ProductController extends BaseController
|
|
|
}
|
|
|
$currentProduct->$type = $val;
|
|
|
if ($type == 'addPrice') {
|
|
|
- $qtAddPrice = $currentProduct->qtAddPrice;
|
|
|
- if ($qtAddPrice <= 0) {
|
|
|
- $currentProduct->qtAddPrice = $val - 1 > 0 ? $val - 1 : 1;
|
|
|
- $data['qtAddPrice'] = $currentProduct->qtAddPrice;
|
|
|
- }
|
|
|
- $byAddPrice = $currentProduct->byAddPrice;
|
|
|
- if ($byAddPrice <= 0) {
|
|
|
- $currentProduct->byAddPrice = $val - 2 > 0 ? $val - 2 : 1;
|
|
|
- $data['byAddPrice'] = $currentProduct->byAddPrice;
|
|
|
+ $skAddPrice = $currentProduct->skAddPrice;
|
|
|
+ if ($skAddPrice <= 0) {
|
|
|
+ $currentProduct->skAddPrice = $val - 1 > 0 ? $val - 1 : 1;
|
|
|
+ $data['skAddPrice'] = $currentProduct->skAddPrice;
|
|
|
}
|
|
|
$hjAddPrice = $currentProduct->hjAddPrice;
|
|
|
if ($hjAddPrice <= 0) {
|