searchbox label

This commit is contained in:
xiaomlove
2021-06-21 19:56:25 +08:00
parent ba90132f78
commit e19aaafc6c
12 changed files with 113 additions and 24 deletions
+5
View File
@@ -6,4 +6,9 @@ namespace App\Models;
class AudioCodec extends NexusModel
{
protected $table = 'audiocodecs';
public static function getLabelName()
{
return nexus_trans('searchbox.sub_category_audio_codec_label');
}
}
+5
View File
@@ -9,6 +9,11 @@ class Category extends NexusModel
protected $fillable = ['mode', 'name', 'class_name', 'image', 'sort_index', 'icon_id'];
public static function getLabelName()
{
return nexus_trans('searchbox.category_label');
}
public function icon(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Icon::class, 'icon_id');
+5
View File
@@ -6,4 +6,9 @@ namespace App\Models;
class Codec extends NexusModel
{
protected $table = 'codecs';
public static function getLabelName()
{
return nexus_trans('searchbox.sub_category_codec_label');
}
}
+5
View File
@@ -6,4 +6,9 @@ namespace App\Models;
class Media extends NexusModel
{
protected $table = 'media';
public static function getLabelName()
{
return nexus_trans('searchbox.sub_category_media_label');
}
}
+5
View File
@@ -6,4 +6,9 @@ namespace App\Models;
class Processing extends NexusModel
{
protected $table = 'processings';
public static function getLabelName()
{
return nexus_trans('searchbox.sub_category_processing_label');
}
}
+4
View File
@@ -5,4 +5,8 @@ namespace App\Models;
class Source extends NexusModel
{
public static function getLabelName()
{
return nexus_trans('searchbox.sub_category_source_label');
}
}
+4 -1
View File
@@ -5,5 +5,8 @@ namespace App\Models;
class Standard extends NexusModel
{
public static function getLabelName()
{
return nexus_trans('searchbox.sub_standard_source_label');
}
}
+4 -1
View File
@@ -5,5 +5,8 @@ namespace App\Models;
class Team extends NexusModel
{
public static function getLabelName()
{
return nexus_trans('searchbox.sub_category_team_label');
}
}
+40 -22
View File
@@ -11,6 +11,8 @@ use App\Models\Media;
use App\Models\Message;
use App\Models\Peer;
use App\Models\Processing;
use App\Models\SearchBox;
use App\Models\Setting;
use App\Models\Snatch;
use App\Models\Source;
use App\Models\Standard;
@@ -80,34 +82,50 @@ class TorrentRepository extends BaseRepository
return $torrents;
}
public function getSearchBox()
public function getSearchBox($id = null)
{
$category = Category::query()->orderBy('sort_index')->orderBy('id')->get();
$source = Source::query()->orderBy('sort_index')->orderBy('id')->get();
$media = Media::query()->orderBy('sort_index')->orderBy('id')->get();
$codec = Codec::query()->orderBy('sort_index')->orderBy('id')->get();
$standard = Standard::query()->orderBy('sort_index')->orderBy('id')->get();
$processing = Processing::query()->orderBy('sort_index')->orderBy('id')->get();
$team = Team::query()->orderBy('sort_index')->orderBy('id')->get();
$audioCodec = AudioCodec::query()->orderBy('sort_index')->orderBy('id')->get();
if (is_null($id)) {
$id = Setting::get('main.browsecat');
}
$searchBox = SearchBox::query()->findOrFail($id);
$category = $searchBox->categories()->orderBy('sort_index')->orderBy('id')->get();
$modalRows = [];
$modalRows[] = $categoryFormatted = $this->formatRow('类型', $category, 'category');
$modalRows[] = $this->formatRow('媒介', $source, 'source');
$modalRows[] = $this->formatRow('媒介', $media, 'medium');
$modalRows[] = $this->formatRow('编码', $codec, 'codec');
$modalRows[] = $this->formatRow('音频编码', $audioCodec, 'audio_codec');
$modalRows[] = $this->formatRow('分辨率', $standard, 'standard');
$modalRows[] = $this->formatRow('处理', $processing, 'processing');
$modalRows[] = $this->formatRow('制作组', $team, 'team');
$modalRows[] = $categoryFormatted = $this->formatRow(Category::getLabelName(), $category, 'category');
if ($searchBox->showsubcat) {
if ($searchBox->showsource) {
$source = Source::query()->orderBy('sort_index')->orderBy('id')->get();
$modalRows[] = $this->formatRow(Source::getLabelName(), $source, 'source');
}
if ($searchBox->showmedia) {
$media = Media::query()->orderBy('sort_index')->orderBy('id')->get();
$modalRows[] = $this->formatRow(Media::getLabelName(), $media, 'medium');
}
if ($searchBox->showcodec) {
$codec = Codec::query()->orderBy('sort_index')->orderBy('id')->get();
$modalRows[] = $this->formatRow(Codec::getLabelName(), $codec, 'codec');
}
if ($searchBox->showstandard) {
$standard = Standard::query()->orderBy('sort_index')->orderBy('id')->get();
$modalRows[] = $this->formatRow(Standard::getLabelName(), $standard, 'standard');
}
if ($searchBox->showprocessing) {
$processing = Processing::query()->orderBy('sort_index')->orderBy('id')->get();
$modalRows[] = $this->formatRow(Processing::getLabelName(), $processing, 'processing');
}
if ($searchBox->showteam) {
$team = Team::query()->orderBy('sort_index')->orderBy('id')->get();
$modalRows[] = $this->formatRow(Team::getLabelName(), $team, 'team');
}
if ($searchBox->showaudiocodec) {
$audioCodec = AudioCodec::query()->orderBy('sort_index')->orderBy('id')->get();
$modalRows[] = $this->formatRow(AudioCodec::getLabelName(), $audioCodec, 'audio_codec');
}
}
$results = [];
$categories = $categoryFormatted['rows'];
$categories[0]['active'] = 1;
$results['categories'] = $categories;
$results['modal_rows'] = $modalRows;
return $results;
}
@@ -115,7 +133,7 @@ class TorrentRepository extends BaseRepository
{
$result['header'] = $header;
$result['rows'][] = [
'label' => '全部',
'label' => 'All',
'value' => 0,
'name' => $name,
'active' => 1,
+12
View File
@@ -0,0 +1,12 @@
<?php
return [
'category_label' => 'Category',
'sub_category_source_label' => 'Source',
'sub_category_media_label' => 'Media',
'sub_category_standard_label' => 'Standard',
'sub_category_team_label' => 'Team',
'sub_category_processing_label' => 'Processing',
'sub_category_codec_label' => 'Codec',
'sub_category_audio_codec_label' => 'AudioCodec',
];
+12
View File
@@ -0,0 +1,12 @@
<?php
return [
'category_label' => '分类',
'sub_category_source_label' => '来源',
'sub_category_media_label' => '媒介',
'sub_category_standard_label' => '分辨率',
'sub_category_team_label' => '制作组',
'sub_category_processing_label' => '处理',
'sub_category_codec_label' => '编码',
'sub_category_audio_codec_label' => '音频编码',
];
+12
View File
@@ -0,0 +1,12 @@
<?php
return [
'category_label' => '分類',
'sub_category_source_label' => '來源',
'sub_category_media_label' => '媒介',
'sub_category_standard_label' => '分辨率',
'sub_category_team_label' => '製作組',
'sub_category_processing_label' => '處理',
'sub_category_codec_label' => '編碼',
'sub_category_audio_codec_label' => '音頻編碼',
];