From cb6dfe58f9eb0c37e0b2971137788131c3f19bb4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 22 Jan 2024 19:13:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/system/merchant/MerchantDao.php | 6 +++--- app/controller/api/store/product/CloudWarehouse.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common/dao/system/merchant/MerchantDao.php b/app/common/dao/system/merchant/MerchantDao.php index df24fd43..19bdd512 100644 --- a/app/common/dao/system/merchant/MerchantDao.php +++ b/app/common/dao/system/merchant/MerchantDao.php @@ -331,12 +331,12 @@ class MerchantDao extends BaseDao ->whereNotNull('long') ->field("mer_id,st_distance_sphere(point(`long`,`lat`), point({$lng}, {$lat})) as distance"); if ($sort) { - $query->order('distance')->limit(20); + $query->order('distance')->limit(100); } else { $query->having("distance <= {$distance}")->limit(50); } - $merchant = $query->select(); - if (empty($merchant) && $distance < 5000 && !$sort) { + $merchant = $query->select()->toArray(); + if (empty($merchant) && $distance < 50000 && !$sort) { $merchant = $this->getValidMerchantByDistance($lat, $lng, $sort, 50000); } if (!empty($merchant)) { diff --git a/app/controller/api/store/product/CloudWarehouse.php b/app/controller/api/store/product/CloudWarehouse.php index f8acf07f..1a2ab426 100644 --- a/app/controller/api/store/product/CloudWarehouse.php +++ b/app/controller/api/store/product/CloudWarehouse.php @@ -59,7 +59,7 @@ class CloudWarehouse extends BaseController } } if (!empty($lat)) { - $merIds = (new MerchantDao())->getValidMerchantByDistance($lat, $lng); + $merIds = (new MerchantDao())->getValidMerchantByDistance($lat, $lng,true,50000); if (!empty($merIds)) { $query->whereIn('mer_id', $merIds); } @@ -75,7 +75,7 @@ class CloudWarehouse extends BaseController $query->whereIn('cate_id', $cate_id); } $cloud_product_arr = $query->where(function($query){ - $query->whereOr('mer_labels', '') + $query->where('mer_labels', '') ->whereOr('mer_labels',',5,'); })->page($page)->field('product_id,mer_labels')->select(); $cloud_product = [];