diff --git a/application/api/controller/Region.php b/application/api/controller/Region.php
index 9fb2b50ef..bb6d4c4cd 100755
--- a/application/api/controller/Region.php
+++ b/application/api/controller/Region.php
@@ -35,11 +35,12 @@ class Region extends Common
}
/**
- * [Index 获取地区]
- * @author Devil
- * @blog http://gong.gg/
- * @version 1.0.0
- * @datetime 2018-04-08T15:08:01+0800
+ * 获取地区节点
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2020-12-29
+ * @desc description
*/
public function Index()
{
@@ -52,5 +53,18 @@ class Region extends Common
$data = RegionService::RegionNode($params);
return DataReturn('success', 0, $data);
}
+
+ /**
+ * 获取地区所有数据
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2020-12-29
+ * @desc description
+ */
+ public function All()
+ {
+ return RegionService::RegionAll();
+ }
}
?>
\ No newline at end of file
diff --git a/application/index/controller/Region.php b/application/index/controller/Region.php
index 5ef3ab3e4..69afca73b 100755
--- a/application/index/controller/Region.php
+++ b/application/index/controller/Region.php
@@ -35,7 +35,7 @@ class Region extends Common
}
/**
- * 获取地区
+ * 获取地区节点
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
@@ -59,5 +59,18 @@ class Region extends Common
$data = RegionService::RegionNode($params);
return DataReturn('操作成功', 0, $data);
}
+
+ /**
+ * 获取地区所有数据
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2020-12-29
+ * @desc description
+ */
+ public function All()
+ {
+ return RegionService::RegionAll();
+ }
}
?>
\ No newline at end of file
diff --git a/application/index/view/default/index/index.html b/application/index/view/default/index/index.html
index 85aea9ff3..7e4f84a68 100755
--- a/application/index/view/default/index/index.html
+++ b/application/index/view/default/index/index.html
@@ -22,20 +22,7 @@
- {{if !empty($navigation)}}
-
- {{foreach $navigation as $nav}}
-
- {{/foreach}}
-
- {{/if}}
+ {{include file="public/home_nav" /}}
{{if MyC('home_index_banner_right_status', 1) eq 1}}
diff --git a/application/index/view/default/public/home_banner.html b/application/index/view/default/public/home_banner.html
index 61e5bd6ac..8af2e3db9 100755
--- a/application/index/view/default/public/home_banner.html
+++ b/application/index/view/default/public/home_banner.html
@@ -1,4 +1,3 @@
-
@@ -25,5 +24,4 @@
{{/if}}
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/application/index/view/default/public/home_nav.html b/application/index/view/default/public/home_nav.html
new file mode 100644
index 000000000..60bcd90fd
--- /dev/null
+++ b/application/index/view/default/public/home_nav.html
@@ -0,0 +1,26 @@
+{{if !empty($navigation)}}
+
+ {{foreach $navigation as $nav}}
+
+ {{/foreach}}
+
+{{/if}}
\ No newline at end of file
diff --git a/application/service/AppHomeNavService.php b/application/service/AppHomeNavService.php
index ff726493b..43765f797 100755
--- a/application/service/AppHomeNavService.php
+++ b/application/service/AppHomeNavService.php
@@ -287,9 +287,23 @@ class AppHomeNavService
{
foreach($data as &$v)
{
+ // 图片地址
$v['images_url_old'] = $v['images_url'];
$v['images_url'] = ResourcesService::AttachmentPathViewHandle($v['images_url']);
$v['event_value'] = empty($v['event_value']) ? null : $v['event_value'];
+
+ // 事件值
+ if(!empty($v['event_value']))
+ {
+ // 地图
+ if($v['event_type'] == 3)
+ {
+ $v['event_value_data'] = explode('|', $v['event_value']);
+ }
+ $v['event_value'] = $v['event_value'];
+ } else {
+ $v['event_value'] = null;
+ }
}
}
diff --git a/application/service/RegionService.php b/application/service/RegionService.php
index bf8942e65..fd2d53f85 100755
--- a/application/service/RegionService.php
+++ b/application/service/RegionService.php
@@ -225,5 +225,81 @@ class RegionService
$data = empty($data) ? $ids : array_unique(array_merge($ids, $data));
return $data;
}
+
+ /**
+ * 获取地区所有数据、最多三级
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2020-12-29
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function RegionAll($params = [])
+ {
+ // 缓存
+ $key = config('shopxo.cache_region_all_key');
+ $data = cache($key);
+ if(empty($data))
+ {
+ // 所有一级
+ $field = 'id,pid,name';
+ $data = self::RegionNode(['field'=>$field,'where'=>['pid'=>0]]);
+ if(!empty($data))
+ {
+ // 所有二级
+ $two = self::RegionNode(['field'=>$field,'where'=>['pid'=>array_column($data, 'id')]]);
+ $two_group = [];
+ $three_group = [];
+ if(!empty($two))
+ {
+ // 所有三级
+ $three = self::RegionNode(['field'=>$field,'where'=>['pid'=>array_column($two, 'id')]]);
+ if(!empty($three))
+ {
+ // 三级集合组
+ foreach($three as $v)
+ {
+ if(!array_key_exists($v['pid'], $three_group))
+ {
+ $three_group[$v['pid']] = [];
+ }
+ $pid = $v['pid'];
+ unset($v['pid']);
+ $three_group[$pid][] = $v;
+ }
+ }
+
+ // 二级集合
+ foreach($two as $v)
+ {
+ // 是否存在三级数据
+ $v['items'] = array_key_exists($v['id'], $three_group) ? $three_group[$v['id']] : [];
+
+
+ // 集合组
+ if(!array_key_exists($v['pid'], $two_group))
+ {
+ $two_group[$v['pid']] = [];
+ }
+ $pid = $v['pid'];
+ unset($v['pid']);
+ $two_group[$pid][] = $v;
+ }
+ }
+
+ // 一级集合
+ foreach($data as $k=>$v)
+ {
+ $data[$k]['items'] = array_key_exists($v['id'], $two_group) ? $two_group[$v['id']] : [];
+ }
+
+ // 存储缓存
+ cache($key, $data, 60);
+ }
+ }
+
+ return DataReturn('success', 0, $data);
+ }
}
?>
\ No newline at end of file
diff --git a/application/tags.php b/application/tags.php
index 4b1696f3a..c3090187e 100755
--- a/application/tags.php
+++ b/application/tags.php
@@ -34,19 +34,68 @@ return array (
),
'plugins_css' =>
array (
- 0 => 'app\\plugins\\points\\Hook',
- 1 => 'app\\plugins\\limitedtimediscount\\Hook',
+ 0 => 'app\\plugins\\share\\Hook',
+ 1 => 'app\\plugins\\points\\Hook',
+ 2 => 'app\\plugins\\limitedtimediscount\\Hook',
),
'plugins_js' =>
array (
- 0 => 'app\\plugins\\points\\Hook',
- 1 => 'app\\plugins\\limitedtimediscount\\Hook',
+ 0 => 'app\\plugins\\share\\Hook',
+ 1 => 'app\\plugins\\points\\Hook',
+ 2 => 'app\\plugins\\limitedtimediscount\\Hook',
+ ),
+ 'plugins_view_common_bottom' =>
+ array (
+ 0 => 'app\\plugins\\share\\Hook',
+ ),
+ 'plugins_common_page_bottom' =>
+ array (
+ 0 => 'app\\plugins\\share\\Hook',
+ ),
+ 'plugins_view_goods_detail_photo_bottom' =>
+ array (
+ 0 => 'app\\plugins\\share\\Hook',
),
'plugins_service_navigation_header_handle' =>
array (
0 => 'app\\plugins\\points\\Hook',
1 => 'app\\plugins\\limitedtimediscount\\Hook',
),
+ 'plugins_service_quick_navigation_pc' =>
+ array (
+ 0 => 'app\\plugins\\points\\Hook',
+ 1 => 'app\\plugins\\signin\\Hook',
+ ),
+ 'plugins_service_quick_navigation_h5' =>
+ array (
+ 0 => 'app\\plugins\\points\\Hook',
+ 1 => 'app\\plugins\\signin\\Hook',
+ ),
+ 'plugins_service_quick_navigation_weixin' =>
+ array (
+ 0 => 'app\\plugins\\points\\Hook',
+ 1 => 'app\\plugins\\signin\\Hook',
+ ),
+ 'plugins_service_quick_navigation_alipay' =>
+ array (
+ 0 => 'app\\plugins\\points\\Hook',
+ 1 => 'app\\plugins\\signin\\Hook',
+ ),
+ 'plugins_service_quick_navigation_baidu' =>
+ array (
+ 0 => 'app\\plugins\\points\\Hook',
+ 1 => 'app\\plugins\\signin\\Hook',
+ ),
+ 'plugins_service_quick_navigation_qq' =>
+ array (
+ 0 => 'app\\plugins\\points\\Hook',
+ 1 => 'app\\plugins\\signin\\Hook',
+ ),
+ 'plugins_service_quick_navigation_toutiao' =>
+ array (
+ 0 => 'app\\plugins\\points\\Hook',
+ 1 => 'app\\plugins\\signin\\Hook',
+ ),
'plugins_service_goods_handle_end' =>
array (
0 => 'app\\plugins\\points\\Hook',
@@ -72,34 +121,6 @@ return array (
array (
0 => 'app\\plugins\\points\\Hook',
),
- 'plugins_service_quick_navigation_pc' =>
- array (
- 0 => 'app\\plugins\\signin\\Hook',
- ),
- 'plugins_service_quick_navigation_h5' =>
- array (
- 0 => 'app\\plugins\\signin\\Hook',
- ),
- 'plugins_service_quick_navigation_weixin' =>
- array (
- 0 => 'app\\plugins\\signin\\Hook',
- ),
- 'plugins_service_quick_navigation_alipay' =>
- array (
- 0 => 'app\\plugins\\signin\\Hook',
- ),
- 'plugins_service_quick_navigation_baidu' =>
- array (
- 0 => 'app\\plugins\\signin\\Hook',
- ),
- 'plugins_service_quick_navigation_qq' =>
- array (
- 0 => 'app\\plugins\\signin\\Hook',
- ),
- 'plugins_service_quick_navigation_toutiao' =>
- array (
- 0 => 'app\\plugins\\signin\\Hook',
- ),
'plugins_service_users_center_left_menu_handle' =>
array (
0 => 'app\\plugins\\signin\\Hook',
diff --git a/config/shopxo.php b/config/shopxo.php
index e02bbc764..f6a3660e4 100755
--- a/config/shopxo.php
+++ b/config/shopxo.php
@@ -73,6 +73,9 @@ return [
// 快捷导航缓存信息
'cache_quick_navigation_key' => 'cache_quick_navigation_data_',
+ // 地区所有数据缓存、1~3级
+ 'cache_region_all_key' => 'cache_region_all_data',
+
// 附件host、最后不要带/斜杠结尾, 数据库图片地址以/static/...开头
'attachment_host' => $cdn_attachment_host,