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();