|
@@ -204,13 +204,14 @@ class FeedRepositories
|
|
|
if ($followStatus) {
|
|
|
$isFollow = $followStatus;
|
|
|
}
|
|
|
+ $user = $this->userInfo($post['uid']);
|
|
|
return [
|
|
|
'id' => $post['id'],
|
|
|
'type' => $post['type'],
|
|
|
'created_at' => Carbon::parse($post['created_at'])->diffForHumans(),
|
|
|
'uid' => $post['uid'],
|
|
|
- 'username' => $post['username'],
|
|
|
- 'avatar' => $post['avatar'],
|
|
|
+ 'username' => $user['username'],
|
|
|
+ 'avatar' => $user['avatar'],
|
|
|
'topic' => $topic,
|
|
|
'title' => $post['title'],
|
|
|
'content' => $post['content'],
|
|
@@ -235,12 +236,14 @@ class FeedRepositories
|
|
|
|
|
|
public function getPostComment($post_id)
|
|
|
{
|
|
|
- $comments = $this->postComment->where(['post_id' => $post_id, 'parent_id' => 0])->select('id', 'uid', 'username', 'content', 'is_delete')->orderBy('is_delete', 'asc')->orderBy('id', 'desc')->take(2)->get();
|
|
|
+ $comments = $this->postComment->where(['post_id' => $post_id, 'parent_id' => 0])->select('id', 'uid', 'content', 'is_delete')->orderBy('is_delete', 'asc')->orderBy('id', 'desc')->take(2)->get();
|
|
|
foreach ($comments as &$comment) {
|
|
|
if ($comment->is_delete) {
|
|
|
$comment->content = '该评论已被删除';
|
|
|
}
|
|
|
unset($comment->is_delete);
|
|
|
+ $user = $this->userInfo($comment->uid);
|
|
|
+ $comment->username = $user['username'];
|
|
|
}
|
|
|
return $comments;
|
|
|
}
|