Browse Source

我的粉丝列表

lizhen_gitee 3 years ago
parent
commit
0661a647d6
2 changed files with 24 additions and 1 deletions
  1. 24 0
      application/api/controller/Userfollow.php
  2. 0 1
      application/common/model/Wallet.php

+ 24 - 0
application/api/controller/Userfollow.php

@@ -26,6 +26,20 @@ class Userfollow extends Api
         $this->success('success',$list);
     }
 
+    //我的粉丝列表
+    public function my_fans_list(){
+        $list = Db::name('user_follow')
+            ->alias('follow')
+            ->join('user','follow.uid = user.id','LEFT')
+            ->field('user.id,user.nickname,user.avatar,user.bio,user.birthday,user.gender')
+            ->where('follow.follow_uid',$this->auth->id)->order('follow.id desc')->autopage()->select();
+
+        $list = list_domain_image($list,['avatar']);
+        $list = list_birthday_age($list);
+
+        $this->success('success',$list);
+    }
+
     //关注某人
     public function follow_one(){
         $follow_uid = input('follow_uid',0);
@@ -33,6 +47,11 @@ class Userfollow extends Api
             $this->error(__('Invalid parameters'));
         }
 
+        $checkuser = Db::name('user')->find($follow_uid);
+        if(empty($checkuser)){
+            $this->error('此用户不存在');
+        }
+
         $map = [
             'uid' => $this->auth->id,
             'follow_uid' => $follow_uid,
@@ -55,6 +74,11 @@ class Userfollow extends Api
             $this->error(__('Invalid parameters'));
         }
 
+        $checkuser = Db::name('user')->find($follow_uid);
+        if(empty($checkuser)){
+            $this->error('此用户不存在');
+        }
+
         $map = [
             'uid' => $this->auth->id,
             'follow_uid' => $follow_uid,

+ 0 - 1
application/common/model/Wallet.php

@@ -1,6 +1,5 @@
 <?php
 namespace app\common\model;
-use com\Pay\Pay;
 use think\Model;
 use think\Db;
 /**