where('status',1)->order('weight desc,id desc')->autopage()->select(); $list = list_domain_image($list,['image']); $this->success('success',$list); } //没用到,和下面的hottopicinfo重复了 /*public function info(){ $id = input('id',0); $info = Db::name('topic_hub')->where(['status'=>1,'id'=>$id])->find(); $info = info_domain_image($info,['image']); $this->success('success',$info); }*/ //热门话题 public function hottopic() { $list = Db::name('topic_hub')->field('id, name, image, t_number, icon_type')->where('status',1)->order('weight desc,id desc')->autopage()->select(); $list = list_domain_image($list,['image']); if ($list) { $where['a.status'] = 0; //是否已删除:0=否,1=是 $where['a.auit_status'] = 1; //审核状态:0=待审核,1=通过,2=拒绝 $where['user.is_kefu'] = 0; if ($this->auth->gender == 1) { //男看女 $where['user.gender'] = 0; } elseif ($this->auth->gender == 0) { //女看男 $where['user.gender'] = 1; } else { $this->success('success', []); } $mt_topic_dongtai = Db::name('topic_dongtai a'); foreach ($list as &$v) { $where['a.topic_id'] = $v['id']; $v['t_number'] = $mt_topic_dongtai ->join('mt_user user', 'a.user_id = user.id', 'left') ->where($where)->count('a.id'); } } $this->success('success',$list); } //热门话题详情 public function hottopicinfo() { $id = input('id', 0, 'intval'); //热门话题id $info = Db::name('topic_hub')->field('id, name, info, image, t_number, icon_type')->where(['status'=>1,'id'=>$id])->find(); if (!$info) { $this->error('您的网络开小差了~'); } $info = info_domain_image($info,['image']); if ($info) { $where['a.status'] = 0; //是否已删除:0=否,1=是 $where['a.auit_status'] = 1; //审核状态:0=待审核,1=通过,2=拒绝 $where['user.is_kefu'] = 0; if ($this->auth->gender == 1) { //男看女 $where['user.gender'] = 0; } elseif ($this->auth->gender == 0) { //女看男 $where['user.gender'] = 1; } else { $this->success('success', []); } $mt_topic_dongtai = Db::name('topic_dongtai a'); $where['a.topic_id'] = $info['id']; $info['t_number'] = $mt_topic_dongtai ->join('mt_user user', 'a.user_id = user.id', 'left') ->where($where)->count('a.id'); } $this->success('success',$info); } }