弹幕查询修改

This commit is contained in:
Jerry Yan 2022-12-15 21:58:46 +08:00
parent 4fa7d45e95
commit 516fb71b52
5 changed files with 54 additions and 48 deletions

View File

@ -13,7 +13,7 @@ class DanmakuQueryController extends BaseController
public function index() public function index()
{ {
$video_list = Videos::query() $video_list = Videos::query()
->withCount("danmakus", "bilibili_danmakus", "ixigua_danmakus", "douyin_danmakus") ->withCount("danmakus", "bilibili_danmakus", "ixigua_danmakus", "douyin_danmakus", "programs")
->orderByDesc("created_at") ->orderByDesc("created_at")
->paginate(10)->withQueryString(); ->paginate(10)->withQueryString();
return view("danmaku.index", [ return view("danmaku.index", [

View File

@ -1,9 +1,9 @@
<footer class="bg-white dark:bg-gray-800 pt-4 pb-8 xl:pt-8"> <footer class="mt-4 bg-gray-100 dark:bg-gray-800 pb-8 xl:pt-8">
<div class="max-w-screen-lg px-4 mx-auto text-gray-400 xl:max-w-screen-xl sm:px-6 md:px-8 dark:text-gray-300"> <div class="max-w-screen-lg px-4 mx-auto text-gray-400 xl:max-w-screen-xl sm:px-6 md:px-8 dark:text-gray-300">
<ul class="flex flex-wrap justify-center pb-8 text-lg font-light"> <ul class="flex flex-wrap justify-center pb-8 text-lg font-light">
<li class="w-1/2 md:w-1/4"> <li class="w-1/2 md:w-1/4">
<div class="text-center"> <div class="text-center">
<h2 class="text-gray-500 dark:text-gray-200 text-md mb-4"> <h2 class="text-gray-500 dark:text-gray-200 text-md my-4">
永恒de草薙 永恒de草薙
</h2> </h2>
<ul> <ul>
@ -18,7 +18,7 @@
</li> </li>
<li class="w-1/2 md:w-1/4"> <li class="w-1/2 md:w-1/4">
<div class="text-center"> <div class="text-center">
<h2 class="text-gray-500 dark:text-gray-200 text-md mb-4"> <h2 class="text-gray-500 dark:text-gray-200 text-md my-4">
课代表们 课代表们
</h2> </h2>
<ul> <ul>
@ -33,7 +33,7 @@
</li> </li>
<li class="w-1/2 md:w-1/4"> <li class="w-1/2 md:w-1/4">
<div class="text-center"> <div class="text-center">
<h2 class="text-gray-500 dark:text-gray-200 text-md mb-4"> <h2 class="text-gray-500 dark:text-gray-200 text-md my-4">
录播文件 录播文件
</h2> </h2>
<ul> <ul>
@ -54,7 +54,7 @@
</li> </li>
<li class="w-1/2 md:w-1/4"> <li class="w-1/2 md:w-1/4">
<div class="text-center"> <div class="text-center">
<h2 class="text-gray-500 dark:text-gray-200 text-md mb-4"> <h2 class="text-gray-500 dark:text-gray-200 text-md my-4">
杂项 杂项
</h2> </h2>
<ul> <ul>

View File

@ -18,7 +18,7 @@
<div class="hidden sm:ml-6 md:block"> <div class="hidden sm:ml-6 md:block">
<div class="flex space-x-4"> <div class="flex space-x-4">
<a class="{{ (request()->is('comments', 'video/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} px-3 py-2 rounded-md text-sm font-medium" href="/comments">节目单查询</a> <a class="{{ (request()->is('comments', 'video/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} px-3 py-2 rounded-md text-sm font-medium" href="/comments">节目单查询</a>
<a class="{{ (request()->is('danmakus', 'danmakus/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} px-3 py-2 rounded-md text-sm font-medium" href="/danmakus">直播弹幕查询</a> <a class="{{ (request()->is('danmakus', 'danmakus/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} px-3 py-2 rounded-md text-sm font-medium" href="/danmakus">稿件查询</a>
<a class="{{ (request()->is('programs', '/', 'programs/*/video')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} px-3 py-2 rounded-md text-sm font-medium" href="/programs" title="数据不全,待补充">节目查询</a> <a class="{{ (request()->is('programs', '/', 'programs/*/video')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} px-3 py-2 rounded-md text-sm font-medium" href="/programs" title="数据不全,待补充">节目查询</a>
@auth("web") @auth("web")
<a class="{{ (request()->is('programs/construct', 'programs/construct/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} px-3 py-2 rounded-md text-sm font-medium" href="/programs/construct">节目建设</a> <a class="{{ (request()->is('programs/construct', 'programs/construct/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} px-3 py-2 rounded-md text-sm font-medium" href="/programs/construct">节目建设</a>
@ -47,7 +47,7 @@
<div class="md:hidden" id="_mobile_menu" style="display: none"> <div class="md:hidden" id="_mobile_menu" style="display: none">
<div class="space-y-1 px-2 pt-2 pb-3"> <div class="space-y-1 px-2 pt-2 pb-3">
<a class="{{ (request()->is('comments', 'video/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} block px-3 py-2 rounded-md text-base font-medium" href="/comments">节目单查询</a> <a class="{{ (request()->is('comments', 'video/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} block px-3 py-2 rounded-md text-base font-medium" href="/comments">节目单查询</a>
<a class="{{ (request()->is('danmakus', 'danmakus/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} block px-3 py-2 rounded-md text-base font-medium" href="/danmakus">直播弹幕查询</a> <a class="{{ (request()->is('danmakus', 'danmakus/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} block px-3 py-2 rounded-md text-base font-medium" href="/danmakus">稿件查询</a>
<a class="{{ (request()->is('programs', '/', 'programs/*/video')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} block px-3 py-2 rounded-md text-base font-medium" href="/programs" title="数据不全,待补充">节目查询</a> <a class="{{ (request()->is('programs', '/', 'programs/*/video')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} block px-3 py-2 rounded-md text-base font-medium" href="/programs" title="数据不全,待补充">节目查询</a>
@auth("web") @auth("web")
<a class="{{ (request()->is('programs/construct', 'programs/construct/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} block px-3 py-2 rounded-md text-base font-medium" href="/programs/construct">节目建设</a> <a class="{{ (request()->is('programs/construct', 'programs/construct/*')) ? 'bg-gray-900 text-white' : 'text-gray-700 hover:bg-gray-700 hover:text-white' }} block px-3 py-2 rounded-md text-base font-medium" href="/programs/construct">节目建设</a>

View File

@ -1,51 +1,57 @@
<html lang="zh"> <html lang="zh">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>录播弹幕查询</title> <title>稿件查询</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="{{ mix('/css/app.css') }}" rel="stylesheet"/> <link href="{{ mix('/css/app.css') }}" rel="stylesheet"/>
</head> </head>
<body> <body>
@include("common.header") @include("common.header")
<table class="table-auto border-collapse w-full lg:border lg:border-black"> @foreach($video_list as $video)
<thead> <div class="max-w xl:max-w-5xl lg:max-w-2xl md:max-w-lg mx-2 md:mx-auto px-2 md:px-4 py-4 bg-white border border-gray-200 rounded-lg shadow-md my-4 dark:bg-gray-800">
<tr class="border border-black sticky bg-white lg:static top-0 left-0 right-0"> <div>
<th class="border border-black">视频标题</th> <a href="/video/{{$video->id}}" class="text-2xl font-bold text-gray-700 dark:text-white hover:text-gray-600 dark:hover:text-gray-200 hover:underline" tabindex="0" role="link">{{$video->title}}</a>
<th class="border border-black">弹幕条数</th> <div class="px-2 md:px-4 lg:px-8 mt-2 flex items-center justify-between">
<th class="border border-black hidden lg:table-cell">操作</th> <span class="text-sm font-light text-gray-600 dark:text-gray-400 hidden md:block">投稿时间:{{$video->created_at}}</span>
</tr> </div>
</thead> <p class="px-2 md:px-4 lg:px-8 mt-2 text-gray-600 dark:text-gray-300">视频时长:{{$video->total_duration}}</p>
<tbody> @if($video->danmakus_count > 0)
@foreach($video_list as $video) <p class="px-2 md:px-4 lg:px-8 mt-2 text-gray-600 dark:text-gray-300">
<tr> 弹幕数量:{{$video->danmakus_count}}
<td class="border text-sm lg:text-current"> @if($video->bilibili_danmakus_count > 0)
@if($video->danmakus_count > 0) <img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/bilibili.ico" alt="B站" title="包含B站直播弹幕">
<a class="text-blue-600 lg:text-current underline lg:no-underline break-all" href="/danmakus/{{$video->bvid}}">{{$video->title}}</a>
@if($video->bilibili_danmakus_count > 0)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/bilibili.ico" alt="B站" title="包含B站直播弹幕">
@endif
@if($video->ixigua_danmakus_count > 0)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/ixigua.ico" alt="西瓜视频" title="包含西瓜视频直播弹幕">
@endif
@if($video->douyin_danmakus_count > 0)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/douyin.ico" alt="抖音" title="包含抖音直播弹幕">
@endif
@else
{{$video->title}}
@endif @endif
</td> @if($video->ixigua_danmakus_count > 0)
<td class="border">{{$video->danmakus_count}}</td> <img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/ixigua.ico" alt="西瓜视频" title="包含西瓜视频直播弹幕">
<td class="border hidden lg:table-cell">
@if($video->danmakus_count > 0)
<a class="text-blue-600 underline" href="/danmakus/{{$video->bvid}}">详情</a>
@else
无弹幕
@endif @endif
</td> @if($video->douyin_danmakus_count > 0)
</tr> <img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/douyin.ico" alt="抖音" title="包含抖音直播弹幕">
@endforeach @endif
</tbody> </p>
</table> @endif
@if($video->programs_count > 0)
<p class="px-2 md:px-4 lg:px-8 mt-2 text-gray-600 dark:text-gray-300">节目数量:{{$video->programs_count}}</p>
@endif
</div>
<div class="flex items-center gap-4 mt-4">
<a href="https://www.bilibili.com/video/{{$video->bvid}}" target="_blank" class="inline-flex text-blue-600 dark:text-blue-400 hover:underline" tabindex="0" role="link">
去B站浏览
<svg class="w-5 h-5 ml-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"></path><path d="M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"></path></svg>
</a>
@if($video->danmakus_count > 0)
<a href="/danmakus/{{$video->bvid}}" class="inline-flex text-blue-600 dark:text-blue-400 hover:underline" tabindex="0" role="link">
直播弹幕明细
</a>
@endif
@if($video->programs_count > 0)
<a href="/video/{{$video->id}}" class="inline-flex text-blue-600 dark:text-blue-400 hover:underline" tabindex="0" role="link">
节目列表
</a>
@endif
</div>
</div>
@endforeach
{{$video_list->links()}} {{$video_list->links()}}
@include("common.footer") @include("common.footer")
</body> </body>

View File

@ -13,7 +13,7 @@
<input class="border border-black" type="submit"> <input class="border border-black" type="submit">
</form> </form>
@foreach($comments as $comment) @foreach($comments as $comment)
<div class="max-w xl:max-w-5xl lg:max-w-2xl md:max-w-lg mx-2 md:mx-auto px-1 sm:px-2 md:px-4 py-4 bg-white border border-gray-200 rounded-lg shadow-md my-4 dark:bg-gray-800"> <div class="max-w xl:max-w-5xl lg:max-w-2xl md:max-w-lg mx-2 md:mx-auto px-2 md:px-4 py-4 bg-white border border-gray-200 rounded-lg shadow-md my-4 dark:bg-gray-800">
<div> <div>
<a href="/video/{{$comment->video->id}}" class="text-2xl font-bold text-gray-700 dark:text-white hover:text-gray-600 dark:hover:text-gray-200 hover:underline" tabindex="0" role="link">{{$comment->video->title}}</a> <a href="/video/{{$comment->video->id}}" class="text-2xl font-bold text-gray-700 dark:text-white hover:text-gray-600 dark:hover:text-gray-200 hover:underline" tabindex="0" role="link">{{$comment->video->title}}</a>
<div class="px-2 md:px-4 lg:px-8 mt-2 flex items-center justify-between"> <div class="px-2 md:px-4 lg:px-8 mt-2 flex items-center justify-between">
@ -25,7 +25,7 @@
<div class="flex items-center justify-between mt-4"> <div class="flex items-center justify-between mt-4">
<a href="https://space.bilibili.com/{{$comment->mid}}" target="_blank" class="inline-flex text-blue-600 dark:text-blue-400 hover:underline" tabindex="0" role="link"> <a href="https://www.bilibili.com/video/{{$comment->video->bvid}}" target="_blank" class="inline-flex text-blue-600 dark:text-blue-400 hover:underline" tabindex="0" role="link">
去B站浏览 去B站浏览
<svg class="w-5 h-5 ml-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"></path><path d="M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"></path></svg> <svg class="w-5 h-5 ml-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"></path><path d="M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"></path></svg>
</a> </a>