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 = [];