Browse Source

关注功能

lizhen_gitee 1 year ago
parent
commit
9595de14a8
1 changed files with 1 additions and 79 deletions
  1. 1 79
      application/api/controller/Userfollow.php

+ 1 - 79
application/api/controller/Userfollow.php

@@ -131,56 +131,12 @@ class Userfollow extends Api
 
     }
 
-    //好友待审核列表。
-    public function newfriend_list(){
-        //我的关注uids
-        $my_follow_uids = $this->my_follow_uids();
-//        dump($my_follow_uids);
-
-        $list = Db::name('message')->alias('msg')
-            ->join('user user','user.id = msg.infotype_id','LEFT')
-            ->join('user_wallet uw','user.id = uw.user_id','LEFT')
-            ->field('msg.id as msg_id,user.id,user.username,user.nickname,user.avatar,user.bio,user.birthday,user.gender,user.attribute,uw.vip_endtime')
-            ->where(['msg.infotype'=>'newfriend','msg.user_id'=>$this->auth->id,'msg.audit_status'=>0])
-            ->where('msg.infotype_id','NOT IN',$my_follow_uids)
-            ->order('msg.id desc')->autopage()->select();
-
-        $list = list_domain_image($list,['avatar']);
-        $list = list_birthday_age($list);
-
-        if(!empty($list)){
-            foreach($list as $key => &$val){
-                //用户vip
-                $val['is_vip'] = $val['vip_endtime'] > time() ? 1 : 0;
-                unset($val['vip_endtime']);
-                //是否关注
-                $val['is_follow'] = in_array($val['id'],$my_follow_uids) ? 1 : 0;
-            }
-        }
-
-        $this->success('success',$list);
-    }
-
-    //拒绝好友请求
-    public function refuse_newfriend(){
-        $id = input('msg_id',0);
-
-        $msg_info = Db::name('message')->where('id',$id)->find();
-        Db::name('message')->where('id',$id)->update(['audit_status'=>1]);
-
-        //拒绝给个消息
-        if($msg_info['infotype'] == 'newfriend' && !empty($msg_info['infotype_id'])){
-            $msg_id = \app\common\model\Message::addMessage($msg_info['infotype_id'],'好友申请被拒绝',$this->auth->nickname.'拒绝了您的好友请求');
-        }
-
-        $this->success('已拒绝');
-    }
 
 
     //关注某人
     public function follow_one(){
         $follow_uid = input('follow_uid',0);
-        $msg_id = input('msg_id',0);
+
         if(!$follow_uid){
             $this->error(__('Invalid parameters'));
         }
@@ -213,41 +169,7 @@ class Userfollow extends Api
             $this->error('关注失败');
         }
 
-        //被关注人如果没有关注我,发一条消息,让他加好友,也就是让他回关
-        $map2 = [
-            'uid' => $follow_uid,
-            'follow_uid' => $this->auth->id,
-        ];
-
-        $check = Db::name('user_follow')->where($map2)->find();
-        if(empty($check)){
-            //防止重复刷关注,先删掉以前的,再加新的
-            Db::name('message')
-                ->where('user_id',$follow_uid)
-                ->where('infotype','newfriend')
-                ->where('infotype_id',$this->auth->id)
-                ->delete();
-
-                $message = [
-                    'user_id' => $follow_uid,
-                    'title'   => '好友请求',
-                    'content' => '有人关注了你,回关TA成为好友',
-                    'createtime' => time(),
-                    'status' => 0,
-                    'infotype' => 'newfriend',//关注,请求好友
-                    'infotype_id' => $this->auth->id,
-                ];
-                Db::name('message')->insertGetId($message);
-
-        }
-
-        //我从好友审核列表过来的,我又回关了
-        if(!empty($msg_id)){
-            Db::name('message')->where('id',$id)->update(['audit_status'=>1]);
-            $msg_id = \app\common\model\Message::addMessage($follow_uid,'好友申请已通过',$this->auth->nickname.'同意了您的好友请求');
-        }
 
-        
 
         Db::commit();
         $this->success('操作成功',$id);