From 281e6d567f44ad622b8008cef87c80bf505a0ad2 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 10 Jul 2024 10:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E7=BA=A6=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/store/SystemStoreLists.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/api/lists/store/SystemStoreLists.php b/app/api/lists/store/SystemStoreLists.php index 4462b893..c730b1ae 100644 --- a/app/api/lists/store/SystemStoreLists.php +++ b/app/api/lists/store/SystemStoreLists.php @@ -93,10 +93,17 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac } }else{ - foreach ($data as &$value){ - $value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude); + if($latitude && $longitude){ + foreach ($data as &$value){ + $value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude); + } + }else{ + foreach ($data as &$values){ + $values['distance'] = 0; + } } + } usort($data, function ($a, $b) {