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

This commit is contained in:
make
2025-04-21 12:00:06 +08:00
17 changed files with 2432 additions and 55 deletions

View File

@@ -7,7 +7,7 @@ use think\template\TagLib;
class Chapter extends TagLib
{
protected $tags = [
'list' => ['attr' => 'limit,n_category,sort_type,n_status,n_sex,key,diff_key,cache_life,d_key,d_val', 'close' => 1],
'list' => ['attr' => 'count,n_category,sort_type,n_status,n_sex,key,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,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_key', 'close' => 0],

View File

@@ -7,7 +7,7 @@ use think\template\TagLib;
class Novel extends TagLib
{
protected $tags = [
'list' => ['attr' => 'limit,n_category,sort_type,n_status,n_sex,key,diff_key,cache_life,d_key,d_val', 'close' => 1],
'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_key', 'close' => 0],
@@ -15,6 +15,8 @@ class Novel extends TagLib
'status' => ['attr' => 'd_key,d_val'],
'sex' => ['attr' => 'd_key,d_val'],
'category' => ['attr' => 'd_key,d_val,n_sex'],
'ranklist' => ['attr' => 'count,sort_type,n_status,n_sex,diff_key,cache_life,d_key,d_val', 'close' => 1],
];
private function customBuildVar($mixedArgs)
@@ -27,8 +29,67 @@ class Novel extends TagLib
}
/**
* novel 自定义标签
* tagRankList
*
* @param array $tag
* @param string $content
* @return void
*/
public function tagRankList($tag, $content)
{
$count = $tag['count'] ?? '10';
$sort_type = $tag['sort_type'] ?? "";
$n_status = $tag['n_status'] ?? "all";
$n_sex = $tag['n_sex'] ?? "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';
$sort_type = $this->customBuildVar($sort_type);
$n_status = $this->customBuildVar($n_status);
$n_sex = $this->customBuildVar($n_sex);
$diff_key = $this->customBuildVar($diff_key);
$cache_life = $this->customBuildVar($cache_life);
$arrDataName = randomString(5);
$strParse = <<<EOT
<?php
\${$arrDataName} = app(\\app\\services\\NovelService::class)->getRankList([
'count' => {$count},
'sort_type' => {$sort_type},
'n_status' => {$n_status},
'n_sex' => {$n_sex},
'diff_key' => {$diff_key},
'cache_life' => {$cache_life}
]);
if (!empty(\${$arrDataName}) && is_array(\${$arrDataName})):
?>
EOT;
$strParse .= <<<EOT
<?php foreach (\${$arrDataName} as \${$d_key} => \${$d_val}): ?>
EOT;
$strParse .= $content;
$strParse .= <<<EOT
<?php endforeach; ?>
<?php endif; ?>
EOT;
return $strParse;
}
/**
* tagPagerExp
*
* @param array $tag
* @param string $content
* @return void
*/
public function tagPagerExp($tag, $content)
{
@@ -36,7 +97,11 @@ class Novel extends TagLib
}
/**
* novel 自定义标签
* tagPager
*
* @param array $tag
* @param string $content
* @return void
*/
public function tagPager($tag, $content)
{
@@ -115,7 +180,11 @@ EOT;
}
/**
* novel 自定义标签
* tagList
*
* @param array $tag
* @param string $content
* @return void
*/
public function tagList($tag, $content)
{

View File

@@ -18,6 +18,8 @@ class Site extends TagLib
'nflurl' => ['attr' => 'gender,category,status,order,page', 'close' => 0],
'grm' => ['attr' => 'domain,code,line,diff,start,end,index,type', 'close' => 0],
'replace' => ['attr' => 'code', 'close' => 0],
'forgelist' => ['attr' => 'count,diff_key,cache_life,d_key,d_val', 'close' => 1],
];
private function customBuildVar($mixedArgs)
@@ -29,6 +31,50 @@ class Site extends TagLib
}
}
/**
* tagRankList
*
* @param array $tag
* @param string $content
* @return void
*/
public function tagForgeList($tag, $content)
{
$count = $tag['count'] ?? '10';
$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';
$diff_key = $this->customBuildVar($diff_key);
$cache_life = $this->customBuildVar($cache_life);
$arrDataName = randomString(5);
$strParse = <<<EOT
<?php
\${$arrDataName} = app(\\app\\services\\SiteContext::class)->getForgeList([
'count' => {$count},
'diff_key' => {$diff_key},
'cache_life' => {$cache_life}
]);
if (!empty(\${$arrDataName}) && is_array(\${$arrDataName})):
?>
EOT;
$strParse .= <<<EOT
<?php foreach (\${$arrDataName} as \${$d_key} => \${$d_val}): ?>
EOT;
$strParse .= $content;
$strParse .= <<<EOT
<?php endforeach; ?>
<?php endif; ?>
EOT;
return $strParse;
}
/**
* cfg 标签处理函数-系统配置
*