diff --git a/app/enterprise/controller/Posts.php b/app/enterprise/controller/Posts.php index 5c3f987..7a23e92 100644 --- a/app/enterprise/controller/Posts.php +++ b/app/enterprise/controller/Posts.php @@ -446,7 +446,6 @@ class Posts extends BaseController if ($reply_user_id != $this->uid) { PostsNotice::optionNotice($posts_id, $id, $reply_user_id); // 向作者好友推送新的消息 - $this->wsSendMsg($this->uid, $id, 'postsLikes'); $this->wsSendMsg($reply_user_id, 0, 'postsNotice'); } @@ -525,7 +524,6 @@ class Posts extends BaseController } if ($reply_user_id != $this->uid) { PostsNotice::optionNotice($posts_id, $id, $reply_user_id, 2); - $this->wsSendMsg($this->uid, $id); $this->wsSendMsg($reply_user_id, 0, 'postsNotice'); } return success(lang('system.success')); @@ -570,7 +568,7 @@ class Posts extends BaseController ['user_id', '=', $this->uid] ]; $field = '*'; - $order = 'create_time desc'; + $order = 'is_read asc'; $list = $this->paginate($model->where($where)->field($field)->order($order)); $data = []; @@ -598,10 +596,37 @@ class Posts extends BaseController if (!$item['is_read']) { PostsNotice::read($item['id']); } + if ($item['type'] == 2) { + $commentWhere = [ + 'id' => $item['relevance_id'], + 'delete_time' => 0, + 'type' => 1 + ]; + $comment = Comment::where($commentWhere)->field('content,reply_user_id,user_id')->find(); + $item['content'] = $comment['content'] ?? lang('posts.comment_del'); + $item['reply_user'] = []; + $item['option_user'] = []; + if ($comment['reply_user_id']) { + $item['reply_user'] = $this->getFriendUserInfo($comment['reply_user_id']); + } + if ($comment['user_id']) { + $item['option_user'] = $this->getFriendUserInfo($comment['user_id']); + } + } + if ($item['type'] == 1) { + $likesWhere = [ + 'id' => $item['relevance_id'], + 'type' => 1 + ]; + $Likes = Likes::where($likesWhere)->field('user_id')->find(); + if ($Likes['user_id']) { + $item['option_user'] = $this->getFriendUserInfo($Likes['user_id']); + } + } // 用户信息 $item['user'] = $this->getFriendUserInfo($item['user_id']); // 评论回复 - unset($item['is_read']); + //unset($item['is_read']); } } return success('', $data,$list->total(),$list->currentPage()); diff --git a/app/lang/en_us.php b/app/lang/en_us.php index e3d4656..a831e16 100644 --- a/app/lang/en_us.php +++ b/app/lang/en_us.php @@ -165,6 +165,7 @@ return [ 'user_empty' => 'Restricting users to not be empty', 'success_like' => 'Liked successfully', 'cancel_like' => 'Cancel likes', - 'img_max_length' => 'Up to 9 images can be uploaded' + 'img_max_length' => 'Up to 9 images can be uploaded', + 'comment_del' => 'This comment has been deleted' ] ]; \ No newline at end of file diff --git a/app/lang/zh_cn.php b/app/lang/zh_cn.php index 4f7140a..f143738 100644 --- a/app/lang/zh_cn.php +++ b/app/lang/zh_cn.php @@ -164,6 +164,7 @@ return [ 'user_empty' => '限制用户不能为空', 'success_like' => '点赞成功', 'cancel_like' => '取消点赞', - 'img_max_length' => '图片最多上传9张' + 'img_max_length' => '图片最多上传9张', + 'comment_del' => '此条评论已被删除' ] ]; \ No newline at end of file