| xqd
@@ -236,25 +236,25 @@ class DynamicService
|
|
|
|
|
|
|
|
|
//计算距离 如果设置了位置,使用设置位置 否则使用定位位置
|
|
|
-// if(!$v['latitude']||!$v['longitude']){
|
|
|
-// //没有设置位置 取用户位置
|
|
|
-// $v_user = User::query()->where(['id'=>$v['user_id']])->first();
|
|
|
-// if(!$v_user['latitude'] || !$v_user['longitude']){
|
|
|
-// $distance = 0;
|
|
|
-// }else{
|
|
|
-// $distance = GetDistance($lat,$lng,$v_user['latitude'],$v_user['longitude']);
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// $distance = GetDistance($lat,$lng,$v['latitude'],$v['longitude']);
|
|
|
-// }
|
|
|
-
|
|
|
-// if($distance>=1){
|
|
|
-// $distance = round($distance);
|
|
|
-// }else{
|
|
|
-// $distance = round($distance*1000);
|
|
|
-// }
|
|
|
-//
|
|
|
-// $dynamic['data'][$k]['distance'] = $distance;
|
|
|
+ if(!$v['latitude']||!$v['longitude']){
|
|
|
+ //没有设置位置 取用户位置
|
|
|
+ $v_user = User::query()->where(['id'=>$v['user_id']])->first();
|
|
|
+ if(!$v_user['latitude'] || !$v_user['longitude']){
|
|
|
+ $distance = 0;
|
|
|
+ }else{
|
|
|
+ $distance = GetDistance($lat,$lng,$v_user['latitude'],$v_user['longitude']);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $distance = GetDistance($lat,$lng,$v['latitude'],$v['longitude']);
|
|
|
+ }
|
|
|
+
|
|
|
+ if($distance>=1){
|
|
|
+ $distance = round($distance);
|
|
|
+ }else{
|
|
|
+ $distance = round($distance*1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ $dynamic['data'][$k]['distance'] = $distance;
|
|
|
|
|
|
|
|
|
$dynamic['data'][$k]['atime'] = uc_time_ago(strtotime($v['created_at']));
|