diff --git a/application/index/view/default/index/index.html b/application/index/view/default/index/index.html index 6851215b7..28d841811 100755 --- a/application/index/view/default/index/index.html +++ b/application/index/view/default/index/index.html @@ -139,40 +139,80 @@ {{if !empty($goods_floor_list)}} {{foreach $goods_floor_list as $key=>$floor}} - {{if isset($floor['is_home_recommended']) and $floor['is_home_recommended'] eq 1}} -
-
-
-

{{$floor.name}}

-

{{$floor.vice_name}}

-
- {{if !empty($floor['items'])}} - {{foreach $floor.items as $key=>$category}} - {{if !empty($category['items'])}} - {{foreach $category.items as $keys=>$categorys}} - {{if $key lt 6 and $keys eq 0 and isset($categorys['is_home_recommended']) and $categorys['is_home_recommended'] eq 1}} - {{$categorys.name}} - {{/if}} - {{/foreach}} - {{/if}} - {{/foreach}} - {{/if}} -
- - 更多 - +
+
+
+

{{$floor.name}}

+

{{$floor.vice_name}}

+
+ {{if !empty($floor['items'])}} + {{foreach $floor.items as $key=>$category}} + {{if !empty($category['items'])}} + {{foreach $category.items as $keys=>$categorys}} + {{if $key lt 6 and $keys eq 0}} + {{$categorys.name}} + {{/if}} + {{/foreach}} + {{/if}} + {{/foreach}} + {{/if}}
+ + 更多 +
- -
- +
+ +
+ + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ plugins_view_home_floor_inside_top +
+ {{/if}} + {{php}} + $hook_name = 'plugins_view_home_floor_inside_top'; + $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'floor'=>$floor]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } + {{/php}} + +
+
+ {{if !empty($floor['items'])}} + {{foreach $floor.items as $category_key=>$category}} + {{if $category_key lt 6}} + {{:mb_substr($category['name'], 0, 4, 'utf-8')}} + {{/if}} + {{/foreach}} + {{/if}} +
+
+
{{$floor.describe}}
+
+ {{if !empty($floor['big_images'])}} + + + + {{/if}} +
+ + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
- plugins_view_home_floor_inside_top + plugins_view_home_aggregation_inside_bottom
{{/if}} {{php}} - $hook_name = 'plugins_view_home_floor_inside_top'; + $hook_name = 'plugins_view_home_aggregation_inside_bottom'; $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'floor'=>$floor]); if(!empty($hook_data) && is_array($hook_data)) { @@ -185,112 +225,21 @@ } } {{/php}} +
-
-
- {{if !empty($floor['items'])}} - {{foreach $floor.items as $category_key=>$category}} - {{if $category_key lt 6 and isset($category['is_home_recommended']) and $category['is_home_recommended'] eq 1}} - {{:mb_substr($category['name'], 0, 4, 'utf-8')}} - {{/if}} - {{/foreach}} - {{/if}} -
-
-
{{$floor.describe}}
-
- {{if !empty($floor['big_images'])}} - - - - {{/if}} -
- - - {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} -
- plugins_view_home_aggregation_inside_bottom -
- {{/if}} - {{php}} - $hook_name = 'plugins_view_home_aggregation_inside_bottom'; - $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'floor'=>$floor]); - if(!empty($hook_data) && is_array($hook_data)) - { - foreach($hook_data as $hook) - { - if(is_string($hook) || is_int($hook)) - { - echo htmlspecialchars_decode($hook); - } - } - } - {{/php}} -
- -
- {{if !empty($floor['goods'])}} - {{foreach $floor.goods as $goods_key=>$goods}} -
- - - {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} -
- plugins_view_home_goods_inside_top -
- {{/if}} - {{php}} - $hook_name = 'plugins_view_home_goods_inside_top'; - $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'goods_id'=>$goods['id'], 'goods'=>$goods]); - if(!empty($hook_data) && is_array($hook_data)) - { - foreach($hook_data as $hook) - { - if(is_string($hook) || is_int($hook)) - { - echo htmlspecialchars_decode($hook); - } - } - } - {{/php}} - {{$goods.title}} -
-
- - - - {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} -
- plugins_view_home_goods_inside_price_top -
- {{/if}} - {{php}} - $hook_name = 'plugins_view_home_goods_inside_price_top'; - $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'goods_id'=>$goods['id'], 'goods'=>$goods]); - if(!empty($hook_data) && is_array($hook_data)) - { - foreach($hook_data as $hook) - { - if(is_string($hook) || is_int($hook)) - { - echo htmlspecialchars_decode($hook); - } - } - } - {{/php}} -

{{$price_symbol}}{{$goods.price}}

-
- - + + {{$goods.title}} + +
+ - - {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} -
- plugins_view_home_floor_inside_bottom -
+ + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ plugins_view_home_goods_inside_price_top +
+ {{/if}} + {{php}} + $hook_name = 'plugins_view_home_goods_inside_price_top'; + $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'goods_id'=>$goods['id'], 'goods'=>$goods]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } + {{/php}} +

{{$price_symbol}}{{$goods.price}}

+
+ + + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ plugins_view_home_goods_inside_bottom +
+ {{/if}} + {{php}} + $hook_name = 'plugins_view_home_goods_inside_bottom'; + $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'goods_id'=>$goods['id'], 'goods'=>$goods]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } + {{/php}} +
+ {{/foreach}} {{/if}} - {{php}} - $hook_name = 'plugins_view_home_floor_inside_bottom'; - $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'floor'=>$floor]); - if(!empty($hook_data) && is_array($hook_data)) +
+ + + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ plugins_view_home_floor_inside_bottom +
+ {{/if}} + {{php}} + $hook_name = 'plugins_view_home_floor_inside_bottom'; + $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'floor'=>$floor]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) { - foreach($hook_data as $hook) + if(is_string($hook) || is_int($hook)) { - if(is_string($hook) || is_int($hook)) - { - echo htmlspecialchars_decode($hook); - } + echo htmlspecialchars_decode($hook); } } - {{/php}} -
+ } + {{/php}}
- {{/if}} +
{{/foreach}} {{/if}}
diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php index 76272882d..e279a7461 100755 --- a/application/service/GoodsService.php +++ b/application/service/GoodsService.php @@ -60,8 +60,7 @@ class GoodsService // 从缓存获取 $key = config('shopxo.cache_goods_category_key'); $data = cache($key); - - if(empty($data)) + if(empty($data) || config('app_debug')) { // 获取分类 $params['where'] = ['pid'=>0, 'is_enable'=>1]; @@ -97,12 +96,12 @@ class GoodsService { // 一次性查出所有二级下的三级、再做归类、避免sql连接超多 $where['pid'] = array_column($v['items'], 'id'); - $items = self::GoodsCategoryList($where); - if(!empty($items)) + $itemss = self::GoodsCategoryList($where); + if(!empty($itemss)) { foreach($v['items'] as &$vs) { - foreach($items as $vss) + foreach($itemss as $vss) { if($vs['id'] == $vss['pid']) { @@ -183,13 +182,42 @@ class GoodsService // 缓存 $key = config('shopxo.cache_goods_floor_list_key'); $data = cache($key); - if(empty($data)) + if(empty($data) || config('app_debug')) { // 商品大分类 - $params['where'] = ['pid'=>0, 'is_home_recommended'=>1, 'is_enable'=>1]; - $data = self::GoodsCategory($params); + $where = ['pid'=>0, 'is_home_recommended'=>1, 'is_enable'=>1]; + $data = self::GoodsCategoryList($where); if(!empty($data)) { + $level = MyC('common_show_goods_category_level', 3, true); + if($level > 1) + { + foreach($data as &$c) + { + $where['pid'] = $c['id']; + $c['items'] = self::GoodsCategoryList($where); + if(!empty($c['items']) && $level > 2) + { + // 一次性查出所有二级下的三级、再做归类、避免sql连接超多 + $where['pid'] = array_column($c['items'], 'id'); + $itemss = self::GoodsCategoryList($where); + if(!empty($itemss)) + { + foreach($c['items'] as &$cv) + { + foreach($itemss as $cvv) + { + if($cv['id'] == $cvv['pid']) + { + $cv['items'][] = $cvv; + } + } + } + } + } + } + } + // 根据分类获取楼层商品 foreach($data as &$v) { diff --git a/sourcecode/alipay/pages/index/index.axml b/sourcecode/alipay/pages/index/index.axml index 115b8b7ea..060c576e4 100644 --- a/sourcecode/alipay/pages/index/index.axml +++ b/sourcecode/alipay/pages/index/index.axml @@ -35,7 +35,7 @@ - + {{icv.name}} diff --git a/sourcecode/baidu/pages/index/index.swan b/sourcecode/baidu/pages/index/index.swan index b30601b3a..7c979f64c 100755 --- a/sourcecode/baidu/pages/index/index.swan +++ b/sourcecode/baidu/pages/index/index.swan @@ -35,7 +35,7 @@ - + {{icv.name}} diff --git a/sourcecode/qq/pages/index/index.qml b/sourcecode/qq/pages/index/index.qml index 915585f56..8c8714a96 100755 --- a/sourcecode/qq/pages/index/index.qml +++ b/sourcecode/qq/pages/index/index.qml @@ -35,7 +35,7 @@ - + {{icv.name}} diff --git a/sourcecode/toutiao/pages/index/index.ttml b/sourcecode/toutiao/pages/index/index.ttml index 278e42555..653fb4b30 100755 --- a/sourcecode/toutiao/pages/index/index.ttml +++ b/sourcecode/toutiao/pages/index/index.ttml @@ -38,7 +38,7 @@ - + {{icv.name}} diff --git a/sourcecode/weixin/pages/index/index.wxml b/sourcecode/weixin/pages/index/index.wxml index db7ffbc23..47cad2c6d 100755 --- a/sourcecode/weixin/pages/index/index.wxml +++ b/sourcecode/weixin/pages/index/index.wxml @@ -35,7 +35,7 @@ - + {{icv.name}}