小说伪造详情页面 代码优化
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])}
|
||||
|
||||
Reference in New Issue
Block a user