小说伪造详情页面 代码优化
This commit is contained in:
@@ -276,19 +276,18 @@ $Novel.n_id{extend name="baseH5" /}
|
||||
{/volist}
|
||||
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
if (count($forgeNovels) > 10) {
|
||||
$randomKeys = array_rand($forgeNovels, 10);
|
||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
||||
} else {
|
||||
$arrRandomForgeNovels = $forgeNovels;
|
||||
shuffle($arrRandomForgeNovels);
|
||||
}
|
||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
||||
}
|
||||
{/php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
$count = count($forgeNovels);
|
||||
if ($count > 0) {
|
||||
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||
foreach ((array) $randomKeys as $key) {
|
||||
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
{/php}
|
||||
|
||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||
<a
|
||||
|
||||
@@ -168,19 +168,18 @@
|
||||
|
||||
<p>相邻推荐:
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
if (count($forgeNovels) > 10) {
|
||||
$randomKeys = array_rand($forgeNovels, 10);
|
||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
||||
} else {
|
||||
$arrRandomForgeNovels = $forgeNovels;
|
||||
shuffle($arrRandomForgeNovels);
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
$count = count($forgeNovels);
|
||||
if ($count > 0) {
|
||||
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||
foreach ((array) $randomKeys as $key) {
|
||||
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||
}
|
||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
||||
}
|
||||
{/php}
|
||||
}
|
||||
}
|
||||
{/php}
|
||||
|
||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||
{if !empty($arrGrm[$key+20])}
|
||||
|
||||
@@ -246,20 +246,18 @@
|
||||
<div class="listtop">
|
||||
<b>书友推荐:</b>
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
if (count($forgeNovels) > 10) {
|
||||
$randomKeys = array_rand($forgeNovels, 10);
|
||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
||||
} else {
|
||||
$arrRandomForgeNovels = $forgeNovels;
|
||||
shuffle($arrRandomForgeNovels);
|
||||
}
|
||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
||||
}
|
||||
{/php}
|
||||
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
$count = count($forgeNovels);
|
||||
if ($count > 0) {
|
||||
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||
foreach ((array) $randomKeys as $key) {
|
||||
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
{/php}
|
||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||
<a
|
||||
href='{site:nnurl n_id="$arrNovel.n_id" n_py="$arrNovel.n_name_pinyin" n_fid="$ForgeNovel.n_forge_id"/}'>{$ForgeNovel.n_forge_title}</a>
|
||||
|
||||
@@ -141,19 +141,18 @@
|
||||
<div id="intro">
|
||||
{$arrNovel.n_description ?? ''}<br />
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
if (count($forgeNovels) > 10) {
|
||||
$randomKeys = array_rand($forgeNovels, 10);
|
||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
||||
} else {
|
||||
$arrRandomForgeNovels = $forgeNovels;
|
||||
shuffle($arrRandomForgeNovels);
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
$count = count($forgeNovels);
|
||||
if ($count > 0) {
|
||||
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||
foreach ((array) $randomKeys as $key) {
|
||||
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||
}
|
||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
||||
}
|
||||
{/php}
|
||||
}
|
||||
}
|
||||
{/php}
|
||||
|
||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||
<a
|
||||
|
||||
@@ -220,19 +220,18 @@
|
||||
</p>
|
||||
<p class="xianglingtuijian">相邻推荐:
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
if (count($forgeNovels) > 10) {
|
||||
$randomKeys = array_rand($forgeNovels, 10);
|
||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
||||
} else {
|
||||
$arrRandomForgeNovels = $forgeNovels;
|
||||
shuffle($arrRandomForgeNovels);
|
||||
$count = count($forgeNovels);
|
||||
if ($count > 0) {
|
||||
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||
foreach ((array) $randomKeys as $key) {
|
||||
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||
}
|
||||
}
|
||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
||||
}
|
||||
{/php}
|
||||
}
|
||||
{/php}
|
||||
|
||||
|
||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||
|
||||
@@ -257,17 +257,16 @@
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
if (count($forgeNovels) > 10) {
|
||||
$randomKeys = array_rand($forgeNovels, 10);
|
||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
||||
} else {
|
||||
$arrRandomForgeNovels = $forgeNovels;
|
||||
shuffle($arrRandomForgeNovels);
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
$count = count($forgeNovels);
|
||||
if ($count > 0) {
|
||||
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||
foreach ((array) $randomKeys as $key) {
|
||||
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
||||
}
|
||||
{/php}
|
||||
{/php}
|
||||
|
||||
|
||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||
|
||||
@@ -247,7 +247,6 @@
|
||||
{$arrGrm[115]|raw}
|
||||
{/if}
|
||||
<div class="view-number">
|
||||
{if empty($Request.route.intForgeId)}
|
||||
<div class="item">
|
||||
<div class="label">{site:wz wz="推荐等级" /}</div>
|
||||
<div class="value">{$arrNovel.n_level}</div>
|
||||
@@ -260,27 +259,6 @@
|
||||
<div class="label">{site:wz wz="在看人数" /}</div>
|
||||
<div class="value">{$arrNovel.arrNovelClicks.total}</div>
|
||||
</div>
|
||||
{else}
|
||||
{php}
|
||||
$min = 1; // 最小值(可根据需要调整)
|
||||
$max = 10000; // 最大值(可根据需要调整)
|
||||
$randomNumberR = mt_rand($min, 10); // 生成随机整数
|
||||
$randomNumberS = mt_rand($min, $max); // 生成随机整数
|
||||
$randomNumberK = mt_rand($min, $max); // 生成随机整数
|
||||
{/php}
|
||||
<div class="item">
|
||||
<div class="label">{site:wz wz="推荐等级" /}</div>
|
||||
<div class="value">{$randomNumberR}</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="label">{site:wz wz="收藏数" /}</div>
|
||||
<div class="value">{$randomNumberS}</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="label">{site:wz wz="在看人数" /}</div>
|
||||
<div class="value">{$randomNumberK}</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="detail-desc">
|
||||
@@ -296,41 +274,40 @@
|
||||
<span class="value">
|
||||
<span class="value-tag">
|
||||
{if empty($Request.route.intForgeId)}
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$arrRandomForgeNovels = $arrNovel['n_forge_novel'];
|
||||
}
|
||||
{/php}
|
||||
{volist name='$arrNovel.arrRelateveNovel' id='Novel' key="key"}
|
||||
{if !empty($arrGrm[$key + 24])}
|
||||
{$arrGrm[$key+24]|raw}
|
||||
{/if}
|
||||
<a
|
||||
href='{site:nurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}'>{$Novel.n_name}</a>
|
||||
{/volist}
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$arrRandomForgeNovels = $arrNovel['n_forge_novel'];
|
||||
}
|
||||
{/php}
|
||||
{volist name='$arrNovel.arrRelateveNovel' id='Novel' key="key"}
|
||||
{if !empty($arrGrm[$key + 24])}
|
||||
{$arrGrm[$key+24]|raw}
|
||||
{/if}
|
||||
<a
|
||||
href='{site:nurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}'>{$Novel.n_name}</a>
|
||||
{/volist}
|
||||
|
||||
{else}
|
||||
{novel:list count="10" n_category="$arrNovel.n_category_pinyin" sort_type="update"
|
||||
d_key="d_key" d_val="Novel" diff_key="$Request.route.intForgeId" cache_life="1000"}
|
||||
<a
|
||||
href='{site:nurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}'>{$Novel.n_name}</a>
|
||||
{/novel:list}
|
||||
{novel:list count="10" n_category="$arrNovel.n_category_pinyin" sort_type="update"
|
||||
d_key="d_key" d_val="Novel" diff_key="$Request.route.intForgeId" cache_life="3600"}
|
||||
<a
|
||||
href='{site:nurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}'>{$Novel.n_name}</a>
|
||||
{/novel:list}
|
||||
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
if (count($forgeNovels) > 10) {
|
||||
$randomKeys = array_rand($forgeNovels, 10);
|
||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
||||
} else {
|
||||
$arrRandomForgeNovels = $forgeNovels;
|
||||
shuffle($arrRandomForgeNovels);
|
||||
}
|
||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
||||
}
|
||||
{/php}
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
$count = count($forgeNovels);
|
||||
if ($count > 0) {
|
||||
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||
foreach ((array) $randomKeys as $key) {
|
||||
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
{/php}
|
||||
{/if}
|
||||
|
||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||
@@ -365,7 +342,7 @@
|
||||
{else}
|
||||
<div class="work-list">
|
||||
{novel:list count="32" n_category="$arrNovel.n_category_pinyin" sort_type="update" d_key="d_key"
|
||||
d_val="Novel" diff_key="$Request.route.intForgeId" cache_life="600"}
|
||||
d_val="Novel" diff_key="$Request.route.intForgeId" cache_life="3600"}
|
||||
{include file="public/novel-list-flex" start="16"/}
|
||||
{/novel:list}
|
||||
</div>
|
||||
@@ -374,7 +351,7 @@
|
||||
{/if}
|
||||
<div class="work-list">
|
||||
{novel:ranklist count="32" sort_type="daily" d_key="d_key"
|
||||
d_val="Novel" diff_key="$Request.route.intForgeId" cache_life="600"}
|
||||
d_val="Novel" diff_key="$Request.route.intForgeId" cache_life="3600"}
|
||||
{include file="public/novel-list-flex" start="16"/}
|
||||
{/novel:ranklist}
|
||||
</div>
|
||||
|
||||
@@ -202,17 +202,16 @@
|
||||
{php}
|
||||
$arrRandomForgeNovels = [];
|
||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
if (count($forgeNovels) > 10) {
|
||||
$randomKeys = array_rand($forgeNovels, 10);
|
||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
||||
} else {
|
||||
$arrRandomForgeNovels = $forgeNovels;
|
||||
shuffle($arrRandomForgeNovels);
|
||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||
$count = count($forgeNovels);
|
||||
if ($count > 0) {
|
||||
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||
foreach ((array) $randomKeys as $key) {
|
||||
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
||||
}
|
||||
{/php}
|
||||
{/php}
|
||||
|
||||
|
||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||
|
||||
Reference in New Issue
Block a user