From f23348e8a1fb7f64af294c4e01b6b332afb7ebcb Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 3 Jul 2024 11:23:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A6=96=E6=AC=A1=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E5=92=8C=E5=90=8E=E7=BB=AD=E9=BB=98=E8=AE=A4=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E6=8B=BF=E6=9C=80=E8=BF=91=E8=AE=A2=E5=8D=95=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E7=9A=84=E5=BA=97=E9=93=BA=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 9a997a7bd..31a6a40fd 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -192,8 +192,21 @@ class OrderLogic extends BaseLogic $store['near_store'] = $nearestStore; } }else{ - $store_id = getenv('STORE_ID') ?? 1; - $store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[]; + if(empty($user)){ + $store_id = getenv('STORE_ID') ?? 1; + $store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[]; + }else{ + $checkOrderStore = StoreOrder::where('uid',$user['id'])->field('id,store_id') + ->order('id','desc')->find(); + if($checkOrderStore){ + $store['near_store'] =SystemStore::where('id', $checkOrderStore['store_id'])->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[]; + }else{ + $store_id = getenv('STORE_ID') ?? 1; + $store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[]; + } + + } + } } catch (\Exception $e) { self::setError($e->getMessage());