diff --git a/app/common/repositories/system/merchant/MerchantRepository.php b/app/common/repositories/system/merchant/MerchantRepository.php index d0b465b7..f991bff2 100644 --- a/app/common/repositories/system/merchant/MerchantRepository.php +++ b/app/common/repositories/system/merchant/MerchantRepository.php @@ -306,6 +306,7 @@ class MerchantRepository extends BaseRepository 'lat' => (float)$data[0], 'long' => (float)$data[1], ]; + $where['order']='location'; } } if ($where['keyword'] !== '') { @@ -316,7 +317,7 @@ class MerchantRepository extends BaseRepository $status = systemConfig('mer_location'); /** @var MerchantTakeRepository $repository */ $repository = app()->make(MerchantTakeRepository::class); - $list = $query->page($page, 100)->setOption('field', [])->field($field)->select() + $list = $query->page($page, $limit)->setOption('field', [])->field($field)->select() ->each(function ($item) use ($status, $where, $repository) { if ($status && $item['lat'] && $item['long'] && isset($where['location']['lat'], $where['location']['long'])) { $distance = getDistance($where['location']['lat'], $where['location']['long'], $item['lat'], $item['long']);