小说伪造详情页面 代码优化
This commit is contained in:
@@ -279,14 +279,13 @@ $Novel.n_id{extend name="baseH5" /}
|
|||||||
$arrRandomForgeNovels = [];
|
$arrRandomForgeNovels = [];
|
||||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||||
if (count($forgeNovels) > 10) {
|
$count = count($forgeNovels);
|
||||||
$randomKeys = array_rand($forgeNovels, 10);
|
if ($count > 0) {
|
||||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||||
} else {
|
foreach ((array) $randomKeys as $key) {
|
||||||
$arrRandomForgeNovels = $forgeNovels;
|
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||||
shuffle($arrRandomForgeNovels);
|
}
|
||||||
}
|
}
|
||||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
|
||||||
}
|
}
|
||||||
{/php}
|
{/php}
|
||||||
|
|
||||||
|
|||||||
@@ -171,14 +171,13 @@
|
|||||||
$arrRandomForgeNovels = [];
|
$arrRandomForgeNovels = [];
|
||||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||||
if (count($forgeNovels) > 10) {
|
$count = count($forgeNovels);
|
||||||
$randomKeys = array_rand($forgeNovels, 10);
|
if ($count > 0) {
|
||||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||||
} else {
|
foreach ((array) $randomKeys as $key) {
|
||||||
$arrRandomForgeNovels = $forgeNovels;
|
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||||
shuffle($arrRandomForgeNovels);
|
}
|
||||||
}
|
}
|
||||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
|
||||||
}
|
}
|
||||||
{/php}
|
{/php}
|
||||||
|
|
||||||
|
|||||||
@@ -249,17 +249,15 @@
|
|||||||
$arrRandomForgeNovels = [];
|
$arrRandomForgeNovels = [];
|
||||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||||
if (count($forgeNovels) > 10) {
|
$count = count($forgeNovels);
|
||||||
$randomKeys = array_rand($forgeNovels, 10);
|
if ($count > 0) {
|
||||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||||
} else {
|
foreach ((array) $randomKeys as $key) {
|
||||||
$arrRandomForgeNovels = $forgeNovels;
|
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||||
shuffle($arrRandomForgeNovels);
|
}
|
||||||
}
|
}
|
||||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
|
||||||
}
|
}
|
||||||
{/php}
|
{/php}
|
||||||
|
|
||||||
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
{volist name='arrRandomForgeNovels' id='ForgeNovel' key="key"}
|
||||||
<a
|
<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>
|
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>
|
||||||
|
|||||||
@@ -144,14 +144,13 @@
|
|||||||
$arrRandomForgeNovels = [];
|
$arrRandomForgeNovels = [];
|
||||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||||
if (count($forgeNovels) > 10) {
|
$count = count($forgeNovels);
|
||||||
$randomKeys = array_rand($forgeNovels, 10);
|
if ($count > 0) {
|
||||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||||
} else {
|
foreach ((array) $randomKeys as $key) {
|
||||||
$arrRandomForgeNovels = $forgeNovels;
|
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||||
shuffle($arrRandomForgeNovels);
|
}
|
||||||
}
|
}
|
||||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
|
||||||
}
|
}
|
||||||
{/php}
|
{/php}
|
||||||
|
|
||||||
|
|||||||
@@ -223,14 +223,13 @@
|
|||||||
$arrRandomForgeNovels = [];
|
$arrRandomForgeNovels = [];
|
||||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||||
if (count($forgeNovels) > 10) {
|
$count = count($forgeNovels);
|
||||||
$randomKeys = array_rand($forgeNovels, 10);
|
if ($count > 0) {
|
||||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||||
} else {
|
foreach ((array) $randomKeys as $key) {
|
||||||
$arrRandomForgeNovels = $forgeNovels;
|
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||||
shuffle($arrRandomForgeNovels);
|
}
|
||||||
}
|
}
|
||||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
|
||||||
}
|
}
|
||||||
{/php}
|
{/php}
|
||||||
|
|
||||||
|
|||||||
@@ -258,14 +258,13 @@
|
|||||||
$arrRandomForgeNovels = [];
|
$arrRandomForgeNovels = [];
|
||||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||||
if (count($forgeNovels) > 10) {
|
$count = count($forgeNovels);
|
||||||
$randomKeys = array_rand($forgeNovels, 10);
|
if ($count > 0) {
|
||||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||||
} else {
|
foreach ((array) $randomKeys as $key) {
|
||||||
$arrRandomForgeNovels = $forgeNovels;
|
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||||
shuffle($arrRandomForgeNovels);
|
}
|
||||||
}
|
}
|
||||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
|
||||||
}
|
}
|
||||||
{/php}
|
{/php}
|
||||||
|
|
||||||
|
|||||||
@@ -247,7 +247,6 @@
|
|||||||
{$arrGrm[115]|raw}
|
{$arrGrm[115]|raw}
|
||||||
{/if}
|
{/if}
|
||||||
<div class="view-number">
|
<div class="view-number">
|
||||||
{if empty($Request.route.intForgeId)}
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="label">{site:wz wz="推荐等级" /}</div>
|
<div class="label">{site:wz wz="推荐等级" /}</div>
|
||||||
<div class="value">{$arrNovel.n_level}</div>
|
<div class="value">{$arrNovel.n_level}</div>
|
||||||
@@ -260,27 +259,6 @@
|
|||||||
<div class="label">{site:wz wz="在看人数" /}</div>
|
<div class="label">{site:wz wz="在看人数" /}</div>
|
||||||
<div class="value">{$arrNovel.arrNovelClicks.total}</div>
|
<div class="value">{$arrNovel.arrNovelClicks.total}</div>
|
||||||
</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>
|
||||||
|
|
||||||
<div class="detail-desc">
|
<div class="detail-desc">
|
||||||
@@ -312,7 +290,7 @@
|
|||||||
|
|
||||||
{else}
|
{else}
|
||||||
{novel:list count="10" n_category="$arrNovel.n_category_pinyin" sort_type="update"
|
{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"}
|
d_key="d_key" d_val="Novel" diff_key="$Request.route.intForgeId" cache_life="3600"}
|
||||||
<a
|
<a
|
||||||
href='{site:nurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}'>{$Novel.n_name}</a>
|
href='{site:nurl n_id="$Novel.n_id" n_py="$Novel.n_name_pinyin" /}'>{$Novel.n_name}</a>
|
||||||
{/novel:list}
|
{/novel:list}
|
||||||
@@ -321,14 +299,13 @@
|
|||||||
$arrRandomForgeNovels = [];
|
$arrRandomForgeNovels = [];
|
||||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||||
if (count($forgeNovels) > 10) {
|
$count = count($forgeNovels);
|
||||||
$randomKeys = array_rand($forgeNovels, 10);
|
if ($count > 0) {
|
||||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||||
} else {
|
foreach ((array) $randomKeys as $key) {
|
||||||
$arrRandomForgeNovels = $forgeNovels;
|
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||||
shuffle($arrRandomForgeNovels);
|
}
|
||||||
}
|
}
|
||||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
|
||||||
}
|
}
|
||||||
{/php}
|
{/php}
|
||||||
{/if}
|
{/if}
|
||||||
@@ -365,7 +342,7 @@
|
|||||||
{else}
|
{else}
|
||||||
<div class="work-list">
|
<div class="work-list">
|
||||||
{novel:list count="32" n_category="$arrNovel.n_category_pinyin" sort_type="update" d_key="d_key"
|
{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"/}
|
{include file="public/novel-list-flex" start="16"/}
|
||||||
{/novel:list}
|
{/novel:list}
|
||||||
</div>
|
</div>
|
||||||
@@ -374,7 +351,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<div class="work-list">
|
<div class="work-list">
|
||||||
{novel:ranklist count="32" sort_type="daily" d_key="d_key"
|
{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"/}
|
{include file="public/novel-list-flex" start="16"/}
|
||||||
{/novel:ranklist}
|
{/novel:ranklist}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -203,14 +203,13 @@
|
|||||||
$arrRandomForgeNovels = [];
|
$arrRandomForgeNovels = [];
|
||||||
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
if (isset($arrNovel['n_forge_novel']) && is_array($arrNovel['n_forge_novel'])) {
|
||||||
$forgeNovels = $arrNovel['n_forge_novel'];
|
$forgeNovels = $arrNovel['n_forge_novel'];
|
||||||
if (count($forgeNovels) > 10) {
|
$count = count($forgeNovels);
|
||||||
$randomKeys = array_rand($forgeNovels, 10);
|
if ($count > 0) {
|
||||||
$arrRandomForgeNovels = array_intersect_key($forgeNovels, array_flip($randomKeys));
|
$randomKeys = array_rand($forgeNovels, min(10, $count));
|
||||||
} else {
|
foreach ((array) $randomKeys as $key) {
|
||||||
$arrRandomForgeNovels = $forgeNovels;
|
$arrRandomForgeNovels[] = $forgeNovels[$key];
|
||||||
shuffle($arrRandomForgeNovels);
|
}
|
||||||
}
|
}
|
||||||
$arrRandomForgeNovels = array_values($arrRandomForgeNovels);
|
|
||||||
}
|
}
|
||||||
{/php}
|
{/php}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user