|
@@ -290,19 +290,20 @@ class Index extends Api
|
|
|
}
|
|
|
|
|
|
//排除黑名单的
|
|
|
+ $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];
|
|
|
}
|
|
|
|
|
|
//匹配一个
|
|
|
- $result = $this->pipei_action($redis_ids,$where);
|
|
|
+ $result = $this->pipei_action($redis_ids,$where,$where_black);
|
|
|
|
|
|
//匹配不到,移除防重复
|
|
|
if(!$result) {
|
|
|
Cache::rm($user_id_redis);
|
|
|
$redis_ids = [];
|
|
|
- $result = $this->pipei_action($redis_ids,$where);
|
|
|
+ $result = $this->pipei_action($redis_ids,$where,$where_black);
|
|
|
}
|
|
|
// 追加一个防重复
|
|
|
if($result){
|
|
@@ -323,7 +324,7 @@ class Index extends Api
|
|
|
$this->success(1,$result);
|
|
|
}
|
|
|
|
|
|
- private function pipei_action($redis_ids,$where){
|
|
|
+ private function pipei_action($redis_ids,$where,$where_black){
|
|
|
$where_op = [];
|
|
|
if(!empty($redis_ids)){
|
|
|
$where_op['user.id'] = ['NOTIN',$redis_ids];
|
|
@@ -333,6 +334,7 @@ class Index extends Api
|
|
|
->join('user_active active' ,'user.id = active.user_id','LEFT')
|
|
|
->where($where)
|
|
|
->where($where_op)
|
|
|
+ ->where($where_black)
|
|
|
->orderRaw('rand()')
|
|
|
->value('user.id');
|
|
|
|