debug-video-seowords

This commit is contained in:
make
2025-05-27 15:26:44 +08:00
parent b392a65948
commit ef3eb4b1b4
8 changed files with 186 additions and 12 deletions

View File

@@ -281,6 +281,25 @@ $arrRoutes = [
],
/**
* 视频详情-伪造
* /voddetail/strVideoPinyin-1-1
*/
'video_info_forge' => [
'/voddetail/:strPinyin-:intVId-:intVForgeId',
'/vodinfo/:strPinyin-:intVId-:intVForgeId',
'/vod/:strPinyin-:intVId-:intVForgeId',
'/video-info/:strPinyin-:intVId-:intVForgeId',
'/video-detail/:strPinyin-:intVId-:intVForgeId',
'/video/:strPinyin-:intVId-:intVForgeId',
'/shipin/:strPinyin-:intVId-:intVForgeId',
'/shipin-xiangqing/:strPinyin-:intVId-:intVForgeId',
'/shipin-neiron/:strPinyin-:intVId-:intVForgeId',
],
/**
* 视频详情
* /voddetail/strVideoPinyin-1
@@ -440,6 +459,19 @@ foreach ($arrRoutes['prefixes'] as $platform => $prefixes) {
'intPage' => '\d*', // 允许空值
]);
break;
case 'video_info_forge':
//详情
$strView = 'pc/getVideoInfo.html';
if ($platform == 'h5') {
$strView = 'video/getVideoInfo.html';
}
Route::get($strRoute, function () use ($strView) {
return view($strView);
})
->pattern(['intVId' => '\d+', 'strPinyin' => '[\w-]+','intVForgeId' => '\d+']);
break;
case 'video_info':
//详情
$strView = 'pc/getVideoInfo.html';

View File

@@ -2,11 +2,14 @@
{block name="get-data"}
{if $Request.route.intVId}
{if $Request.route.intVId && $Request.route.intVForgeId}
{video:info v_id="$Request.route.intVId" v_key="arrVideo" v_fid="$Request.route.intVForgeId" /}
{elseif $Request.route.intVId}
{video:info v_id="$Request.route.intVId" v_key="arrVideo" /}
{else}
{video:info v_id="$DomainModel->info_id" n_key="arrVideo" n_forge_id="0" /}
{video:info v_id="$DomainModel->info_id" n_key="arrVideo" /}
{/if}
{site:grm page_code="h5_video_info" diff="$arrVideo.v_id" num="120" g_key="arrGrm" /}
{/block}
@@ -132,6 +135,8 @@
{/block}
{block name="main"}
<div class="container">
<h1 class="view-title">
{site:replace code="VIDEO@GETVIDEOINFO@H1" diff="$arrVideo.v_id"}
@@ -165,7 +170,6 @@
</a>
</div>
<div class="stui-content__detail">
<h2 class="title">
《{$arrVideo.v_name}》<span class="score text-red">{$arrVideo.v_score}</span>
@@ -269,6 +273,29 @@
</div>
</div>
{if !empty($arrVideo.v_seo_words)}
<div class="stui-pannel stui-pannel-bg clearfix" id="desc">
<div class="stui-pannel-box">
<div class="stui-pannel_hd">
<div class="stui-pannel__head active bottom-line clearfix">
<h3 class="title">
<img src="/template/videodadi/icon/icon_30.png" />相关推荐
</h3>
</div>
</div>
<div class="stui-pannel_bd">
<p class="col-pd">
{volist name='$arrVideo.v_seo_words' key="index" id='SeoWords' }
<a
href='{site:vfurl v_id="$arrVideo.v_id" v_py="$arrVideo.v_name_en" v_fid="$index"/}'>{$SeoWords}</a>&nbsp;&nbsp;
{/volist}
</p>
</div>
</div>
</div>
{/if}
<div class="stui-pannel stui-pannel-bg clearfix" id="desc">
<div class="stui-pannel-box">

View File

@@ -78,6 +78,25 @@ class VideoService
return (string)$strUrl;
}
/**
* 伪造视频
*
* @param integer $intVId
* @param string $intPinYin
* @param integer $intVForgeId
* @return string
*/
public function getForgeVideoInfoUrl(int $intVId, string $intPinYin, int $intVForgeId): string
{
$strKey = 'FORGE_VIDEO_INFO_URL';
$strUrl = $this->SiteContext->DomainModel->getFomartUrl($strKey, [
'intVId' => $intVId,
'strPinYin' => $intPinYin,
'intVForgeId' => $intVForgeId,
]);
return (string)$strUrl;
}
/**
* 视频播放
*
@@ -678,9 +697,10 @@ class VideoService
* 根据VId获取视频详情
*
* @param integer $intVId
* @param integer|NULL $intVForgeId
* @return void
*/
public function getVideoByVId(int $intVId)
public function getVideoByVId(int $intVId, int|NULL $intVForgeId)
{
// 视频详情
@@ -690,6 +710,10 @@ class VideoService
throw new HttpException(404, '视频不存在');
}
if($intVForgeId >= 0 && !empty($arrVideo['v_seo_words'])){
$arrVideo['v_name'] = $arrVideo['v_seo_words'][$intVForgeId-1];
}
// 取前5个元素
$strTopActor = (is_array($arrVideo['v_actor'] ?? null)) ? array_slice($arrVideo['v_actor'], 0, 5) : '';

View File

@@ -70,7 +70,7 @@ class VideoSeoLogic
{
try {
$strUrl = 'https://suggestion.baidu.com/su?wd=%s&json=1&p=3&cb=callback';
$strUrl = 'https://suggestion.baidu.com/su?wd=%s&json=1&p=1&cb=callback';
$strUrl = sprintf($strUrl, $strVName);

View File

@@ -24,6 +24,7 @@ class Site extends TagLib
'vclurl' => ['attr' => 'category,parent_category,area,lang,year,order,page', 'close' => 0],
'vrlurl' => ['attr' => 'category,parent_category,sort_type,page', 'close' => 0],
'vurl' => ['attr' => 'v_id,v_py', 'close' => 0],
'vfurl' => ['attr' => 'v_id,v_py,v_fid', 'close' => 0],
'vpurl' => ['attr' => 'v_id,v_py,play_type,play_index', 'close' => 0],
'vsurl' => ['attr' => 'key', 'close' => 0],
@@ -143,6 +144,32 @@ EOD;
return $strParse;
}
/**
* 伪视频详情URL生成器
*
* @param array $n_id
* @return string
*/
public function tagVFUrl($tag)
{
$intVId = isset($tag['v_id']) ? $tag['v_id'] : '';
$strVPy = isset($tag['v_py']) ? $tag['v_py'] : '';
$intVForgeId = isset($tag['v_fid']) ? $tag['v_fid'] : '';
$intVId = $this->customBuildVar($intVId);
$strVPy = $this->customBuildVar($strVPy);
$intVForgeId = $this->customBuildVar($intVForgeId);
$strParse = <<<EOD
<?php
\$strUrl = app(\\app\\services\\VideoService::class)->getForgeVideoInfoUrl({$intVId},{$strVPy},{$intVForgeId});
echo \$strUrl;
?>
EOD;
return $strParse;
}
/**
* 视频播放URL生成器
*

View File

@@ -337,16 +337,20 @@ EOT;
{
$v_id = $tag['v_id'] ?? '0';
$v_fid = $tag['v_fid'] ?? -1;
$v_key = $tag['v_key'] ?? 'arrVideo';
$v_id = $this->customBuildVar($v_id);
$v_fid = $this->customBuildVar($v_fid);
$arrDataName = randomString(5);
$strParse = <<<EOT
<?php
\${$arrDataName} = app(\\app\\services\\VideoService::class)->getVideoByVId(
{$v_id}
{$v_id},
{$v_fid}
);
\${$v_key} = \${$arrDataName} ?? [];

View File

@@ -361,7 +361,15 @@ $arrVideoSubjectFomartGroupData = [
'arrSubjectFomart' => ['/pc']
],
// 最新替换模板分组id 1122
'FORGE_VIDEO_INFO_URL' => [
'description' => '伪视频详情URL 模板1',
'sfg_id' => 1123,
'arrSubjectFomart' => [
'/voddetail/{strPinYin}-{intVId}-{intVForgeId}',
]
],
// 最新替换模板分组id 1131
];

View File

@@ -540,11 +540,63 @@ return [
]
],
'FORGE_VIDEO_INFO_URL_T2' => [
'description' => '伪视频详情URL 模板2',
'sfg_id' => 1124,
'arrSubjectFomart' => [
'/vodinfo/{strPinYin}-{intVId}-{intVForgeId}',
]
],
'FORGE_VIDEO_INFO_URL_T3' => [
'description' => '伪视频详情URL 模板3',
'sfg_id' => 1125,
'arrSubjectFomart' => [
'/vod/{strPinYin}-{intVId}-{intVForgeId}',
]
],
'FORGE_VIDEO_INFO_URL_T4' => [
'description' => '伪视频详情URL 模板4',
'sfg_id' => 1126,
'arrSubjectFomart' => [
'/video-info/{strPinYin}-{intVId}-{intVForgeId}',
]
],
'FORGE_VIDEO_INFO_URL_T5' => [
'description' => '伪视频详情URL 模板5',
'sfg_id' => 1127,
'arrSubjectFomart' => [
'/video-detail/{strPinYin}-{intVId}-{intVForgeId}',
]
],
'FORGE_VIDEO_INFO_URL_T6' => [
'description' => '伪视频详情URL 模板6',
'sfg_id' => 1128,
'arrSubjectFomart' => [
'/video/{strPinYin}-{intVId}-{intVForgeId}',
]
],
'FORGE_VIDEO_INFO_URL_T7' => [
'description' => '伪视频详情URL 模板7',
'sfg_id' => 1129,
'arrSubjectFomart' => [
'/shipin/{strPinYin}-{intVId}-{intVForgeId}',
]
],
'FORGE_VIDEO_INFO_URL_T8' => [
'description' => '伪视频详情URL 模板8',
'sfg_id' => 1130,
'arrSubjectFomart' => [
'/shipin-xiangqing/{strPinYin}-{intVId}-{intVForgeId}',
]
],
'FORGE_VIDEO_INFO_URL_T9' => [
'description' => '伪视频详情URL 模板9',
'sfg_id' => 1131,
'arrSubjectFomart' => [
'/shipin-neiron/{strPinYin}-{intVId}-{intVForgeId}',
]
],
// 最新替换模板分组id 1122
// 最新替换模板分组id 1131
];