Kaynağa Gözat

过滤掉通话中的

lizhen_gitee 3 yıl önce
ebeveyn
işleme
bb04334272
2 değiştirilmiş dosya ile 26 ekleme ve 11 silme
  1. 24 9
      application/api/controller/Usercenter.php
  2. 2 2
      thinkphp/helper.php

+ 24 - 9
application/api/controller/Usercenter.php

@@ -267,7 +267,7 @@ class Usercenter extends Api
     public function getvideouser(){
 
         //判断资格
-        $start = strtotime(date('Y-m-d'));
+        /*$start = strtotime(date('Y-m-d'));
         $end   = $start + 86399;
 
         $map = [
@@ -276,7 +276,8 @@ class Usercenter extends Api
             'price' => 0,
         ];
 
-        $check = Db::name('user_video_log')->where($map)->find();
+        $check = Db::name('user_video_log')->where($map)->find();*/
+        $check = true;
 
         //已经用掉免费的了,判断金额
         if($check){
@@ -287,7 +288,13 @@ class Usercenter extends Api
                 $this->error('您的金币已经不足,请充值');
             }
         }
-        
+
+        //找到互关的人,排除
+        $follow_me = Db::name('user_follow')->where('follow_uid',$this->auth->id)->column('uid');
+        //dump($follow_me);
+        $my_follow = Db::name('user_follow')->where(['uid'=>$this->auth->id,'follow_uid'=>['IN',$follow_me]])->column('follow_uid');
+        //dump($my_follow);exit;
+
 
         //给出备选用户
         $map = [
@@ -297,21 +304,29 @@ class Usercenter extends Api
             'idcard_status' => 1,
             //打开视频开关的
             'open_match_video' => 1,
-
-            'id' => ['neq',$this->auth->id]
-
+            'id' => ['NOT IN',$my_follow]
         ];
 
         $lists = Db::name('user')->field('id,cityname,status,gender,real_status,tag_ids')->where($map)->order('logintime desc')->page($this->page,100)->select();
-
         $lists = $this->fliter_user($lists);
         $this->success('success',$lists);
     }
 
     private function fliter_user($lists){
 
+        if(empty($lists)){
+            return $lists;
+        }
+
+        //过滤掉通话中的
+        foreach($lists as $key => $val){
+            if(redis_get($val['id']) == 1){
+                unset($lists[$key]);
+            }
+        }
+
         //预留全部
-        $result = array_column($lists,'id');
+        $all_result = array_column($lists,'id');
 
         //提取同城的
         $citydata = [];
@@ -361,7 +376,7 @@ class Usercenter extends Api
         }
 
         //仍然不够,全合并
-        $all_data = array_merge($result_data,$result);
+        $all_data = array_merge($result_data,$all_result);
         $all_data = array_flip(array_flip($all_data));
         return $all_data;
     }

+ 2 - 2
thinkphp/helper.php

@@ -366,11 +366,11 @@ if (!function_exists('cache')) {
      */
     function redis_set($name,$value,$expire = null){
         $cache = Cache::connect(['type'=>'Redis']);
-        return $cache->set('mt_matching_video_uid_'.$name, $value, $expire);
+        return $cache->set('mt_matching_uid_'.$name, $value, $expire);
     }
     function redis_get($name){
         $cache = Cache::connect(['type'=>'Redis']);
-        return $cache->get('mt_matching_video_uid_'.$name);
+        return $cache->get('mt_matching_uid_'.$name);
     }
     function cache($name, $value = '', $options = null, $tag = null)
     {