fix(warehouse): 采购价必须大于0
- 在更新仓库产品库存时,增加对采购价的校验 - 如果采购价小于等于0,抛出"采购价必须大于0"的异常
This commit is contained in:
parent
b51e352305
commit
07a4c928a1
@ -48,6 +48,9 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
if (!$storeProduct) {
|
if (!$storeProduct) {
|
||||||
throw new BusinessException('商品不存在');
|
throw new BusinessException('商品不存在');
|
||||||
}
|
}
|
||||||
|
if($storeProduct['purchase']<=0){
|
||||||
|
throw new BusinessException('采购价必须大于0,'.$params['product_id']);
|
||||||
|
}
|
||||||
$total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
|
$total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
|
||||||
WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]);
|
WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user