Browse Source

访客列表

lizhen_gitee 2 months ago
parent
commit
ec4c284849
2 changed files with 27 additions and 25 deletions
  1. 0 25
      application/api/controller/Index.php
  2. 27 0
      application/api/controller/Uservisit.php

+ 0 - 25
application/api/controller/Index.php

@@ -438,31 +438,6 @@ class Index extends Api
         $this->success('轮播图', $list);
     }
 
-    //谁看过我汇总
-    public function visitlist(){
-        $time = Db::name('user_visit_time')->where(['user_id' => $this->auth->id])->value('visittime');
-
-        $where = [];
-        if ($time) {
-            $where['updatetime'] = ['gt', $time];
-        }
-
-        $list = [];
-        $count = Db::name('user_visit')->where(['to_uid' => $this->auth->id])->where($where)->count('id');
-        if ($count) {
-            $uid_list = Db::name('user_visit')->field('uid')->where(['to_uid' => $this->auth->id])->where($where)->limit(9)->column('uid');
-            $mt_user = Db::name('user');
-            foreach ($uid_list as &$v) {
-                $avatar = $mt_user->where(['id' => $v])->value('avatar');
-                $list[] = one_domain_image($avatar);
-            }
-        }
-
-        $data['count'] = $count;
-        $data['list'] = $list;
-
-        $this->success('success',$data);
-    }
 
     //筛选年龄段
     public function agerange() {

+ 27 - 0
application/api/controller/Uservisit.php

@@ -74,6 +74,33 @@ class Uservisit extends Api
         $this->success('success',$list);
     }
 
+
+    //谁看过我汇总
+    public function visitlist(){
+        $time = Db::name('user_visit_time')->where(['user_id' => $this->auth->id])->value('visittime');
+
+        $where = [];
+        if ($time) {
+            $where['updatetime'] = ['gt', $time];
+        }
+
+        $list = [];
+        $count = Db::name('user_visit')->where(['to_uid' => $this->auth->id])->where($where)->count('id');
+        if ($count) {
+            $uid_list = Db::name('user_visit')->field('uid')->where(['to_uid' => $this->auth->id])->where($where)->limit(9)->column('uid');
+            $mt_user = Db::name('user');
+            foreach ($uid_list as &$v) {
+                $avatar = $mt_user->where(['id' => $v])->value('avatar');
+                $list[] = one_domain_image($avatar);
+            }
+        }
+
+        $data['count'] = $count;
+        $data['list'] = $list;
+
+        $this->success('success',$data);
+    }
+
     //查看某人
     public function visit_one(){
        //放到usercenter/getuserinfo里了