From 7240f8768805174e538794e75a420607c8f7a1fc Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Thu, 24 Mar 2022 13:43:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=A2=E5=8D=95=E5=8F=91?= =?UTF-8?q?=E8=B4=A7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Services/OrderPackageService.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Admin/Services/OrderPackageService.php b/app/Admin/Services/OrderPackageService.php index 9dc7a728..4941f085 100644 --- a/app/Admin/Services/OrderPackageService.php +++ b/app/Admin/Services/OrderPackageService.php @@ -25,10 +25,10 @@ class OrderPackageService if (!($order->isWaitShipping() || $order->isShipping())) { throw new BizException('订单状态异常,无法发货'); } - if (!isset($params['packages']) || count($params['packages']) <= 0) { - throw new BizException('请选择发货商品'); - } foreach ($params['packages'] as $item) { + if (isset($item['_remove_']) && $item['_remove_']) {//如果是已被移除选项则直接移除 + continue; + } if ($item['quantity'] < 1) { throw new BizException('发货数量不能小于1'); } @@ -41,6 +41,9 @@ class OrderPackageService ]; } } + if (count($packageProducts) <= 0) { + throw new BizException('请选择发货商品'); + } foreach ($packageProducts as $product) { $_orderProduct = OrderProduct::where('order_id', $order->id) ->where('after_sale_state', '<>', 1)