refactor: 修改array_flatten函数相关
This commit is contained in:
@@ -104,6 +104,18 @@ if (!function_exists('array_to_tree')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('array_flatten')) {
|
||||||
|
/**
|
||||||
|
* 将多维数组转换为一维数组
|
||||||
|
* @param array $array
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function array_flatten(array $array, int $depth = 1): array
|
||||||
|
{
|
||||||
|
return \think\helper\Arr::flatten($array, $depth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!function_exists('thumb')) {
|
if (!function_exists('thumb')) {
|
||||||
/**
|
/**
|
||||||
* 获取缩略图
|
* 获取缩略图
|
||||||
|
|||||||
@@ -111,15 +111,3 @@ if (!function_exists('lang_i18n')) {
|
|||||||
return Lang::get($lang_key, $vars, $lang);
|
return Lang::get($lang_key, $vars, $lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('array_flatten')) {
|
|
||||||
/**
|
|
||||||
* 将多维数组转换为一维数组
|
|
||||||
* @param array $array
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function array_flatten(array $array, int $depth = 1): array
|
|
||||||
{
|
|
||||||
return \think\helper\Arr::flatten($array, $depth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<div class="iotb_part2 iotb_part22">
|
<div class="iotb_part2 iotb_part22">
|
||||||
<h1 class="iotbt1">{:lang_i18n('为您提供专属定制服务')}</h1>
|
<h1 class="iotbt1">{:lang_i18n('为您提供专属定制服务')}</h1>
|
||||||
<div class="fdimgs wcu_list">
|
<div class="fdimgs wcu_list">
|
||||||
{assign name="flat_service" value=":\think\helper\Arr::flatMap(fn($item) => $item, $service)" /}
|
{assign name="flat_service" value=":array_flatten($service)" /}
|
||||||
{volist name="flat_service" id="fs"}
|
{volist name="flat_service" id="fs"}
|
||||||
<div class="wcu_ltem">
|
<div class="wcu_ltem">
|
||||||
<img src="{$fs.image}" alt="" class="fbit">
|
<img src="{$fs.image}" alt="" class="fbit">
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<div class="iotb_part2">
|
<div class="iotb_part2">
|
||||||
<h1 class="iotbt1">{:lang_i18n('对于不同的情况')}</h1>
|
<h1 class="iotbt1">{:lang_i18n('对于不同的情况')}</h1>
|
||||||
<div class="fdimgs wcu_list">
|
<div class="fdimgs wcu_list">
|
||||||
{assign name="flat_difference" value=":\think\helper\Arr::flatMap(fn($item) => $item, $difference)" /}
|
{assign name="flat_difference" value=":array_flatten($difference)" /}
|
||||||
{volist name="flat_difference" id="di"}
|
{volist name="flat_difference" id="di"}
|
||||||
<div class="wcu_ltem">
|
<div class="wcu_ltem">
|
||||||
<img src="{$di.image}" alt="" class="fbit">
|
<img src="{$di.image}" alt="" class="fbit">
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="infolist">
|
<div class="infolist">
|
||||||
{notempty name="videos"}
|
{notempty name="videos"}
|
||||||
{assign name="flat_videos" value=":\think\helper\Arr::flatMap(fn($item) => $item->toArray(), $videos->items())" /}
|
{assign name="flat_videos" value=":array_flatten($videos->items())" /}
|
||||||
{volist name="flat_videos" id="vo"}
|
{volist name="flat_videos" id="vo"}
|
||||||
<div class="vd-item">
|
<div class="vd-item">
|
||||||
<video controls="" poster="{$vo.image|default=''}">
|
<video controls="" poster="{$vo.image|default=''}">
|
||||||
|
|||||||
Reference in New Issue
Block a user