alias('visit') ->join('user','visit.to_uid = user.id','LEFT') ->field('user.id,user.nickname,user.avatar,user.bio,user.birthday,user.gender') ->where('visit.uid',$this->auth->id)->order('visit.updatetime desc')->autopage()->select(); $list = list_domain_image($list,['avatar']); $list = list_birthday_age($list); $this->success('success',$list); } //访问我的人列表 public function visit_me_list(){ $time = Db::name('user_visit_time')->where(['user_id' => $this->auth->id])->find(); if ($time) { Db::name('user_visit_time')->where(['user_id' => $this->auth->id])->setField('visittime', time()); } else { Db::name('user_visit_time')->insertGetId(['user_id' => $this->auth->id, 'visittime' => time()]); } $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']); // $list = list_birthday_age($list); //查询会员 $vip_endtime = Db::name('user_wallet')->where(['user_id' => $this->auth->id])->value('vip_endtime'); if ($this->auth->gender == 1 && $vip_endtime < time()) { $is_show = 0; } else { $is_show = 1; //是否正常显示信息: 1显示 0不显示 } $mt_user_greet = Db::name('user_greet'); //是否打过招呼 foreach ($list as &$v) { $v['updatetime'] = get_last_time($v['updatetime']); $v['is_show'] = $is_show; //查询是否搭讪过 $count = $mt_user_greet->where(['user_id' => $this->auth->id, 'user_to_id' => $v['id']])->count('id'); if ($count) { $v['is_chat'] = 1; //是否打过招呼: 1是 0否 } else { $v['is_chat'] = 0; //是否打过招呼: 1是 0否 } if ($is_show == 0) { $v['id'] = 0; $v['nickname'] = 'Ta偷偷来过'; $v['avatar'] = config('avatar_girl'); } } $this->success('success',$list); } //查看某人 public function visit_one(){ //放到usercenter/getuserinfo里了 } }