From eb0bcc33c98824b4e2a382c4601a77d14b794b52 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 18 Nov 2024 15:29:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(warehouse):=20=E4=BF=AE=E5=A4=8D=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E5=95=86=E5=93=81=E6=80=BB=E4=BB=B7=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在更新库存商品数量时,增加了对商品采购价的判断 - 当采购价小于等于 0 时,将总价设置为 0,否则正常计算总价 --- app/admin/logic/warehouse_product/WarehouseProductLogic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/admin/logic/warehouse_product/WarehouseProductLogic.php b/app/admin/logic/warehouse_product/WarehouseProductLogic.php index 55b13ead9..662e98b8a 100644 --- a/app/admin/logic/warehouse_product/WarehouseProductLogic.php +++ b/app/admin/logic/warehouse_product/WarehouseProductLogic.php @@ -48,9 +48,10 @@ class WarehouseProductLogic extends BaseLogic if (!$storeProduct) { throw new BusinessException('商品不存在'); } - $total_price = bcmul($after_nums, $storeProduct['purchase'], 2); if($storeProduct['purchase']<=0){ $total_price=0; + }else{ + $total_price = bcmul($after_nums, $storeProduct['purchase'], 2); } WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]); }