|
|
|
@ -191,7 +191,10 @@ class ShopLogic extends Logic |
|
|
|
|
|
|
|
$city = DevRegion::where('id',$get['city_id'])->field('db09_lng,db09_lat')->findOrEmpty()->toArray(); |
|
|
|
|
|
|
|
$list = Shop::field('id,name,logo,background,visited_num,cover,banner,st_distance_sphere(point('.$city['db09_lng'].','.$city['db09_lat'].'),point(longitude, latitude)) as distance') |
|
|
|
// $list = Shop::field('id,name,logo,background,visited_num,cover,banner,st_distance_sphere(point('.$city['db09_lng'].','.$city['db09_lat'].'),point(longitude, latitude)) as distance') |
|
|
|
$list = Shop::field('id,name,logo,background,visited_num,cover,banner,ROUND(ACOS(SIN(RADIANS('.$city['db09_lat'].')) * SIN(RADIANS(latitude)) + |
|
|
|
COS(RADIANS('.$city['db09_lat'].')) * COS(RADIANS(latitude)) * |
|
|
|
COS(RADIANS('.$city['db09_lng'].' - longitude))) * 6371,2) AS distance ') |
|
|
|
->where($where) |
|
|
|
// 无限期 或 未到期 |
|
|
|
->whereRaw('expire_time =0 OR expire_time > '. time()) |
|
|
|
|