开放节目搜索功能,弹幕的title修改

This commit is contained in:
Jerry Yan 2022-07-30 17:25:14 +08:00
parent 33af2c5713
commit b7ce725160
6 changed files with 26 additions and 15 deletions

View File

@ -9,10 +9,9 @@ use Illuminate\Routing\Controller as BaseController;
class ProgramConstructController extends BaseController class ProgramConstructController extends BaseController
{ {
public function construct(Request $request) { public function construct(Request $request) {
$keyword = $request->get("keyword", ""); $status = $request->get("status", "0");
$programs = Programs::query()->with(["appends", "video_pivots.video"])->where("status", "=", 0)->limit(15)->orderByDesc("created_at")->get(); $programs = Programs::query()->with(["appends", "video_pivots.video"])->where("status", $status, 0)->limit(15)->orderByDesc("created_at")->get();
return view("program.construct.index", [ return view("program.construct.index", [
"keyword" => $keyword,
"programs"=>$programs, "programs"=>$programs,
]); ]);
} }

View File

@ -10,9 +10,21 @@ class ProgramQueryController extends BaseController
{ {
public function index(Request $request) { public function index(Request $request) {
$keyword = $request->get("keyword", ""); $keyword = $request->get("keyword", "");
$programs = Programs::query()->with(["appends", "video_pivots.video"]) $query = Programs::query()->with(["appends", "video_pivots.video"])->where("status", "=", 1)->orderByDesc("created_at");
->where("status", "=", 1)->limit(15)->orderByDesc("created_at") if ($keyword) {
->paginate(10)->withQueryString(); $keyword_split = explode(" ", $keyword);
foreach ($keyword_split as $_keyword) {
if (mb_strlen(trim($_keyword)) > 0) {
$query->where(function ($_query) use ($_keyword) {
$_query
->where("name", "like", "%{$_keyword}%", "or")
->where("difficulty", "like", "%{$_keyword}%", "or")
->where("desc", "like", "%${_keyword}%", "or");
});
}
}
}
$programs = $query->paginate(10)->withQueryString();
return view("program.index", [ return view("program.index", [
"keyword" => $keyword, "keyword" => $keyword,
"programs"=>$programs, "programs"=>$programs,

View File

@ -5,6 +5,6 @@
导航: 导航:
<a class="text-blue-600 underline" href="/">节目单查询</a> <a class="text-blue-600 underline" href="/">节目单查询</a>
<a class="text-blue-600 underline" href="/danmakus">直播弹幕查询</a> <a class="text-blue-600 underline" href="/danmakus">直播弹幕查询</a>
<a class="text-gray-50" href="/programs" style="color: gray" title="数据不全,待补充">节目查询</a> <a class="text-blue-600 underline" href="/programs" title="数据不全,待补充">节目查询</a>
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
<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>

View File

@ -1,7 +1,7 @@
<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>

View File

@ -7,12 +7,12 @@
</head> </head>
<body> <body>
@include("common.header") @include("common.header")
<h3>搜索功能待开放,数据待补充完整</h3> <div class="font-bold">数据待补充完整</div>
<!--<form action=""> <form class="form" action="">
<label for="keyword">查找节目关键词,空格隔开查找多个关键词</label> <label for="keyword">查找节目关键词,空格隔开查找多个关键词,暂不支持通过点播老板搜索</label>
<input type="text" name="keyword" id="keyword" value="{{$keyword}}"> <input class="border border-black" type="text" name="keyword" id="keyword" value="{{$keyword}}">
<input type="submit"> <input class="border border-black" type="submit">
</form>--> </form>
<table class="table-auto border-collapse w-full lg:border lg:border-black"> <table class="table-auto border-collapse w-full lg:border lg:border-black">
<thead> <thead>
<tr class="border border-black sticky bg-white lg:static top-0 left-0 right-0"> <tr class="border border-black sticky bg-white lg:static top-0 left-0 right-0">