Browse Source

附近,城市的影响又改了

lizhen_gitee 1 year ago
parent
commit
547b1f1722
1 changed files with 11 additions and 4 deletions
  1. 11 4
      application/api/controller/Index.php

+ 11 - 4
application/api/controller/Index.php

@@ -24,17 +24,21 @@ class Index extends Api
     //是vip,且开启了隐身的,不能在内
     public function fujin(){
         $cityname = input('cityname','');
-        if(empty($cityname)){
+        /*if(empty($cityname)){
             $cityname = $this->auth->cityname;
-        }
+        }*/
 
         $where = [
             'user.id' => ['neq',$this->auth->id],
             'user.status' => 1,
-            'user.cityname' => $cityname,
+            //'user.cityname' => $cityname,
             'power.yinshen' => 0,
         ];
 
+        if(!empty($cityname) && $cityname != $this->auth->cityname){
+            $where['user.cityname'] = $cityname;
+        }
+
         //性别
         $gender = input('gender','all');
         if($gender != 'all'){
@@ -79,10 +83,13 @@ class Index extends Api
         }
 
         //当异地漫游的时候,距离条件作废
-        if($cityname != $this->auth->cityname){
+        if(!empty($cityname) && $cityname != $this->auth->cityname){
             $having_dis = '';
         }
 
+//        dump($where);
+//        dump($having_dis);
+
         $field = [
             'user.id',
             'user.username',