浏览代码

黑名单影响匹配结果,匹配到了自己

lizhen_gitee 1 年之前
父节点
当前提交
9c2f472981
共有 2 个文件被更改,包括 7 次插入5 次删除
  1. 6 4
      application/api/controller/Index.php
  2. 1 1
      application/api/controller/Payios.php

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

@@ -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');
 

+ 1 - 1
application/api/controller/Payios.php

@@ -209,7 +209,7 @@ class Payios extends Api
         $this->success('success',$data['out_trade_no']);
     }
 
-    //vip,苹果内购支付回调,app请求的接口
+    //金币+vip,苹果内购支付回调,app请求的接口
     public function gold_notify_iosnew(){
 
         //苹果内购的验证收据