diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index c813ded..b2a53c8 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -79,6 +79,38 @@ class HomeController extends Controller { return view('pages.site.video.videotable', ['res' => $res, 'menu' => $this->menu, 'user' => $this->user]); } + public function videoPlay ($vid) { + $res = DB::table('vid_video')->where('vid', $vid)->first(); + $game = DB::table('vid_game')->where('id', $res->game_id)->first(); + + $res->gametitle = explode('】', $res->title); + $res->title = $res->gametitle[1]; + $res->gametitle = $res->gametitle[0]; + $res->gametitle = str_replace('【'.$game->name, '', $res->gametitle); + $res->mgametitle = $game->name; + $res->slug = $game->slug; + + if ($res->gametitle == '') $res->gametitle = '初代'; + + $comments = DB::table('blg_comments')->where('video_id', $res->slug)->orderBy('id', 'asc')->get()->toArray(); + + foreach ($comments as $k => $c) { + if ($c->isShadow == 0) { + if ($this->objSite->getIp() != $c->ipaddress) unset($comments[$k]); + } + else { + unset($c->email); + unset($c->ipaddress); + unset($c->isShadow); + $c->created = date('Y年m月d日 H:i:s', $c->created); + } + } + + $res->comments = $comments; + + return view('pages.site.video.prayer', ['res' => $res, 'menu' => $this->menu, 'user' => $this->user]); + } + public function addContent (Request $r) { if ($this->user && ($this->user['blg_addpost'] || $this->user['blg_addpage'])) { $bdl = array(); diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index b450163..805de6a 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -152,7 +152,7 @@ class SiteController extends Controller { public function newComment (Request $r) { $com = $r->comment; - $id = DB::table('blg_content')->select('id')->where('slug', $r->slug)->first()->id; + if ($r->isvideo == 'f') $id = DB::table('blg_content')->select('id')->where('slug', $r->slug)->first()->id; $shadow = DB::table('blg_blacklist')->where('ipaddress', $this->getIp())->first(); if ($shadow && !$shadow->isShadow) return array('status' => '0101FF', 'message' => '失礼しますが、あなたはBANされていましたので、コメントを保存できません。'); @@ -160,7 +160,8 @@ class SiteController extends Controller { $add = DB::table('blg_comments') ->insertGetId([ - 'post_id' => $id, + 'post_id' => ($r->isvideo == 'f' ? $id : 0), + 'video_id' => ($r->isvideo == 't' ? $r->slug : ''), 'name' => $com['name'], 'email' => $com['mail'], 'message' => $com['text'], diff --git a/resources/js/components/comments.vue b/resources/js/components/comments.vue index 8e4e62d..8046f08 100644 --- a/resources/js/components/comments.vue +++ b/resources/js/components/comments.vue @@ -47,7 +47,7 @@