Browse Source

附近和推荐,关于漫游和距离限制

lizhen_gitee 1 year ago
parent
commit
00a5971e84
1 changed files with 6 additions and 1 deletions
  1. 6 1
      application/api/controller/Index.php

+ 6 - 1
application/api/controller/Index.php

@@ -78,6 +78,11 @@ class Index extends Api
             $having_dis = 'distance > '.$distancemin*1000 .' and distance < '.$distancemax*1000;
         }
 
+        //当异地漫游的时候,距离条件作废
+        if($cityname != $this->auth->cityname){
+            $having_dis = '';
+        }
+
         $field = [
             'user.id',
             'user.username',
@@ -236,7 +241,7 @@ class Index extends Api
                     );
                     $query->whereOr($where_tuijian);
             })
-            ->having($having_dis)
+            //->having($having_dis)推荐完全不受距离限制
             ->order('user.is_active desc,distance asc')
             ->autopage()
             ->select();