Merge pull request 'fix(warehouse): 修复库存商品采购价小于等于0时的总价计算问题' (#343) from dev into main

Reviewed-on: #343
This commit is contained in:
mkm 2024-11-18 15:27:59 +08:00
commit 703403947f

View File

@ -48,10 +48,10 @@ class WarehouseProductLogic extends BaseLogic
if (!$storeProduct) {
throw new BusinessException('商品不存在');
}
if($storeProduct['purchase']<=0){
throw new BusinessException('采购价必须大于0,'.$params['product_id']);
}
$total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
if($storeProduct['purchase']<=0){
$total_price=0;
}
WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]);
}
$before_nums = $storege['nums'];