This commit is contained in:
mkm 2023-11-09 20:42:34 +08:00
parent cc66772c66
commit 6a01d9a1a3

View File

@ -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']);