debug
This commit is contained in:
@@ -51,3 +51,8 @@ MINIO_BUCKET = test001
|
||||
|
||||
# LocalStorage
|
||||
STORAGE_LOCAL_DIR = /mnt/gluster
|
||||
|
||||
|
||||
# VIEW
|
||||
VIEW_DISPLAY_CACHE = false
|
||||
VIEW_TPL_CACHE = false
|
||||
@@ -144,6 +144,13 @@ namespace {
|
||||
throw new Exception("无法写入加密文件: $strOutImgPath");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 中文转码实体字符
|
||||
*
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
function customEntities($text)
|
||||
{
|
||||
$result = '';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use app\home\controller\Novel;
|
||||
use think\facade\Route;
|
||||
|
||||
# 路由别名,可以忽略
|
||||
@@ -60,14 +61,36 @@ Route::get('/article/info-:intArticleId', 'Novel/getArticleInfo')->ext('html')->
|
||||
Route::get('/pc/article/info-:intArticleId', 'Novel/getArticleInfo')->ext('html')->append(['boolIsMobile' => false]);
|
||||
|
||||
// 小说详情
|
||||
Route::get('/info/:intNovelId', 'Novel/getNovelInfo')->ext('html')->append(['boolIsMobile' => true]);
|
||||
Route::get('/pc/info/:intNovelId', 'Novel/getNovelInfo')->ext('html')->append(['boolIsMobile' => false]);
|
||||
Route::get('/novel/:intNovelId', 'Novel/getNovelInfo')->ext('html')->append(['boolIsMobile' => true]);
|
||||
Route::get('/pc/novel/:intNovelId', 'Novel/getNovelInfo')->ext('html')->append(['boolIsMobile' => false]);
|
||||
Route::get('/shu/:intNovelId', 'Novel/getNovelInfo')->ext('html')->append(['boolIsMobile' => true]);
|
||||
Route::get('/pc/shu/:intNovelId', 'Novel/getNovelInfo')->ext('html')->append(['boolIsMobile' => false]);
|
||||
Route::get('/kan/:intNovelId', 'Novel/getNovelInfo')->ext('html')->append(['boolIsMobile' => true]);
|
||||
Route::get('/pc/kan/:intNovelId', 'Novel/getNovelInfo')->ext('html')->append(['boolIsMobile' => false]);
|
||||
Route::get('/info/:intNovelId', [Novel::class, 'getNovelInfo'])->ext('html')->append(['boolIsMobile' => true]);
|
||||
Route::get('/pc/info/:intNovelId', [Novel::class, 'getNovelInfo'])->ext('html')->append(['boolIsMobile' => false]);
|
||||
Route::get('/novel/:intNovelId', [Novel::class, 'getNovelInfo'])->ext('html')->append(['boolIsMobile' => true]);
|
||||
Route::get('/pc/novel/:intNovelId', [Novel::class, 'getNovelInfo'])->ext('html')->append(['boolIsMobile' => false]);
|
||||
|
||||
// example
|
||||
// /book/{strPinYin}-{intNId}.html
|
||||
// /novel/{strPinYin}-{intNId}.html
|
||||
// /novel-{strPinYin}-{intNId}.html
|
||||
// /book-{strPinYin}-{intNId}.html
|
||||
Route::get('/pc/book/:name-:n_id', [Novel::class, 'getNovelInfo'])
|
||||
->append(['boolIsMobile' => false, 'intUriType' => 1])
|
||||
->pattern(['n_id' => '\d+','name' => '[\w-]+',])
|
||||
->ext('html');
|
||||
|
||||
Route::get('/pc/novel/:name-:n_id', [Novel::class, 'getNovelInfo'])
|
||||
->append(['boolIsMobile' => false, 'intUriType' => 2])
|
||||
->pattern(['n_id' => '\d+','name' => '[\w-]+',])
|
||||
->ext('html');
|
||||
|
||||
Route::get('/pc/novel-:name-:n_id', [Novel::class, 'getNovelInfo'])
|
||||
->append(['boolIsMobile' => false, 'intUriType' => 3])
|
||||
->pattern(['n_id' => '\d+','name' => '[\w-]+',])
|
||||
->ext('html');
|
||||
|
||||
Route::get('/pc/book-:name-:n_id', [Novel::class, 'getNovelInfo'])
|
||||
->append(['boolIsMobile' => false, 'intUriType' => 4])
|
||||
->pattern(['n_id' => '\d+','name' => '[\w-]+',])
|
||||
->ext('html');
|
||||
|
||||
|
||||
// 小说章节
|
||||
Route::get('chapter/:intNovelId-:intChapterId-[:intChapterPage]', 'Novel/getNovelChapter')->ext('html')->append(['boolIsMobile' => true]);
|
||||
|
||||
@@ -147,6 +147,33 @@ class Novel extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// 书架
|
||||
public function getBookShelf(Request $Request)
|
||||
{
|
||||
$boolIsMobile = $Request->param('boolIsMobile');
|
||||
|
||||
// 模拟数据
|
||||
$arrNewsNovel = [
|
||||
['id' => 1, 'name' => '小说1', 'author' => '作者1'],
|
||||
['id' => 2, 'name' => '小说2', 'author' => '作者2'],
|
||||
['id' => 3, 'name' => '小说3', 'author' => '作者3'],
|
||||
['id' => 4, 'name' => '小说3', 'author' => '作者3'],
|
||||
['id' => 5, 'name' => '小说3', 'author' => '作者3'],
|
||||
['id' => 6, 'name' => '小说3', 'author' => '作者3'],
|
||||
['id' => 7, 'name' => '小说3', 'author' => '作者3'],
|
||||
['id' => 8, 'name' => '小说3', 'author' => '作者3'],
|
||||
];
|
||||
|
||||
View::assign([
|
||||
'arrNewsNovel' => $arrNewsNovel,
|
||||
'strPageCode' => 'bookshelf'
|
||||
]);
|
||||
if ($boolIsMobile) {
|
||||
return View::fetch();
|
||||
} else {
|
||||
return View::fetch('pc/getBookShelf');
|
||||
}
|
||||
}
|
||||
|
||||
// 男生女生频道
|
||||
public function getNovelChannel(Request $Request)
|
||||
@@ -293,8 +320,12 @@ class Novel extends BaseController
|
||||
}
|
||||
|
||||
// 小说详情
|
||||
public function getNovelInfo(Request $Request,$intNovelId = 1)
|
||||
public function getNovelInfo(Request $Request)
|
||||
{
|
||||
$intNId = $Request->param('n_id');
|
||||
|
||||
|
||||
|
||||
$boolIsMobile = $Request->param('boolIsMobile');
|
||||
|
||||
// 模拟数据-随机推荐数据10条
|
||||
@@ -467,7 +498,4 @@ class Novel extends BaseController
|
||||
return View::fetch('pc/getArticleInfo');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -48,18 +48,24 @@
|
||||
<div class="area_head">
|
||||
<span class="log_line"></span>
|
||||
<h4><s class="book"></s>完本推荐</h4>
|
||||
|
||||
<!-- test code start -->
|
||||
<i>{site:grm domain="Request->DomainModel->d_domain" code="kuangyu-pc-index" line="50" diff="0"/}</i>
|
||||
<i>{site:wz wz="保存永久访问二维码" /}</i>
|
||||
<!-- test code end -->
|
||||
|
||||
<span class="log_line"></span>
|
||||
</div>
|
||||
<ul class="f2_list" mod="hot_tj">
|
||||
{foreach $arrRecommendEndNovel as $key=>$Novel}
|
||||
<li>
|
||||
<a href="/pc/novel/334.html" title="{$Novel->og_novel_book_name}" target="_blank" class="book_cov">
|
||||
<a href='/pc{site:nurl n_id="$Novel->n_id" n_py="$Novel->og_novel_pin_yin"/}' title="{$Novel->og_novel_book_name}" target="_blank" class="book_cov">
|
||||
<img class="lazyload_book_cover lazyload-img"
|
||||
src="/static/img/default.jpg" data-src="{$Novel->n_cover_path}"
|
||||
alt="{$Novel->og_novel_book_name}">
|
||||
</a>
|
||||
<div class="book_inf">
|
||||
<h3><a href="/pc/novel/334.html" title="{$Novel->og_novel_book_name}" target="_blank">{$Novel->og_novel_book_name}</a></h3>
|
||||
<h3><a href='/pc{site:nurl n_id="$Novel->n_id" n_py="$Novel->og_novel_pin_yin"/}' title="{$Novel->og_novel_book_name}" target="_blank">{$Novel->og_novel_book_name}</a></h3>
|
||||
<span class="aut">{$Novel->og_novel_author}</span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -27,4 +27,24 @@ class DomainModel extends BaseModel
|
||||
$strKey = "D:" . $strDomain;
|
||||
return Cache::delete($strKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $strWords
|
||||
* @return string
|
||||
*/
|
||||
static public function wordsEncode($strWords): string
|
||||
{
|
||||
$Request = request();
|
||||
$intEncode = $Request->DomainModel->d_content_encode;
|
||||
|
||||
if ($intEncode == 1) {
|
||||
$strWords = customEntities($strWords);
|
||||
}
|
||||
|
||||
return $strWords;
|
||||
}
|
||||
}
|
||||
|
||||
38
code/app/model/GanRaoMaModel.php
Normal file
38
code/app/model/GanRaoMaModel.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use DateTime;
|
||||
use Exception;
|
||||
use storage\StorageCore;
|
||||
use think\facade\Cache;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class GanRaoMaModel extends MongoModel
|
||||
{
|
||||
/**
|
||||
* Undocumented variable
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $strCollection = 'gan_rao_ma';
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $strDomain
|
||||
* @param string $strPageCode
|
||||
* @param int $intLine
|
||||
* @param string $strDifference
|
||||
* @return string
|
||||
*/
|
||||
static public function getGrmCode($strDomain, $strPageCode, $intLine, $strDifference): string
|
||||
{
|
||||
return (string)mt_rand(1, 100);
|
||||
}
|
||||
}
|
||||
@@ -326,4 +326,32 @@ class NovelModel extends MongoModel
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param int $intNId
|
||||
* @param string $intPinYin
|
||||
* @return string
|
||||
*/
|
||||
static public function getNovelInfoUrl($intNId, $intPinYin): string
|
||||
{
|
||||
$Request = request();
|
||||
$strFomart = $Request->DomainModel->d_novel_info_url_fomart;
|
||||
|
||||
return str_replace(
|
||||
[
|
||||
'{intNId}',
|
||||
'{strPinYin}',
|
||||
],
|
||||
[
|
||||
$intNId,
|
||||
$intPinYin
|
||||
],
|
||||
$strFomart
|
||||
);
|
||||
|
||||
return $strUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +22,17 @@ return [
|
||||
'taglib_begin' => '{',
|
||||
// 标签库标签结束标记
|
||||
'taglib_end' => '}',
|
||||
|
||||
|
||||
// 自定义标签
|
||||
'taglib_pre_load' => '\\template\\taglib\\Ad,\\template\\taglib\\Site,\\template\\taglib\\Rs',
|
||||
|
||||
// 模板渲染缓存
|
||||
'display_cache' => env('VIEW_DISPLAY_CACHE', false),
|
||||
|
||||
// 是否开启模板编译缓存,设为false则每次都会重新编译
|
||||
'tpl_cache' => env('VIEW_TPL_CACHE', true),
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,10 +66,16 @@ CREATE TABLE `domain` (
|
||||
`d_title` varchar(300) COLLATE utf8mb4_unicode_ci DEFAULT '',
|
||||
`d_keywords` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`d_description` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`d_statis` text COLLATE utf8mb4_unicode_ci COMMENT '单域名统计',
|
||||
`d_logo_type` tinyint(1) DEFAULT NULL,
|
||||
`d_text_log` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`d_img_log` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`d_novel_info_url_fomart` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`d_content_encode` tinyint unsigned DEFAULT '0',
|
||||
PRIMARY KEY (`d_id`),
|
||||
KEY `t_id` (`t_id`),
|
||||
KEY `d_domain` (`d_domain`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='域名表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='域名表';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@@ -163,12 +169,10 @@ CREATE TABLE `plan_task` (
|
||||
`pt_enable` tinyint unsigned NOT NULL DEFAULT '1',
|
||||
`pt_limit` int unsigned NOT NULL DEFAULT '0',
|
||||
`pt_last_exec` int unsigned NOT NULL DEFAULT '0',
|
||||
`site_id` int DEFAULT '1' COMMENT '站点ID',
|
||||
PRIMARY KEY (`pt_id`) USING BTREE,
|
||||
KEY `pt_code` (`pt_code`) USING BTREE,
|
||||
KEY `pt_enable` (`pt_enable`) USING BTREE,
|
||||
KEY `site_id` (`site_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
|
||||
KEY `pt_enable` (`pt_enable`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@@ -186,7 +190,7 @@ CREATE TABLE `system_config` (
|
||||
`site_id` int DEFAULT '1' COMMENT '站点ID',
|
||||
PRIMARY KEY (`sc_id`),
|
||||
KEY `site_id` (`site_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
@@ -232,4 +236,4 @@ CREATE TABLE `zi_yuan_duan_dian` (
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-03-18 22:53:36
|
||||
-- Dump completed on 2025-03-28 21:52:16
|
||||
|
||||
@@ -12,6 +12,8 @@ class Site extends TagLib
|
||||
'seotdk' => ['attr' => 'code,encode,valcode', 'close' => 0],
|
||||
'site' => ['attr' => 'code,encode,valcode', 'close' => 0],
|
||||
'wz' => ['attr' => 'wz', 'close' => 0],
|
||||
'nurl' => ['attr' => 'n_id', 'close' => 0],
|
||||
'grm' => ['attr' => 'domain,code,line,diff', 'close' => 0],
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -131,10 +133,55 @@ EOD;
|
||||
|
||||
$parse = <<<EOD
|
||||
<?php
|
||||
\$strCfgVal = \\template\\ziku\\WordsEntities::getWords("{$strWords}");
|
||||
echo \$strCfgVal;
|
||||
\$strEncodeWords = \\app\\model\\DomainModel::wordsEncode("{$strWords}");
|
||||
echo \$strEncodeWords;
|
||||
?>
|
||||
EOD;
|
||||
return $parse;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小说详情URL生成器
|
||||
*
|
||||
* @param array $n_id
|
||||
* @return string
|
||||
*/
|
||||
public function tagNUrl($tag)
|
||||
{
|
||||
$intNId = isset($tag['n_id']) ? $tag['n_id'] : '';
|
||||
$strNPy = isset($tag['n_py']) ? $tag['n_py'] : '';
|
||||
|
||||
$strParse = <<<EOD
|
||||
<?php
|
||||
\$strUrl = \\app\\model\\NovelModel::getNovelInfoUrl("{$intNId}","{$strNPy}");
|
||||
echo \$strUrl;
|
||||
?>
|
||||
EOD;
|
||||
return $strParse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 干扰码
|
||||
*
|
||||
* @param array $n_id
|
||||
* @return string
|
||||
*/
|
||||
public function tagGrm($tag)
|
||||
{
|
||||
$strDomain = isset($tag['domain']) ? $tag['domain'] : '';
|
||||
$strPageCode = isset($tag['code']) ? $tag['code'] : '';
|
||||
$intLine = isset($tag['line']) ? $tag['line'] : 0;
|
||||
$strDifference = isset($tag['diff']) ? $tag['diff'] : '';
|
||||
|
||||
$strParse = <<<EOD
|
||||
<?php
|
||||
\$strUrl = \\app\\model\\GanRaoMaModel::getGrmCode("{$strDomain}","{$strPageCode}","{$intLine}","{$strDifference}");
|
||||
echo \$strUrl;
|
||||
?>
|
||||
EOD;
|
||||
return $strParse;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user