video tag

This commit is contained in:
Default
2025-04-28 18:36:49 +08:00
parent 2958d293d1
commit e452b5ff8b
11 changed files with 352 additions and 263 deletions

View File

@@ -414,7 +414,7 @@ EOT;
$strParse = <<<EOT
<?php
\$arrCategory = \\app\\services\\StaticConfig::getCategoryFilter( {$n_sex});
\$arrCategory = \\app\\services\\StaticConfig::getNovelCategoryFilter( {$n_sex});
if (!empty(\$arrCategory) && is_array(\$arrCategory)):

View File

@@ -7,17 +7,16 @@ use think\template\TagLib;
class Video extends TagLib
{
protected $tags = [
'list' => ['attr' => 'count,n_category,sort_type,n_status,n_sex,diff_key,cache_life,d_key,d_val', 'close' => 1],
'pager' => ['attr' => 'page,limit,n_category,sort_type,n_status,n_sex,key,diff_key,cache_life,d_key,d_val,p_val,func,export_name', 'close' => 1],
'pagerexp' => ['attr' => 'page,limit,n_category,sort_type,n_status,n_sex,key,diff_key,cache_life,d_key,d_val,p_val,func,export_name', 'close' => 0],
'info' => ['attr' => 'n_id,n_forge_id,n_key', 'close' => 0],
'list' => ['attr' => 'count,v_category,sort_type,v_status,v_sex,diff_key,cache_life,d_key,d_val', 'close' => 1],
'pager' => ['attr' => 'page,limit,v_category,sort_type,v_status,v_sex,key,diff_key,cache_life,d_key,d_val,p_val,func,export_name', 'close' => 1],
'pagerexp' => ['attr' => 'page,limit,v_category,sort_type,v_status,v_sex,key,diff_key,cache_life,d_key,d_val,p_val,func,export_name', 'close' => 0],
'info' => ['attr' => 'v_id,v_forge_id,v_key', 'close' => 0],
'sort' => ['attr' => 'd_key,d_val'],
'ranksort' => ['attr' => 'd_key,d_val'],
'status' => ['attr' => 'd_key,d_val'],
'sex' => ['attr' => 'd_key,d_val'],
'category' => ['attr' => 'd_key,d_val,n_sex'],
'category' => ['attr' => 'd_key,d_val,v_sex'],
'ranklist' => ['attr' => 'count,sort_type,n_status,n_sex,diff_key,cache_life,d_key,d_val', 'close' => 1],
'ranklist' => ['attr' => 'count,sort_type,v_status,v_sex,diff_key,cache_life,d_key,d_val', 'close' => 1],
];
private function customBuildVar($mixedArgs)
@@ -29,8 +28,6 @@ class Video extends TagLib
}
}
/**
* tagRankList
*
@@ -42,8 +39,7 @@ class Video extends TagLib
{
$count = $tag['count'] ?? '10';
$sort_type = $tag['sort_type'] ?? "";
$n_status = $tag['n_status'] ?? "all";
$n_sex = $tag['n_sex'] ?? "all";
$v_status = $tag['v_status'] ?? "all";
$diff_key = $tag['diff_key'] ?? "";
$cache_life = $tag['cache_life'] ?? '0';
@@ -51,8 +47,8 @@ class Video extends TagLib
$d_val = $tag['d_val'] ?? 'd_val';
$sort_type = $this->customBuildVar($sort_type);
$n_status = $this->customBuildVar($n_status);
$n_sex = $this->customBuildVar($n_sex);
$v_status = $this->customBuildVar($v_status);
$diff_key = $this->customBuildVar($diff_key);
$cache_life = $this->customBuildVar($cache_life);
@@ -63,8 +59,7 @@ class Video extends TagLib
\${$arrDataName} = app(\\app\\services\\VideoService::class)->getRankList([
'count' => {$count},
'sort_type' => {$sort_type},
'n_status' => {$n_status},
'n_sex' => {$n_sex},
'v_status' => {$v_status},
'diff_key' => {$diff_key},
'cache_life' => {$cache_life}
]);
@@ -108,11 +103,10 @@ EOT;
{
$page = $tag['page'] ?? '0';
$limit = $tag['limit'] ?? '10';
$button_num = $tag['button_num'] ?? '10';
$n_category = $tag['n_category'] ?? "all";
$buttov_num = $tag['buttov_num'] ?? '10';
$v_category = $tag['v_category'] ?? "all";
$sort_type = $tag['sort_type'] ?? "";
$n_status = $tag['n_status'] ?? "";
$n_sex = $tag['n_sex'] ?? "";
$v_status = $tag['v_status'] ?? "";
$key = $tag['key'] ?? "";
$diff_key = $tag['diff_key'] ?? "";
$cache_life = $tag['cache_life'] ?? '0';
@@ -126,11 +120,11 @@ EOT;
$page = $this->customBuildVar($page);
$limit = $this->customBuildVar($limit);
$button_num = $this->customBuildVar($button_num);
$n_category = $this->customBuildVar($n_category);
$buttov_num = $this->customBuildVar($buttov_num);
$v_category = $this->customBuildVar($v_category);
$sort_type = $this->customBuildVar($sort_type);
$n_status = $this->customBuildVar($n_status);
$n_sex = $this->customBuildVar($n_sex);
$v_status = $this->customBuildVar($v_status);
$key = $this->customBuildVar($key);
$diff_key = $this->customBuildVar($diff_key);
$cache_life = $this->customBuildVar($cache_life);
@@ -143,11 +137,10 @@ EOT;
\${$arrDataName} = app(\\app\\services\\VideoService::class)->getVideoPager([
'page' => {$page},
'limit' => {$limit},
'button_num' => {$button_num},
'n_category' => {$n_category},
'buttov_num' => {$buttov_num},
'v_category' => {$v_category},
'sort_type' => {$sort_type},
'n_status' => {$n_status},
'n_sex' => {$n_sex},
'v_status' => {$v_status},
'key' => {$key},
'diff_key' => {$diff_key},
'cache_life' => {$cache_life},
@@ -186,20 +179,18 @@ EOT;
public function tagList($tag, $content)
{
$count = $tag['count'] ?? '10';
$n_category = $tag['n_category'] ?? "all";
$v_category = $tag['v_category'] ?? "all";
$sort_type = $tag['sort_type'] ?? "";
$n_status = $tag['n_status'] ?? "all";
$n_sex = $tag['n_sex'] ?? "all";
$v_status = $tag['v_status'] ?? "all";
$diff_key = $tag['diff_key'] ?? "";
$cache_life = $tag['cache_life'] ?? '0';
$d_key = $tag['d_key'] ?? 'd_key';
$d_val = $tag['d_val'] ?? 'd_val';
$n_category = $this->customBuildVar($n_category);
$v_category = $this->customBuildVar($v_category);
$sort_type = $this->customBuildVar($sort_type);
$n_status = $this->customBuildVar($n_status);
$n_sex = $this->customBuildVar($n_sex);
$v_status = $this->customBuildVar($v_status);
$diff_key = $this->customBuildVar($diff_key);
$cache_life = $this->customBuildVar($cache_life);
@@ -209,10 +200,9 @@ EOT;
<?php
\${$arrDataName} = app(\\app\\services\\VideoService::class)->getVideoList([
'count' => {$count},
'n_category' => {$n_category},
'v_category' => {$v_category},
'sort_type' => {$sort_type},
'n_status' => {$n_status},
'n_sex' => {$n_sex},
'v_status' => {$v_status},
'diff_key' => {$diff_key},
'cache_life' => {$cache_life}
]);
@@ -232,12 +222,8 @@ EOT;
return $strParse;
}
/**
* 获取小说详情
* 获取视频详情
*
* @param array $tag
* @param string $content
@@ -245,22 +231,21 @@ EOT;
*/
public function tagInfo($tag)
{
$n_id = $tag['n_id'] ?? '0';
$n_forge_id = isset($tag['n_forge_id']) ? $tag['n_forge_id'] : 0;
$v_id = $tag['v_id'] ?? '0';
$n_key = $tag['n_key'] ?? 'arrVideo';
$v_key = $tag['v_key'] ?? 'arrVideo';
$v_id = $this->customBuildVar($v_id);
$arrDataName = randomString(5);
$n_id = $this->customBuildVar($n_id);
$n_forge_id = $this->customBuildVar($n_forge_id);
$strParse = <<<EOT
<?php
\$novelData = app(\\app\\services\\VideoService::class)->getVideoByNId(
{$n_id},
{$n_forge_id}
\${$arrDataName} = app(\\app\\services\\VideoService::class)->getVideoByVId(
{$v_id}
);
\${$n_key} = \$novelData ?? [];
\${$v_key} = \${$arrDataName} ?? [];
?>
EOT;
@@ -363,39 +348,6 @@ EOT;
return $strParse;
}
/**
* 获取状态筛选参数
*
* @param array $tag
* @param string $content
* @return string
*/
public function tagSex($tag, $content)
{
$d_key = $tag['d_key'] ?? 'd_key';
$d_val = $tag['d_val'] ?? 'd_val';
$strParse = <<<EOT
<?php
\$arrSex = app(\\app\\services\\StaticConfig::class)::\$arrVideoSex;
if (!empty(\$arrSex) && is_array(\$arrSex)):
?>
EOT;
$strParse .= <<<EOT
<?php foreach (\$arrSex as \${$d_key} => \${$d_val}): ?>
EOT;
$strParse .= $content;
$strParse .= <<<EOT
<?php endforeach; ?>
<?php endif; ?>
EOT;
return $strParse;
}
/**
* 获取状态筛选参数
*
@@ -408,13 +360,10 @@ EOT;
$d_key = $tag['d_key'] ?? 'd_key';
$d_val = $tag['d_val'] ?? 'd_val';
$n_sex = $tag['n_sex'] ?? '';
$n_sex = $this->customBuildVar($n_sex);
$strParse = <<<EOT
<?php
\$arrCategory = \\app\\services\\StaticConfig::getCategoryFilter( {$n_sex});
\$arrCategory = \\app\\services\\StaticConfig::getVideoCategoryFilter();
if (!empty(\$arrCategory) && is_array(\$arrCategory)):