From 803927703f6e4a1db6ff3b84d9d637a5bd1f1d96 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Mon, 30 Jun 2025 11:30:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8B=E5=8F=8B=E5=9C=88=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8F=90=E9=86=92=E5=88=97=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/enterprise/controller/Posts.php | 33 +++++++++++++++++++++++++---- app/lang/en_us.php | 3 ++- app/lang/zh_cn.php | 3 ++- 3 files changed, 33 insertions(+), 6 deletions(-) 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