From 58f110875497f7b94f5130d5f0f57938826d9097 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Fri, 4 Jul 2025 17:28:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8B=E5=8F=8B=E5=9C=88=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=8E=A5=E5=8F=A3=E6=96=B0=E5=A2=9E=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E7=94=A8=E6=88=B7=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/enterprise/controller/Posts.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/app/enterprise/controller/Posts.php b/app/enterprise/controller/Posts.php index e102eeb..1801a55 100644 --- a/app/enterprise/controller/Posts.php +++ b/app/enterprise/controller/Posts.php @@ -612,15 +612,20 @@ class Posts extends BaseController 'delete_time' => 0, 'type' => 1 ]; - $comment = Comment::where($commentWhere)->field('content,reply_user_id,user_id')->find(); + $comment = Comment::where($commentWhere)->field('content,reply_user_id,user_id,relevance_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 ($comment) { + 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 ($comment['relevance_id']) { + $item['posts_user_id'] = PostsModel::where('id', $comment['relevance_id'])->value('user_id'); + } } } if ($item['type'] == 1) { @@ -628,9 +633,14 @@ class Posts extends BaseController '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']); + $Likes = Likes::where($likesWhere)->field('user_id,relevance_id')->find(); + if ($Likes) { + if ($Likes['user_id']) { + $item['option_user'] = $this->getFriendUserInfo($Likes['user_id']); + } + if ($Likes['relevance_id']) { + $item['posts_user_id'] = PostsModel::where('id', $Likes['relevance_id'])->value('user_id'); + } } } // 用户信息