This commit is contained in:
make
2026-01-09 01:28:23 +08:00
parent eb8c097777
commit 90fc16fbc3
241 changed files with 26518 additions and 3570 deletions

View File

@@ -27,10 +27,12 @@ class Site extends TagLib
'vfurl' => ['attr' => 'v_id,v_py,v_fid,export_name', 'close' => 0],
'vpurl' => ['attr' => 'v_id,v_py,play_type,play_index,export_name', 'close' => 0],
'vsurl' => ['attr' => 'key,export_name', 'close' => 0],
'forgelist' => ['attr' => 'count,diff_key,cache_life,d_key,d_val', 'close' => 1],
'helper' => ['attr' => 'func', 'close' => 0],
'getval' => ['attr' => 'code', 'close' => 0],
'seotkd' => ['attr' => 'code,page', 'close' => 0],
'pinlun' => ['attr' => 'id,export_name', 'close' => 0],
];
private function customBuildVar($mixedArgs)
@@ -42,6 +44,54 @@ class Site extends TagLib
}
}
/**
* 评论数据(稳定生成,导出数组)
*
* 用法:
* {video:pinlun id="$vo.v_id" export_name="pin" /}
* 然后模板用:
* {include file="module/detail/pinlun/_pinlun_router" /}
* 在 router 中读取:
* $pin_pinlunCfg / $pin_pinlunArr
*
* 或者 export_name 不填时默认导出:
* $pinlunCfg / $pinlunArr
*/
public function tagPinlun($tag)
{
$strVId = $tag['id'] ?? '0';
$strVId = $this->customBuildVar($strVId);
// export_name用于变量前缀避免污染
$export_name = $tag['export_name'] ?? '';
$strDataName = randomString(8);
if (!empty($export_name) && !preg_match('/^[A-Za-z_]\w*$/', $export_name)) {
$export_name = '';
}
$strParse = <<<EOD
<?php
\${$strDataName} = app(\\app\\services\\SiteContext::class)->getPinlunData(intval({$strVId}));
EOD;
// 决定导出还是直接输出
if (empty($export_name)) {
$strParse .= <<<EOD
echo \${$strDataName};
?>
EOD;
} else {
$strParse .= <<<EOD
\${$export_name} = \${$strDataName};
?>
EOD;
}
return $strParse;
}
/**
* 视频分类 首页 URL生成器
*
@@ -204,7 +254,7 @@ EOD;
$strParse = <<<EOD
<?php
\${$strDataName} = app(\\app\\services\\VideoService::class)->getVideoInfoUrl({$intVId},{$strVPy});
EOD;
EOD;
// 决定导出还是直接输出
if (empty($export_name)) {
$strParse .= <<<EOD
@@ -334,7 +384,7 @@ EOD;
$strParse = <<<EOD
<?php
\${$strDataName} = app(\\app\\services\\VideoService::class)->getVideoSearchUrl({$strKey},{$intPage});
EOD;
EOD;
// 决定导出还是直接输出
if (empty($export_name)) {
$strParse .= <<<EOD
@@ -713,6 +763,28 @@ EOD;
return $strParse;
}
/**
* SEO 标签
*
* 用法:
* {seo field="title" /}
* {seo field="keywords" /}
* {seo field="description" /}
*/
public function tagSeoTkd($tag)
{
$strCode = isset($tag['code']) ? $tag['code'] : 'title';
$strPage = isset($tag['page']) ? $tag['page'] : 'detail';
$strParse = <<<EOD
<?php
echo app(\\app\\services\\SiteContext::class)->getSeoTkd("{$strCode}","{$strPage}");
?>
EOD;
return $strParse;
}
/**
* get grm

View File

@@ -24,6 +24,12 @@ class Video extends TagLib
'ranklist' => ['attr' => 'count,sort_type,v_status,v_category_en,v_parent_category_en,diff_key,cache_life,d_key,d_val', 'close' => 1],
'ranklistexp' => ['attr' => 'count,sort_type,v_status,v_category_en,v_parent_category_en,diff_key,cache_life,d_key,d_val,export_name', 'close' => 0],
'getlinename' => ['attr' => 'code', 'close' => 0],
'imgalt' => ['attr' => 'video,tp_style,slot,item_type,export_name', 'close' => 0],
'seoaddon' => ['attr' => 'video,tp_style,export_name', 'close' => 0],
];
private function customBuildVar($mixedArgs)
@@ -35,6 +41,98 @@ class Video extends TagLib
}
}
/**
* 图片 ALT稳定生成
*
* 用法:
* {video:imgalt video="$arrVideo" slot="detail_cover" item_type="poster" export_name="strAlt" /}
* <img alt="{$strAlt}">
*/
public function tagImgAlt($tag)
{
$strVideo = $tag['video'] ?? '$arrVideo';
$strVideo = $this->customBuildVar($strVideo);
$strTpStyle = $tag['tp_style'] ?? '$TpStyle';
$strTpStyle = $this->customBuildVar($strTpStyle);
$strSlot = $tag['slot'] ?? 'list_poster';
$strSlot = $this->customBuildVar($strSlot);
$strItemType = $tag['item_type'] ?? 'poster';
$strItemType = $this->customBuildVar($strItemType);
$export_name = $tag['export_name'] ?? '';
$strDataName = randomString(8);
if (!empty($export_name) && !preg_match('/^[A-Za-z_]\w*$/', $export_name)) {
$export_name = '';
}
$strParse = <<<EOD
<?php
\${$strDataName} = app(\\app\\services\\VideoService::class)->getVideoImgAlt({$strTpStyle}, {$strVideo}, {$strSlot}, {$strItemType});
EOD;
if (empty($export_name)) {
$strParse .= <<<EOD
echo \${$strDataName};
?>
EOD;
} else {
$strParse .= <<<EOD
\${$export_name} = \${$strDataName};
?>
EOD;
}
return $strParse;
}
/**
* 详情页防薄内容模块数据summary/tags/tip
*
* 用法:
* {video:seoaddon video="$arrVideo" export_name="arrAddon" /}
* 然后模板里渲染 $arrAddon.summary / $arrAddon.tags / $arrAddon.tip
*/
public function tagSeoAddon($tag)
{
$strVideo = $tag['video'] ?? '$arrVideo';
$strVideo = $this->customBuildVar($strVideo);
$strTpStyle = $tag['tp_style'] ?? '$TpStyle';
$strTpStyle = $this->customBuildVar($strTpStyle);
$export_name = $tag['export_name'] ?? '';
$strDataName = randomString(8);
if (!empty($export_name) && !preg_match('/^[A-Za-z_]\w*$/', $export_name)) {
$export_name = '';
}
$strParse = <<<EOD
<?php
\${$strDataName} = app(\\app\\services\\VideoService::class)->getVideoDetailSeoAddon({$strTpStyle}, {$strVideo});
EOD;
if (empty($export_name)) {
// 默认直接输出 json不建议用于页面所以强烈建议 export_name
$strParse .= <<<EOD
echo json_encode(\${$strDataName}, JSON_UNESCAPED_UNICODE);
?>
EOD;
} else {
$strParse .= <<<EOD
\${$export_name} = \${$strDataName};
?>
EOD;
}
return $strParse;
}
/**
* tagRankListExp
*
@@ -57,7 +155,7 @@ class Video extends TagLib
*/
public function tagRankList($tag, $content)
{
$count = $tag['count'] ?? '10';
$sort_type = $tag['sort_type'] ?? "";
$v_status = $tag['v_status'] ?? "all";
@@ -257,7 +355,7 @@ EOT;
// if($tag['sort_type'] == "news1"){
// echo $tag['v_parent_category_en'];
// }
$count = $tag['count'] ?? '10';
// $v_category = $tag['v_category'] ?? "all";
$sort_type = $tag['sort_type'] ?? "";
@@ -598,4 +696,29 @@ EOT;
EOT;
return $strParse;
}
/**
* 获取播放线路中文
*
* @param array
* @return string
*/
public function tagGetLineName($tag)
{
$strCode = $tag['code'];
$strCode = $this->customBuildVar($strCode);
if (empty($strCode)) {
return ''; // 或返回默认值
}
$strParse = <<<EOD
<?php
\$strLineName = app(\\app\\services\\VideoService::class)->getConverterPlayLineVal("{$strCode}");
echo \$strLineName;
?>
EOD;
return $strParse;
}
}