From 63838302afd7ce33561310c210dff18cfb3b9fd4 Mon Sep 17 00:00:00 2001 From: liapples Date: Sun, 14 Nov 2021 00:10:57 +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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/AdminSupplier/Controllers/ProductController.php b/app/AdminSupplier/Controllers/ProductController.php index f85f2be..f68f7ee 100644 --- a/app/AdminSupplier/Controllers/ProductController.php +++ b/app/AdminSupplier/Controllers/ProductController.php @@ -391,13 +391,8 @@ class ProductController extends AdminController return $form->response()->error('数据不存在'); } - $where = [ - ['product_id', '=', $form->getKey()], - ['status', '>', OrderStatus::UNPAID], - ['status', '<', OrderStatus::SUCCESS], - ['status', '<>', OrderStatus::REFUNDED], - ]; - if (Order::where($where)->exists()) { + $no_status = [OrderStatus::CANCEL, OrderStatus::REFUNDED, OrderStatus::SUCCESS]; + if (Order::where('product_id', $form->getKey())->whereNotIn('status', $no_status)->exists()) { return $form->response()->error('该产品存在未完成的订单,不允许删除'); } });