|
@@ -293,7 +293,15 @@ class Topicdongtai extends Api
|
|
|
|
|
|
//系统消息
|
|
|
if($dt_user_id != $this->auth->id){
|
|
|
- $msg_id = \app\common\model\Message::addMessage($dt_user_id,'动态点赞',$this->auth->nickname.'赞了你的动态','dongtai_good',$id);
|
|
|
+ //入库
|
|
|
+ $data = [];
|
|
|
+ $data['user_id'] = $dt_user_id;
|
|
|
+ $data['dt_id'] = $id;
|
|
|
+ $data['from_user_id'] = $this->auth->id;
|
|
|
+ $data['title'] = '点赞了你的动态';
|
|
|
+ $data['createtime'] = time();
|
|
|
+
|
|
|
+ Db::name('topic_dongtai_message')->insertGetId($data);
|
|
|
}
|
|
|
|
|
|
Db::commit();
|
|
@@ -301,16 +309,26 @@ class Topicdongtai extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //动态通知
|
|
|
+ public function message(){
|
|
|
+ $list = Db::name('topic_dongtai_message')->alias('msg')->field('msg.*,user.avatar,user.nickname')
|
|
|
+ ->join('user','msg.from_user_id = user.id','LEFT')
|
|
|
+ ->where('msg.user_id',$this->auth->id)->autopage()->select();
|
|
|
+ $list = list_domain_image($list,['avatar']);
|
|
|
+
|
|
|
+ $this->success(1,$list);
|
|
|
+ }
|
|
|
+
|
|
|
//举报
|
|
|
public function report(){
|
|
|
$dt_id = input('dt_id',0);
|
|
|
- $data['dt_id'] = $dt_id;
|
|
|
|
|
|
- $check = Db::name('topic_dongtai')->where('id',$data['dt_id'])->find();
|
|
|
+ $check = Db::name('topic_dongtai')->where('id',$dt_id)->find();
|
|
|
if(empty($check)){
|
|
|
$this->error('不存在的动态');
|
|
|
}
|
|
|
|
|
|
+ $data['dt_id'] = $dt_id;
|
|
|
$data['user_id'] = $this->auth->id;
|
|
|
$data['to_user_id'] = $check['user_id'];
|
|
|
$data['createtime'] = time();
|
|
@@ -333,40 +351,10 @@ class Topicdongtai extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //我点赞的动态
|
|
|
- public function my_good(){
|
|
|
-
|
|
|
|
|
|
- $where = ['good.user_id'=>$this->auth->id];
|
|
|
-
|
|
|
- $field = 'dt.*,user.username,user.nickname,user.avatar,user.gender,user.birthday,user.idcard_status,user.real_status';
|
|
|
|
|
|
- $list = Db::name('topic_dongtai')->alias('dt')
|
|
|
- ->field($field)
|
|
|
- ->join('user','dt.user_id = user.id','LEFT')
|
|
|
- ->join('topic_dongtai_good good','dt.id = good.dt_id','LEFT')
|
|
|
- ->where($where)
|
|
|
- ->order('dt.id desc')->autopage()->select();
|
|
|
- $list = list_domain_image($list,['images','audio_file','avatar','video_file']);
|
|
|
|
|
|
- if(!empty($list)){
|
|
|
- foreach($list as $key => &$val){
|
|
|
|
|
|
- //用户年龄
|
|
|
- $val['age'] = birthtime_to_age($val['birthday']);
|
|
|
- unset($val['birthday']);
|
|
|
-
|
|
|
- //追加点赞
|
|
|
- $val['isgood'] = $this->is_good($val['id'],$this->auth->id);
|
|
|
-
|
|
|
- //时间
|
|
|
- $val['createtime_text'] = get_last_time($val['createtime']);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $this->success('success',$list);
|
|
|
- }
|
|
|
|
|
|
|
|
|
|