From b793ace8404c87c15aac5c230a502eea25f8e9c6 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 3 Feb 2025 15:42:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E4=BF=AE=E5=A4=8D=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91=E4=B8=AD=E4=BA=A7=E5=93=81=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 DemoLogic 中,将 StoreProduct 查询修改为包含软删除的产品 - 使用 withTrashed() 方法确保可以获取到所有产品,包括已软删除的 --- app/api/logic/DemoLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/logic/DemoLogic.php b/app/api/logic/DemoLogic.php index 24349cf1..5deb97f3 100644 --- a/app/api/logic/DemoLogic.php +++ b/app/api/logic/DemoLogic.php @@ -121,7 +121,7 @@ class DemoLogic extends BaseLogic $cartInfo = BeforehandOrderCartInfo::where('bhoid', $params['id'])->select()->toArray(); $productIds = array_column($cartInfo, 'product_id'); - $products = StoreProduct::whereIn('id', $productIds)->select()->toArray(); + $products = StoreProduct::whereIn('id', $productIds)->withTrashed()->select()->toArray(); $products = reset_index($products, 'id'); $update = []; foreach ($cartInfo as $v) {