diff --git a/application/index/controller/Goods.php b/application/index/controller/Goods.php index e1122d8..bd07ca7 100644 --- a/application/index/controller/Goods.php +++ b/application/index/controller/Goods.php @@ -270,6 +270,17 @@ class Goods extends Frontend }else{ $data = $data->select(); } + foreach($data as $key => $vo){ + //计算距离 + $distance = 0; + if(!empty($param['lng']) && !empty($param['lat'])){ + $distance = distance($param,$vo); + if($distance <= 50){ + $ids[] = $vo['id']; + } + } + $data[$key]['distance'] = $distance; + } } $user_id = $this->auth->id; $userModel = new \app\index\model\User();