From 7abdeb54a3e1de0af5171d592d22aeae0e2b0201 Mon Sep 17 00:00:00 2001 From: liapples Date: Sun, 14 Nov 2021 00:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E7=9A=84=E8=AE=A2=E5=8D=95=EF=BC=8C=E4=B8=8D=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/AdminSupplier/Controllers/ProductController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/AdminSupplier/Controllers/ProductController.php b/app/AdminSupplier/Controllers/ProductController.php index d014ee0..f85f2be 100644 --- a/app/AdminSupplier/Controllers/ProductController.php +++ b/app/AdminSupplier/Controllers/ProductController.php @@ -391,13 +391,13 @@ class ProductController extends AdminController return $form->response()->error('数据不存在'); } - $exists_unfinished_order = Order::where([ + $where = [ ['product_id', '=', $form->getKey()], ['status', '>', OrderStatus::UNPAID], ['status', '<', OrderStatus::SUCCESS], ['status', '<>', OrderStatus::REFUNDED], - ])->exists(); - if ($exists_unfinished_order) { + ]; + if (Order::where($where)->exists()) { return $form->response()->error('该产品存在未完成的订单,不允许删除'); } });