From 7d6049fbf703bf77b88a24b8251b92445be78ef1 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 11 Dec 2024 16:36:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(order):=20=E6=A3=80=E6=9F=A5=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=95=86=E5=93=81=E6=98=AF=E5=90=A6=E4=B8=8B=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在处理订单时,增加对商品是否下架的检查 - 如果发现商品已下架,抛出异常并提示用户更换商品后重新下单 - 针对不同来源的商品(source 为 2 时),分别检查 StoreBranchProduct 和 StoreProduct 表中的数据 --- app/api/logic/order/OrderLogic.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 0aaf4781..29aff2b6 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -100,11 +100,17 @@ class OrderLogic extends BaseLogic if ($source == 2) { $field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose'; $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find(); + if($find && $find['is_show']==0){ + throw new BusinessException('订单存在下架商品请更换后下单'); + } } else { $find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find(); if (!empty($user['user_ship'])) { $find = StoreProductGroupPrice::resetProductPrice($find, $user['user_ship']); } + if($find && $find['status']==0){ + throw new BusinessException('订单存在下架商品请更换后下单'); + } } if (!$find) { throw new BusinessException('商品不存在');