From f0eda34869136b2db4d914ca0cbb1ae8d9dedab6 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 8 Jan 2025 16:16:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=20=E4=BF=AE=E5=A4=8D=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E4=B8=AD=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=8D=95=E4=BD=8D=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 BeforehandOrderCartInfoLists 类中,增加了对商品单位 ID 的判断 - 当商品单位 ID 大于 0 时,正常查询并显示单位名称 - 当商品单位 ID 小于等于 0 时,将单位名称设置为空字符串,避免查询报错 --- .../BeforehandOrderCartInfoLists.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/admin/lists/beforehand_order_cart_info/BeforehandOrderCartInfoLists.php b/app/admin/lists/beforehand_order_cart_info/BeforehandOrderCartInfoLists.php index 5768adde5..aa1c78a28 100644 --- a/app/admin/lists/beforehand_order_cart_info/BeforehandOrderCartInfoLists.php +++ b/app/admin/lists/beforehand_order_cart_info/BeforehandOrderCartInfoLists.php @@ -82,7 +82,11 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe ->order(['id' => 'desc']) ->select()->each(function ($item) use ($system_store, $order_mark) { $find = StoreProduct::where('id', $item['product_id'])->field('top_cate_id,store_name,image,unit')->withTrashed()->find(); - $item->unit_name = StoreProductUnit::where('id', $find->unit)->value('name'); + if($find->unit>0){ + $item->unit_name = StoreProductUnit::where('id', $find->unit)->value('name'); + }else{ + $item->unit_name = ''; + } $item['warehouse_stock'] = WarehouseProductStorege::where('product_id', $item['product_id'])->where('warehouse_id',1)->value('nums') ?? 0; $item['store_name'] = $find['store_name']; $item['system_store'] = $system_store;