From 37107288069a82a014f1ba63b9e877b6cac0e9c2 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 21 Dec 2024 23:37:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=20=E4=BF=AE=E5=A4=8D=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=A2=84=E8=AE=A2=E5=8D=95=E5=95=86=E5=93=81=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加用户非会员价格判断,避免非会员显示会员价格 - 优化价格查询逻辑,提高代码可读性和性能 --- app/admin/logic/beforehand_order/BeforehandOrderLogic.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 455d9a580..e8941155d 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -371,6 +371,7 @@ class BeforehandOrderLogic extends BaseLogic if ($count > 0) { throw new BusinessException('订单中有数量为0的商品,请先处理'); } + $user_ship=0; if($order['uid']>0){ $user_ship=User::where('id', $order['uid'])->value('user_ship')??0; } @@ -390,7 +391,11 @@ class BeforehandOrderLogic extends BaseLogic $arr['delivery_time'] = strtotime($delivery_time); $res = WarehouseOrder::create($arr); foreach ($info as $key => $arr) { - $price=StoreProductGroupPrice::where('product_id',$arr['product_id'])->where('group_id',$user_ship)->value('price')??0; + if($user_ship==0){ + $price=0; + }else{ + $price=StoreProductGroupPrice::where('product_id',$arr['product_id'])->where('group_id',$user_ship)->value('price')??0; + } $data = [ 'warehouse_id' => $warehouse_id, 'product_id' => $arr['product_id'],