调整商品列表查询

This commit is contained in:
luofei 2024-01-22 14:11:53 +08:00
parent b2f006f51c
commit d4094ba1c3

View File

@ -330,12 +330,12 @@ class MerchantDao extends BaseDao
->whereNotNull('long') ->whereNotNull('long')
->field("mer_id,st_distance_sphere(point(`long`,`lat`), point({$lng}, {$lat})) as distance") ->field("mer_id,st_distance_sphere(point(`long`,`lat`), point({$lng}, {$lat})) as distance")
->having("distance <= {$distance}") ->having("distance <= {$distance}")
->limit(50)->select(); ->limit(50)->select()->toArray();
if (empty($merchant)) { if (empty($merchant) && $distance < 5000) {
$merchant = $this->getValidMerchantByDistance($lat, $lng, 5000); $merchant = $this->getValidMerchantByDistance($lat, $lng, 5000);
} }
if (!empty($merchant)) { if (!empty($merchant)) {
return array_column($merchant->toArray(), 'mer_id'); return array_column($merchant, 'mer_id');
} }
return []; return [];
} }