图标,及抖音支持

This commit is contained in:
Jerry Yan 2022-07-15 21:28:58 +08:00
parent 5518f3b144
commit d0e816ec6e
4 changed files with 32 additions and 1 deletions

View File

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

View File

@ -20,4 +20,19 @@ class Videos extends Model
{
return $this->hasMany(VideoDanmakus::class, "video_bvid", "bvid");
}
public function bilibili_danmakus(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->danmakus()->where("platform_id", "=", 1);
}
public function ixigua_danmakus(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->danmakus()->where("platform_id", "=", 2);
}
public function douyin_danmakus(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->danmakus()->where("platform_id", "=", 3);
}
}

View File

@ -21,6 +21,15 @@
<td class="border text-sm lg:text-current">
@if($video->danmakus_count > 0)
<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站">
@endif
@if($video->ixigua_danmakus_count > 0)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/ixigua.ico" alt="西瓜视频">
@endif
@if($video->douyin_danmakus_count > 0)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/douyin.ico" alt="抖音">
@endif
@else
{{$video->title}}
@endif

View File

@ -37,6 +37,10 @@
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/ixigua.ico" alt="西瓜视频">
<a class="underline" href="https://www.ixigua.com/home/{{$danmaku->from_mid}}/" target="_blank">{{$danmaku->from}}</a>
@break
@case(3)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/douyin.ico" alt="抖音">
{{$danmaku->from}}
@break
@default
{{$danmaku->from}}
@break