From 6cfc2c773ee99345ada887f8f24d68c163615861 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 16:50:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(order):=20=E4=BF=AE=E6=94=B9=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=80=BB=E8=BE=91=E4=BB=A5=E5=A4=84=E7=90=86=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 33be0201c..411272a01 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -186,11 +186,12 @@ class OrderLogic extends BaseLogic if (!$orderInfo) { return false; } + $uid=$user['id']??0; $_order = $orderInfo['order']; - $_order['uid'] = $user['id']; + $_order['uid'] = $uid; $_order['spread_uid'] =$params['spread_uid']??0; - $_order['real_name'] = $user['real_name']; - $_order['mobile'] = $user['mobile']; + $_order['real_name'] = $user['real_name']??''; + $_order['mobile'] = $user['mobile']??''; $_order['pay_type'] = $orderInfo['order']['pay_type']; $_order['verify_code'] = $verify_code; $_order['reservation_time'] = null; @@ -198,8 +199,8 @@ class OrderLogic extends BaseLogic $_order['reservation_time'] = $params['reservation_time']; $_order['reservation'] = YesNoEnum::YES; } - if ($addressId > 0) { - $address = UserAddress::where(['id' => $addressId, 'uid' => $user['id']])->find(); + if ($addressId > 0 &&$uid>0 ) { + $address = UserAddress::where(['id' => $addressId, 'uid' => $uid])->find(); if ($address) { $_order['real_name'] = $address['real_name']; $_order['user_phone'] = $address['phone']; @@ -222,7 +223,7 @@ class OrderLogic extends BaseLogic $goods_list = $orderInfo['cart_list']; foreach ($goods_list as $k => $v) { $goods_list[$k]['oid'] = $order->id; - $goods_list[$k]['uid'] = $user['id']; + $goods_list[$k]['uid'] = $uid; $goods_list[$k]['cart_id'] = implode(',', $cartId); $goods_list[$k]['delivery_id'] = $params['store_id']; //商家id $StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->withTrashed()->find();