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'); + } } } // 用户信息