Merge branch 'dev' of ssh://git.bgbg.live:18150/root/SEONexus into dev

This commit is contained in:
make
2025-04-29 00:37:35 +08:00
12 changed files with 528 additions and 265 deletions

View File

@@ -1,114 +1,61 @@
<!-- {site:getval func="strSiteName" /} -->
<!-- {site:helper func="initHomeTKD" /} -->
<pre>
<!-- {site:forgelist count="3" d_key="d_key" d_val="novel" cache_life="1000"}
{video:ranklist count="10" sort_type="total" n_status="wanjie" d_key="d_key" d_val="video" cache_life="1000"}
<li>
Index: {$d_key}
Title: {$novel.n_forge_title}
Author: {$novel.n_name_pinyin}
{php}var_dump($video){/php}
章节名称: {$video.v_name}
章节序号: {$video.v_category}
</li>
{/site:forgelist} -->
{/video:ranklist}
<!-- {novel:ranklist count="10" sort_type="total" n_status="wanjie" n_sex="man" d_key="d_key" d_val="novel" cache_life="1000"}
<li>
{php}var_dump($novel){/php}
Index: {$d_key}
Title: {$novel.n_name}
Author: {$novel.n_category}
</li>
{/novel:ranklist} -->
<!-- {novel:pagerexp page="1" limit="10" n_category="$Request.route.category" d_key="d_key" d_val="novel" p_val="page_data"
cache_life="1000" func="generateSearchPager" export_name="fadfads" /}
{php}var_dump($fadfads['p_data']);{/php} -->
<!-- {novel:pager page="1" limit="10" n_category="$Request.route.category" d_key="d_key" d_val="novel" p_val="page_data"
cache_life="1000" func="generateSearchPager"}
<!-- {video:pager page="1" limit="10" d_key="d_key" d_val="video" cache_life="1000" button_num="3" v_category="动作片" v_status="wanjie" sort_type="update" p_val="page_data" func="generateVideoPager"}
<li>
Index: {$d_key}
Title: {$novel.n_name}
Author: {$novel.n_category}
章节名称: {$video.v_name}
章节序号: {$video.v_category}
</li>
{/novel:pager}
{/video:pager}
{php}var_dump($page_data);{/php} -->
<!-- {site:grm page_code="fdasfadsf" diff="fadsfdsa" num="10" g_key="arrGrm" /}
{php}var_dump($arrGrm);{/php} -->
<!-- {chapter:info n_id="1" c_sort_num="200" c_page="0" c_key="arrChapter01" /}
{$arrChapter01.c_name} -->
<!-- {chapter:pager page="1" limit="10" n_id="$Request.get.n_id" d_key="d_key" d_val="chapter" cache_life="1000" button_num="3" sort_type="dao" p_val="page_data" func="generateChapterPager"}
<!--
{video:list count="10" v_category="动作片" v_status="wanjie" sort_type="update" d_key="d_key" d_val="video" cache_life="1000" }
<li>
Index: {$d_key}
章节名称: {$chapter.c_name}
章节序号: {$chapter.c_sort_num}
章节名称: {$video.v_name}
章节序号: {$video.v_category}
</li>
{/chapter:pager}
{php}var_dump($page_data);{/php} -->
{/video:list} -->
<!-- {chapter:list count="10" n_id="$Request.get.n_id" d_key="d_key" d_val="chapter" cache_life="1000"}
<!-- {video:info v_id="12" v_key="aaa" /}
{php}print_r($aaa);{/php} -->
<!-- {video:ranksort d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/video:ranksort} -->
<!--
{video:status d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/video:status} -->
<!-- {video:sort d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/video:sort} -->
<!-- {video:category d_key="key" d_val="val"}
<li>
Index: {$d_key}
章节名称: {$chapter.c_name}
章节序号: {$chapter.c_sort_num}
: {$key} - 值: {$val}
</li>
{/chapter:list} -->
<!--
{novel:category d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/novel:category} -->
<!-- {novel:sex d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/novel:sex} -->
<!--
{novel:status d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/novel:status} -->
<!--
{novel:sort d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/novel:sort} -->
{/video:category} -->
<!--
{novel:info n_id="33" n_key="arrNovel01" n_forge_id="1125940" /}
{$arrNovel01.n_name} -->
<!-- {$DomainModel->d_domain} -->
<!-- {site:replace code="INDEX@INDEX@TITLE"}
-->
<!-- {novel:list count="10" n_category="$Request.route.category" d_key="d_key" d_val="novel" p_val="page_data" cache_life="1000"}
<li>
Index: {$d_key}
Title: {$novel.n_name}
Author: {$novel.n_category}
</li>
{/novel:list} -->
</pre>

View File

@@ -0,0 +1,114 @@
<!-- {site:getval func="strSiteName" /} -->
<!-- {site:helper func="initHomeTKD" /} -->
<!-- {site:forgelist count="3" d_key="d_key" d_val="novel" cache_life="1000"}
<li>
Index: {$d_key}
Title: {$novel.n_forge_title}
Author: {$novel.n_name_pinyin}
</li>
{/site:forgelist} -->
<!-- {novel:ranklist count="10" sort_type="total" n_status="wanjie" n_sex="man" d_key="d_key" d_val="novel" cache_life="1000"}
<li>
{php}var_dump($novel){/php}
Index: {$d_key}
Title: {$novel.n_name}
Author: {$novel.n_category}
</li>
{/novel:ranklist} -->
<!-- {novel:pagerexp page="1" limit="10" n_category="$Request.route.category" d_key="d_key" d_val="novel" p_val="page_data"
cache_life="1000" func="generateSearchPager" export_name="fadfads" /}
{php}var_dump($fadfads['p_data']);{/php} -->
<!-- {novel:pager page="1" limit="10" n_category="$Request.route.category" d_key="d_key" d_val="novel" p_val="page_data"
cache_life="1000" func="generateSearchPager"}
<li>
Index: {$d_key}
Title: {$novel.n_name}
Author: {$novel.n_category}
</li>
{/novel:pager}
{php}var_dump($page_data);{/php} -->
<!-- {site:grm page_code="fdasfadsf" diff="fadsfdsa" num="10" g_key="arrGrm" /}
{php}var_dump($arrGrm);{/php} -->
<!-- {chapter:info n_id="1" c_sort_num="200" c_page="0" c_key="arrChapter01" /}
{$arrChapter01.c_name} -->
<!-- {chapter:pager page="1" limit="10" n_id="$Request.get.n_id" d_key="d_key" d_val="chapter" cache_life="1000" button_num="3" sort_type="dao" p_val="page_data" func="generateChapterPager"}
<li>
Index: {$d_key}
章节名称: {$chapter.c_name}
章节序号: {$chapter.c_sort_num}
</li>
{/chapter:pager}
{php}var_dump($page_data);{/php} -->
<!-- {chapter:list count="10" n_id="$Request.get.n_id" d_key="d_key" d_val="chapter" cache_life="1000"}
<li>
Index: {$d_key}
章节名称: {$chapter.c_name}
章节序号: {$chapter.c_sort_num}
</li>
{/chapter:list} -->
<!--
{novel:category d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/novel:category} -->
<!-- {novel:sex d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/novel:sex} -->
<!--
{novel:status d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/novel:status} -->
<!--
{novel:sort d_key="key" d_val="val"}
<li>
键: {$key} - 值: {$val}
</li>
{/novel:sort} -->
<!--
{novel:info n_id="33" n_key="arrNovel01" n_forge_id="1125940" /}
{$arrNovel01.n_name} -->
<!-- {$DomainModel->d_domain} -->
<!-- {site:replace code="INDEX@INDEX@TITLE"}
-->
<!-- {novel:list count="10" n_category="$Request.route.category" d_key="d_key" d_val="novel" p_val="page_data" cache_life="1000"}
<li>
Index: {$d_key}
Title: {$novel.n_name}
Author: {$novel.n_category}
</li>
{/novel:list} -->

View File

@@ -80,6 +80,16 @@ abstract class MongoModel
{
return $this->getCol()->findOne($arrFilter, $arrOptions);
}
/**
* Undocumented function
*
* @param array $arrFilter
* @return array|object|null
*/
public function get(array $arrFilter = [], array $arrOptions = []): array|object|null
{
return $this->getCol()->find($arrFilter, $arrOptions);
}
/**
* Undocumented function

View File

@@ -0,0 +1,86 @@
<?php
declare(strict_types=1);
namespace app\model;
/**
* @mixin think\Model
*/
class VideoCategoryModel extends MongoModel
{
protected $strCollection = 'video_category';
/**
* Undocumented variable
*
* @var VideoCategoryModel
*/
static public $VideoCategoryModel;
static public function getInstance(): self
{
if (self::$VideoCategoryModel == NULL) {
self::$VideoCategoryModel = new self;
}
return self::$VideoCategoryModel;
}
static $arrCategory = [
"da-lu-zong-yi" => "大陆综艺",
"ai-qing-pian" => "爱情片",
"ke-huan-pian" => "科幻片",
"ri-han-zong-yi" => "日韩综艺",
"ri-han-dong-man" => "日韩动漫",
"zhan-zheng-pian" => "战争片",
"ou-mei-ju" => "欧美剧",
"lun-li-pian" => "倫理片",
"han-guo-ju" => "韩国剧",
"yin-le" => "音乐",
"dong-hua-pian" => "动画片",
"guo-chan-dong-man" => "国产动漫",
"kong-bu-pian" => "恐怖片",
"tai-wan-ju" => "台湾剧",
"xiang-gang-ju" => "香港剧",
"xi-ju-pian" => "喜剧片",
"ying-shi" => "影视",
"qi-che" => "汽车",
"ou-mei-zong-yi" => "欧美综艺",
"ju-qing-pian" => "剧情片",
"tai-guo-ju" => "泰国剧",
"hai-wai-ju" => "海外剧",
"guo-chan-ju" => "国产剧",
"fu-li" => "福利",
"ou-mei-dong-man" => "欧美动漫",
"dong-zuo-pian" => "动作片",
"ri-ben-ju" => "日本剧",
"gang-tai-zong-yi" => "港台综艺",
"gang-tai-dong-man" => "港台动漫",
"ji-lu-pian" => "记录片",
"duan-ju-da-quan" => "短剧大全",
"gao-xiao" => "搞笑",
"hai-wai-dong-man" => "海外动漫",
];
/**
* get category of the videos
*
* @return array
*/
static public function getCategory(): array
{
return self::$arrCategory;
}
/**
* get pinyin based on chinese characters
*
* @param string $strZh
* @return string
*/
static public function getZhByPinYin(string $strZh)
{
$strKey = array_search($strZh, self::$arrCategory);
return $strKey === false ?: self::$arrCategory[$strKey];
}
}

View File

@@ -3,6 +3,8 @@
namespace app\services;
use app\model\CategoryModel;
use app\model\VideoCategoryModel;
use app\model\VideoModel;
class StaticConfig
{
@@ -50,12 +52,19 @@ class StaticConfig
'update' => '最新更新',
];
static $arrVideoRankSortType = [
'daily' => '天',
'weekly' => '周',
'monthly' => '月',
'total' => '总',
];
/**
* GetCategoryFilter
* getNovelCategoryFilter
*
* @return array
*/
static function getCategoryFilter(string $strNSex = ''): array
static function getNovelCategoryFilter(string $strNSex = ''): array
{
if ($strNSex == 'man') {
return CategoryModel::$arrCategoryAll['man'];
@@ -65,4 +74,14 @@ class StaticConfig
return array_combine(CategoryModel::$arrCategoryPinYin, CategoryModel::$arrCategory);
}
}
/**
* getNovelCategoryFilter
*
* @return array
*/
static function getVideoCategoryFilter(): array
{
return VideoCategoryModel::$arrCategory;
}
}

View File

@@ -60,7 +60,7 @@ class VideoService
/**
* 获取小说分类URl
* 获取视频分类URl
*
* @param string $strGender
* @param string $strCategory
@@ -114,7 +114,7 @@ class VideoService
/**
* Undocumented function
* 小说目录
* 视频目录
* @param int $intVId
* @param string $intPinYin
* @return string
@@ -151,7 +151,7 @@ class VideoService
}
/**
* 获取排行榜小说
* 获取排行榜视频
*
* @param array $arrParams
* @return array
@@ -160,7 +160,7 @@ class VideoService
{
$intCount = (int)$arrParams['count'] ?? 10;
$strSortType = (string)$arrParams['sort_type'] ?? '';
$strNStatus = (string) $arrParams['v_isend'] ?? '';
$strVStatus = (string) $arrParams['v_status'] ?? '';
$strDiffKey = (string) $arrParams['diff_key'] ?? '';
$intCacheLifeTime = (int)$arrParams['cache_life'] ?? 0;
@@ -168,8 +168,8 @@ class VideoService
$arrFilter = [];
# v_isend filter
if (!empty($strNStatus)) {
switch ($strNStatus) {
if (!empty($strVStatus)) {
switch ($strVStatus) {
case 'lianzai':
$arrFilter['v_isend'] = 0;
break;
@@ -220,10 +220,8 @@ class VideoService
$arrVideo = $this->VideoModel->getRankVideoOnCache(
$strCacheKey,
$intCount,
$arrFilter['v_category_sex_zh'] ?? 0,
$arrSort['v_sort_type'] ?? 'daily',
$arrFilter['v_isend'] ?? NULL,
$intLifeTime,
$arrFilter['v_status'] ?? NULL,
);
return $arrVideo;
@@ -231,7 +229,7 @@ class VideoService
/**
* 获取小说数据
* 获取视频数据
*
* @param array $arrParams
* @return array
@@ -241,7 +239,7 @@ class VideoService
$intCount = (int)$arrParams['count'] ?? 10;
$strNCategory = $arrParams['v_category'] ?? '';
$strSortType = (string)$arrParams['sort_type'] ?? '';
$strNStatus = (string) $arrParams['v_isend'] ?? '';
$strVStatus = (string) $arrParams['v_status'] ?? '';
$strDiffKey = (string) $arrParams['diff_key'] ?? '';
$intCacheLifeTime = (int)$arrParams['cache_life'] ?? 0;
@@ -257,18 +255,17 @@ class VideoService
}
# v_isend filter
if (!empty($strNStatus)) {
switch ($strNStatus) {
if (!empty($strVStatus)) {
switch ($strVStatus) {
case 'lianzai':
$arrFilter['v_isend'] = StaticConfig::$arrVideoStatus[$strNStatus];
$arrFilter['v_isend'] = 0;
break;
case 'wanjie':
$arrFilter['v_isend'] = StaticConfig::$arrVideoStatus[$strNStatus];
$arrFilter['v_isend'] = 1;
break;
}
}
$arrSort = [];
# sort filter
@@ -281,7 +278,7 @@ class VideoService
$arrSort['v_level'] = -1;
break;
case 'update':
$arrSort['v_update_time'] = -1;
$arrSort['v_publish_date'] = -1;
break;
}
}
@@ -316,7 +313,7 @@ class VideoService
/**
* 获取小说分页数据
* 获取视频分页数据
*
* @param array $arrParams
* @return array
@@ -330,7 +327,6 @@ class VideoService
'v_category' => (string)($arrParams['v_category'] ?? ''),
'sort_type' => (string)($arrParams['sort_type'] ?? ''),
'v_isend' => (string)($arrParams['v_isend'] ?? ''),
'v_sex' => (string)($arrParams['v_sex'] ?? ''),
'diff_key' => (string)($arrParams['diff_key'] ?? ''),
'key' => (string)($arrParams['key'] ?? ''),
'cache_life' => (int)($arrParams['cache_life'] ?? 0),
@@ -341,7 +337,7 @@ class VideoService
$intLimit = $arrParams['limit'];
$strNCategory = $arrParams['v_category'];
$strSortType = $arrParams['sort_type'];
$strNStatus = $arrParams['v_isend'];
$strVStatus = $arrParams['v_isend'];
$strDiffKey = $arrParams['diff_key'];
$strKey = $arrParams['key'];
@@ -367,13 +363,13 @@ class VideoService
}
# v_isend filter
if (!empty($strNStatus)) {
switch ($strNStatus) {
if (!empty($strVStatus)) {
switch ($strVStatus) {
case 'lianzai':
$arrFilter['$and'][] = ['v_isend' => StaticConfig::$arrVideoStatus[$strNStatus]];
$arrFilter['$and'][] = ['v_isend' => 0];
break;
case 'wanjie':
$arrFilter['$and'][] = ['v_isend' => StaticConfig::$arrVideoStatus[$strNStatus]];
$arrFilter['$and'][] = ['v_isend' => 1];
break;
default:
$arrParams['v_isend'] = 'all';
@@ -409,7 +405,7 @@ class VideoService
$arrSort['v_level'] = -1;
break;
case 'update':
$arrSort['v_update_time'] = -1;
$arrSort['v_publish_date'] = -1;
break;
default:
$arrParams['sort_type'] = 'all';
@@ -436,18 +432,11 @@ class VideoService
}
// 更新值
$strGender = $this->SiteContext->Request->param('strGender');
$strNanUrlTemp = $this->SiteContext->DomainModel->getFomartSubject('NAN_SHENG_URL', '', false);
$strNanUrl = str_replace("/", "", $strNanUrlTemp);
$strCNSex = '全部';
if ($strGender) {
$strCNSex = $strGender == $strNanUrl ? '男生' : '女生';
}
ConverterMovel::setVal([
'intPage' => $intPage,
'strVideoSex' => $strCNSex,
'strVideoCategoryName' => empty($strNCategory) ? '' : str_replace("小说", "", $strNCategory),
'strVideoStatus' => empty($strNStatus) ? '' : StaticConfig::$arrVideoStatus[$strNStatus],
'strVideoCategoryName' => empty($strNCategory) ? '' : str_replace("视频", "", $strNCategory),
'strVideoStatus' => empty($strVStatus) ? '' : StaticConfig::$arrVideoStatus[$strVStatus],
'strVideoOrder' => empty($strSortType) ? '' : StaticConfig::$arrVideoSortType[$strSortType],
'strSearchKeywords' => $strKey,
]);
@@ -497,82 +486,54 @@ class VideoService
return $arrPaginator;
}
/**
* 书库/分类定制分页
*
* @param array $arrFilter 查询条件字段
* @param array $arrSort 查询排序字段
* @param array $arrVideo 查询出来的数据
* @param array $arrNovel 查询出来的数据
* @return array
*/
public function generateCategoryPager(array $arrParams, array $arrSort, array $arrVideo): array
public function generateVideoPager(array $arrParams, array $arrSort, array $arrVideo): array
{
$strGender = $arrParams['v_sex'];
$strCategory = $arrParams['v_category'];
$strStatus = $arrParams['v_isend'];
$strOrder = $arrParams['sort_type'];
$intPage = $arrVideo['page'] ?? 1;
$intLimit = $arrVideo['limit'] ?? 10;
$intTotal = $arrVideo['total'] ?? 0;
$strKey = $arrParams['key'];
$intPage = $arrVideo['page'];
$intLimit = $arrVideo['limit'];
$intButtomNum = $arrParams['buttov_num'];
$strBaseUrl = $this->getVideoCategoryUrl($strGender, $strCategory, $strStatus, $strOrder, '{page}');
$arrPaginator = CusteomPage02::generate($intPage, $intTotal, $intLimit, $strBaseUrl, $intButtomNum);
$strBaseUrl = app(VideoService::class)->getVideoSearchUrl($strKey, '{page}');
$arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum);
return $arrPaginator;
}
/**
* 根据VId获取小说详情
* 根据VId获取视频详情
*
* @param integer $intVId
* @return void
*/
public function getVideoByVId(int $intVId, int|null $intNForgeId = 0)
public function getVideoByVId(int $intVId)
{
// 小说详情
// 视频详情
$arrVideo = $this->VideoModel->getVideoByVId($intVId);
if ($intNForgeId > 0) {
foreach ($arrVideo['v_forge_novel'] as $arrForgeVideo) {
if ($arrForgeVideo['v_forge_id'] == $intNForgeId) {
$arrVideo['v_name'] = $arrForgeVideo['v_forge_title'];
break;
}
}
}
// 分类拼音
$arrVideo['v_category_pinyin'] = CategoryModel::getPinYin($arrVideo['v_category']);
$arrVideo['v_category_sex_en'] = $arrVideo['v_category_sex_en'] ?? 'man';
// 点击数
$arrVideoClicks = $this->VideoClicksModel->getStats($intVId);
// 推荐小说
$arrRelateveVId = array_column($arrVideo['v_related_novel'], 'v_id');
$arrRelateveVideo = $this->VideoModel->findMany(['v_id' => [
'$in' => $arrRelateveVId,
]], 10);
// 更新值
ConverterMovel::setVal([
'intPage' => 1,
'strVideoName' => $arrVideo['v_name'],
'strVideoAuthor' => $arrVideo['v_author'],
'strVideoCategoryName' => $arrVideo['v_category'],
'strVideoSex' => $arrVideo['v_category_sex_en'] == 'man' ? '男生' : '女生',
'strVideoStatus' => $arrVideo['v_isend'],
'strVideoDescription' => $arrVideo['v_description'],
]);
$arrVideo['arrVideoClicks'] = $arrVideoClicks;
$arrVideo['arrRelateveVideo'] = $arrRelateveVideo;
return $arrVideo;
}

View File

@@ -83,6 +83,9 @@ class VideoInfoPage extends BasePage
'url' => $arrVal[1] ?? $arrVal[0],
];
}
$arrVideo['vod_class'] = trim($arrVideo['vod_class']);
$arrVideo['vod_play_url'][$this->getsite()->getSiteCode()] = $arrPlayUrl;
$arrVideo['vod_actor'] = explode(',', $arrVideo['vod_actor']);
$arrVideo['vod_director'] = explode(',', $arrVideo['vod_director']);

View File

@@ -45,7 +45,7 @@ class SiteMapLogic
public function __construct()
{
$this->arrNovelCategory = StaticConfig::getCategoryFilter();
$this->arrNovelCategory = StaticConfig::getNovelCategoryFilter();
$this->arrNovelSort = StaticConfig::$arrNovelSortType;

View File

@@ -27,7 +27,7 @@ return [
// 自定义标签
'taglib_pre_load' => '\\template\\taglib\\Ad,\\template\\taglib\\Site,\\template\\taglib\\Rs,\\template\\taglib\\Novel,\\template\\taglib\\Chapter',
'taglib_pre_load' => '\\template\\taglib\\Ad,\\template\\taglib\\Site,\\template\\taglib\\Rs,\\template\\taglib\\Novel,\\template\\taglib\\Chapter,\\template\\taglib\\Video',
// 模板渲染缓存
'display_cache' => env('VIEW_DISPLAY_CACHE', false),

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)):

View File

@@ -237,8 +237,6 @@ resData = [
{/novel:ranksort}
# 09、获取小说分类筛选条件
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
@@ -406,4 +404,180 @@ resData = [
# 样例
{site:getval code="strNovelCategoryName" /}
# 18、 获取多个视频数据并且遍历
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$count ?? '10'; # 查询条数
$v_category ?? "all"; # 查询分类
$sort_type ?? "all"; # 排序方式 news tuijian update
$v_status ?? "all"; # 查询状态:
# * * 'all' => '所有',
# * * 'lianzai' => '连载中',
# * * 'wanjie' => '已完结',
$diff_key ?? ""; # 缓存键值差异
$cache_life ?? '0'; # 缓存时间如果需要开启缓存这个字段必须传而且必须大于0
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
$d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称
# 样例
{video:list count="10" v_category="$Request.route.category" d_key="d_key" d_val="Video" cache_life="1000"}
<li>
Index: {$d_key}
Title: {$video.n_name}
Author: {$video.v_category}
</li>
{/video:list}
# 19-1、 获取分页视频数据并且遍历
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$page ?? '1'; # 页码
$limit ?? '10'; # 查询条数
$v_category ?? "all"; # 查询分类
$sort_type ?? "all"; # 排序方式
$v_status ?? "all"; # 查询状态:
# * * 'all' => '所有',
# * * 'lianzai' => '连载中',
# * * 'wanjie' => '已完结',
$key ?? ""; # 查询 搜索
$button_num ?? "10"; # 分页按钮数量
$diff_key ?? ""; # 缓存键值差异
$cache_life ?? '0'; # 缓存时间如果需要开启缓存这个字段必须传而且必须大于0
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
$d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称
$p_val ?? 'p_val'; # 分页页码数据,这是一个数组。和之前控制器渲染的那个数组一致的。
$func ; # 这个参数是一个回调方法名,用来渲染分页页码数据的,该方法需要在 NovelService 类里面实现func(array $arrParams, array $arrSort, array $arrNovel) generateCategoryPager generateSearchPager
# 样例
{video:pager page="1" limit="10" v_category="$Request.route.category" d_key="d_key" d_val="video" p_val="page_data" button_num="3" cache_life="1000" func="generateSearchPager"}
<li>
Index: {$d_key}
Title: {$video.n_name}
Author: {$video.v_category}
</li>
{/video:pager}
{php}var_dump($page_data);{/php}
# 19-2、 获取分页视频数据不遍历
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$page ?? '1'; # 页码
$limit ?? '10'; # 查询条数
$v_category ?? "all"; # 查询分类
$sort_type ?? "all"; # 排序方式
$v_status ?? "all"; # 查询状态:
# * * 'all' => '所有',
# * * 'lianzai' => '连载中',
# * * 'wanjie' => '已完结',
$key ?? ""; # 查询 搜索
$button_num ?? "10"; # 分页按钮数量
$diff_key ?? ""; # 缓存键值差异
$cache_life ?? '0'; # 缓存时间如果需要开启缓存这个字段必须传而且必须大于0
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
$d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称
$p_val ?? 'p_val'; # 分页页码数据,这是一个数组。和之前控制器渲染的那个数组一致的。
$export_name ?? 'n_num'; # 查询出来的 所有数据集合,所有数据都可以在里面取。
$func ; # 这个参数是一个回调方法名,用来渲染分页页码数据的,该方法需要在 NovelService 类里面实现func(array $arrParams, array $arrSort, array $arrNovel) generateCategoryPager generateSearchPager
# 样例
{video:pagerexp page="$Request.get.page" limit="30"
key="$Request.get.keyword"
d_key="d_key"
d_val="Video" n
p_val="page_data" button_num="10" cache_life="86400" func="generateSearchPager" export_name="resData" /}
结构
resData = [
data = []
p_data = [
'total' => $intTotal,
'page' => $intPage,
'limit' => $intLimit,
'pages' => ceil($intTotal / $intLimit)
],
]
{php}var_dump($resData['p_data']);{/php}
# 20、获取替换模板替换后的数据
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$code ; # 替换模板编码
# 样例
{site:replace code="INDEX@INDEX@TITLE"}
# 21、获取视频详情数据
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$n_id ; # 传入的视频ID
$n_forge_id ; # 传入的伪造视频ID默认值0不伪造
$n_key ; # 查询出来的数据待使用的变量名称
# 样例
{video:info n_id="33" n_key="arrVideo" /}
{$arrVideo.n_name}
# 22、获取视频状态筛选条件
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
$d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称
# 样例
{video:status d_key="key" d_val="val"}
<li> : {$key} - : {$val} </li>
{/video:status}
# 23、获取视频排序筛选条件
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
$d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称
# 样例
{video:sort d_key="key" d_val="val"}
<li> : {$key} - : {$val} </li>
{/video:sort}
# 24、获取视频排行榜排序筛选条件
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
$d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称
# 样例
{video:ranksort d_key="key" d_val="val"}
<li> : {$key} - : {$val} </li>
{/video:ranksort}
# 25、获取视频分类筛选条件
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
$d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称
# 样例
{video:category d_key="key" d_val="val"}
<li> : {$key} - : {$val} </li>
{/video:category}
# 26、 获取指定类型视频排行榜并且遍历
# 传参与默认值(传参用下面的变量名,名称不需要$符号, 值的话如果用第三方变量作为值,需要带$符号)
$count ?? '10'; # 查询条数
$sort_type ?? "daily"; # 排序方式:
# * * 'daily' => '天',
# * * 'weekly' => '周',
# * * 'monthly' => '月',
# * * 'total' => '总',
$v_status ?? "all"; # 查询状态:
# * * 'all' => '所有',
# * * 'lianzai' => '连载中',
# * * 'wanjie' => '已完结',
$diff_key ?? ""; # 缓存键值差异
$cache_life ?? '0'; # 缓存时间如果需要开启缓存这个字段必须传而且必须大于0
$d_key ?? 'd_key'; # 查询出来的数据遍历的时候, 下标键变量的名称
$d_val ?? 'd_val'; # 查询出来的数据遍历的时候, 值的名称
# 样例
{video:ranklist count="10" sort_type="total" v_status="wanjie" d_key="key" d_val="Video" cache_life="86400"}
<li>
Index: {$d_key}
Title: {$video.n_name}
Author: {$video.v_category}
</li>
{/video:ranklist}
```