From 47f9f76da1763768cef7a1da599e9f236c138b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Tue, 29 Dec 2020 22:01:06 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=81=AE?= =?UTF-8?q?=E8=BF=94=E4=BA=8B=EF=BC=88=E3=82=88=E3=81=86=E3=81=A4=E3=81=B9?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Video/Prayer.php | 15 ++++++++++++++- resources/js/components/comments.vue | 27 +++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Video/Prayer.php b/app/Http/Controllers/Video/Prayer.php index 576e39a..508461b 100644 --- a/app/Http/Controllers/Video/Prayer.php +++ b/app/Http/Controllers/Video/Prayer.php @@ -88,7 +88,20 @@ class Prayer { $g->comment->channel = $g->snippet->topLevelComment->snippet->authorChannelUrl; $g->comment->icon = $g->snippet->topLevelComment->snippet->authorProfileImageUrl; $g->comment->created = date('Y年m月d日 H:i:s', strtotime($g->snippet->topLevelComment->snippet->publishedAt)); - $g->comment->message = $g->snippet->topLevelComment->snippet->textDisplay; + $g->comment->message = strip_tags($g->snippet->topLevelComment->snippet->textDisplay, array('
')); + $g->comment->replyCount = (isset($g->snippet->totalReplyCount) ? $g->snippet->totalReplyCount : 0); + + if (isset($g->replies)) { + $g->comment->replies = array(); + foreach ($g->replies->comments as $k => $c) { + $g->comment->replies[$k]['id'] = $c->id; + $g->comment->replies[$k]['name'] = $c->snippet->authorDisplayName; + $g->comment->replies[$k]['channel'] = $c->snippet->authorChannelUrl; + $g->comment->replies[$k]['icon'] = $c->snippet->authorProfileImageUrl; + $g->comment->replies[$k]['created'] = date('Y年m月d日 H:i:s', strtotime($c->snippet->publishedAt)); + $g->comment->replies[$k]['message'] = strip_tags($c->snippet->textDisplay, array('
')); + } + } $come[] = $g->comment; } diff --git a/resources/js/components/comments.vue b/resources/js/components/comments.vue index 39e3989..2f75599 100644 --- a/resources/js/components/comments.vue +++ b/resources/js/components/comments.vue @@ -20,10 +20,33 @@ より: {{ c.created }} -

{{ c.message }}

-
返信
+

+
返信({{ c.replyCount }})
+ + +