Commit 77eeacdb authored by suntengda's avatar suntengda

Merge branch 'tuancan' into test

parents 34d4b89f 02f9de51
...@@ -131,6 +131,19 @@ class TakePlaceService ...@@ -131,6 +131,19 @@ class TakePlaceService
$page = $params['page'] ?? 1; $page = $params['page'] ?? 1;
$limit = $params['limit'] ?? 20; $limit = $params['limit'] ?? 20;
//兼容客户端传递NaN字符串的问题
if(!empty($longitude) && !is_numeric($longitude)) {
$longitude = '';
}
if(!empty($latitude) && !is_numeric($latitude)) {
$latitude = '';
}
//经纬度小程序调用时前后端都是反的,客户端按正确顺序传,程序把参数反过来,小程序目前来不及改,暂时先按反着的来
//临时交换客户端传过来的经纬度的值 @todo 后期前后端一起修正传参后去掉此逻辑(注意小程序版本控制)
if(isset($params['app_id']) && $params['app_id'] == 'merchant-c') {
list($longitude,$latitude) = [$latitude,$longitude];
}
$offset = ($page-1)*$limit; $offset = ($page-1)*$limit;
$res = ['list'=>[],'total'=>0]; $res = ['list'=>[],'total'=>0];
...@@ -190,7 +203,7 @@ class TakePlaceService ...@@ -190,7 +203,7 @@ class TakePlaceService
if(!empty($list) && is_array($list)) { if(!empty($list) && is_array($list)) {
foreach ($list as &$item) { foreach ($list as &$item) {
if($item['longitude'] && $item['latitude']) { if($item['longitude'] && $item['latitude']) {
$item['distance'] = Geo::geoDistance($lat,$lng,$item['longitude'],$item['latitude'],true); $item['distance'] = Geo::geoDistance($lat,$lng,$item['latitude'],$item['longitude'],true);
$sort[] = $item['distance']; $sort[] = $item['distance'];
}else { }else {
$item['distance'] = ''; $item['distance'] = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment