123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Db;
- /**
- * 访问足迹
- */
- class Uservisit extends Api
- {
- protected $noNeedLogin = [];
- protected $noNeedRight = ['*'];
- //我的访问列表
- public function my_visit_list(){
- $list = Db::name('user_visit')
- ->alias('visit')
- ->join('user','visit.to_uid = user.id','LEFT')
- ->field('user.id,user.nickname,user.avatar,visit.updatetime')
- ->where('visit.uid',$this->auth->id)
- ->order('visit.updatetime desc')->autopage()->select();
- $list = list_domain_image($list,['avatar']);
- foreach($list as $key => &$val){
- //时间
- $val['createtime_text'] = get_last_time($val['updatetime']);
- unset($val['updatetime']);
- }
- $number = Db::name('user_visit')->alias('visit')
- ->where('visit.uid',$this->auth->id)
- ->count();
- $result = [
- 'list' => $list,
- 'number' => $number,
- 'is_vip' => $this->is_vip($this->auth->id),
- ];
- $this->success('success',$result);
- }
- //访问我的人列表,消除无痕
- public function visit_me_list(){
- $list = Db::name('user_visit')
- ->alias('visit')
- ->join('user','visit.uid = user.id','LEFT')
- ->field('user.id,user.nickname,user.avatar,visit.updatetime')
- ->where('visit.to_uid',$this->auth->id)
- ->order('visit.updatetime desc')->autopage()->select();
- $list = list_domain_image($list,['avatar']);
- foreach($list as $key => &$val){
- //时间
- $val['createtime_text'] = get_last_time($val['updatetime']);
- unset($val['updatetime']);
- }
- $number = Db::name('user_visit')->alias('visit')
- ->where('visit.to_uid',$this->auth->id)
- ->count();
- $result = [
- 'list' => $list,
- 'number' => $number,
- 'is_vip' => $this->is_vip($this->auth->id),
- ];
- $this->success('success',$result);
- }
- //查看某人
- public function visit_one(){
- //放到usercenter/getuserinfo里了
- }
- }
|