更新店铺距离

This commit is contained in:
mkm 2023-11-09 20:25:17 +08:00
parent 8f3dea51fb
commit cc66772c66
2 changed files with 5 additions and 4 deletions

View File

@ -103,8 +103,9 @@ class MerchantDao extends BaseDao
});
}
}
if (isset($where['status']) && $where['status'] !== '')
if (isset($where['status']) && $where['status'] !== ''){
$query->where('status', $where['status']);
}
$order = $where['order'] ?? '';
$query->when($order, function ($query) use ($where, $order) {
if ($order == 'rate') {
@ -123,8 +124,8 @@ class MerchantDao extends BaseDao
$query->order('is_best DESC, sales DESC,sort DESC');
}
}, function ($query) use ($order) {
// $query->order('is_best DESC, sort DESC,sales DESC');
$query->order('mer_id DESC');
$query->order('is_best DESC, sort DESC,sales DESC');
// $query->order('mer_id DESC');
});
return $query;
}

View File

@ -316,7 +316,7 @@ class MerchantRepository extends BaseRepository
$status = systemConfig('mer_location');
/** @var MerchantTakeRepository $repository */
$repository = app()->make(MerchantTakeRepository::class);
$list = $query->page($page, $limit)->setOption('field', [])->field($field)->select()
$list = $query->page($page, 100)->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']);