Kaynağa Gözat

附近和推荐,黑名单uid冲突

lizhen_gitee 1 yıl önce
ebeveyn
işleme
26d3089456
1 değiştirilmiş dosya ile 6 ekleme ve 2 silme
  1. 6 2
      application/api/controller/Index.php

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

@@ -43,9 +43,10 @@ class Index extends Api
             $where['user.attribute'] = $attribute;
         }
         //排除黑名单的
+        $where_black = [];
         $black_ids = Db::name('user_black')->where(['uid'=>$this->auth->id])->column('black_uid');
         if(!empty($black_ids)){
-            $where['user.id'] = ['NOTIN',$black_ids];
+            $where_black['user.id'] = ['NOTIN',$black_ids];
         }
         //年龄
         $agemin = input('agemin',18);
@@ -94,6 +95,7 @@ class Index extends Api
             ->join('user_power power' ,'user.id = power.user_id','LEFT')
             ->join('user_active active' ,'user.id = active.user_id','LEFT')
             ->where($where)
+            ->where($where_black)
             ->order('distance asc')
             ->autopage()
             ->select();
@@ -147,9 +149,10 @@ class Index extends Api
             $where['user.attribute'] = $attribute;
         }
         //排除黑名单的
+        $where_black = [];
         $black_ids = Db::name('user_black')->where(['uid'=>$this->auth->id])->column('black_uid');
         if(!empty($black_ids)){
-            $where['user.id'] = ['NOTIN',$black_ids];
+            $where_black['user.id'] = ['NOTIN',$black_ids];
         }
         //年龄
         $agemin = input('agemin',18);
@@ -198,6 +201,7 @@ class Index extends Api
             ->join('user_power power' ,'user.id = power.user_id','LEFT')
             ->join('user_active active' ,'user.id = active.user_id','LEFT')
             ->where($where)
+            ->where($where_black)
             ->order('distance asc')
             ->autopage()
             ->select();