|
@@ -469,6 +469,54 @@ class Topicdongtai extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //我的收藏
|
|
|
+ public function my_collect(){
|
|
|
+
|
|
|
+ $collect_id = Db::name('user_collect')->where(['table'=>'topic_dongtai','user_id'=>$this->auth->id])->column('table_id');
|
|
|
+
|
|
|
+ $where = ['dt.id','IN',$collect_id];
|
|
|
+
|
|
|
+ $list = Db::name('topic_dongtai')->alias('dt')
|
|
|
+ ->join('user','dt.user_id = user.id','LEFT')
|
|
|
+ ->join('user_wallet uw','user.id = uw.user_id','LEFT')
|
|
|
+ ->field('dt.*,user.nickname,user.avatar,user.gender,user.birthday,user.attribute,uw.vip_endtime')
|
|
|
+ ->where($where)
|
|
|
+ ->order('dt.id desc')->autopage()->select();
|
|
|
+ $list = list_domain_image($list,['images','audio_file','avatar']);
|
|
|
+
|
|
|
+ if(!empty($list)){
|
|
|
+ foreach($list as $key => &$val){
|
|
|
+
|
|
|
+ $val['aite'] = json_decode($val['aite'],true);
|
|
|
+
|
|
|
+ //用户年龄
|
|
|
+ $val['age'] = birthtime_to_age($val['birthday']);
|
|
|
+ unset($val['birthday']);
|
|
|
+
|
|
|
+ //用户vip
|
|
|
+ $val['is_vip'] = $val['vip_endtime'] > time() ? 1 : 0;
|
|
|
+ unset($val['vip_endtime']);
|
|
|
+
|
|
|
+ //追加点赞
|
|
|
+ $val['isgood'] = $this->is_good($val['id'],$this->auth->id);
|
|
|
+
|
|
|
+ //时间
|
|
|
+ $val['createtime_text'] = get_last_time($val['createtime']);
|
|
|
+
|
|
|
+ //关注
|
|
|
+ $val['is_follow'] = $this->is_follow($val['user_id'],$this->auth->id);
|
|
|
+
|
|
|
+ //层主评论数量
|
|
|
+ $val['answernumber'] = Db::name('topic_dongtai_answer')->where(['dt_id'=>$val['id'],'level'=>1])->count();
|
|
|
+
|
|
|
+ //话题
|
|
|
+ $val['topic_text'] = Db::name('topic_hub')->where('id','IN',$val['topic_ids'])->column('name');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('success',$list);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//不感兴趣,屏蔽某条
|
|
|
/*public function screen(){
|