图标,及抖音支持
This commit is contained in:
parent
5518f3b144
commit
d0e816ec6e
@ -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,
|
||||
]);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user