地区新增全量数据接口
parent
14ac66a9e3
commit
6096edde9c
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -22,20 +22,7 @@
|
|||
<!-- 轮播上内容 -->
|
||||
<div class="am-container slideall">
|
||||
<!-- 轮播-手机导航 -->
|
||||
{{if !empty($navigation)}}
|
||||
<div class="am-g am-g-fixed small-nav">
|
||||
{{foreach $navigation as $nav}}
|
||||
<div class="am-u-sm-3">
|
||||
<a {{if $nav['is_need_login'] eq 1 and empty($user)}} href="javascript:;" class="login-event" {{else /}} href="{{$nav.event_value}}" {{/if}} >
|
||||
<div class="nav-icon" style="{{if !empty($nav['bg_color'])}}background:{{$nav.bg_color}};{{/if}}">
|
||||
<img src="{{$nav.images_url}}" alt="{{$nav.name}}" />
|
||||
</div>
|
||||
<div class="mini-nav-title">{{$nav.name}}</div>
|
||||
</a>
|
||||
</div>
|
||||
{{/foreach}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{include file="public/home_nav" /}}
|
||||
|
||||
<!-- 轮播-聚合内容 -->
|
||||
{{if MyC('home_index_banner_right_status', 1) eq 1}}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<!-- 首页轮播 start -->
|
||||
<div class="banner">
|
||||
<div data-am-widget="slider" class="am-slider am-slider-a1" data-am-slider='{"directionNav":false}'>
|
||||
<ul class="am-slides">
|
||||
|
|
@ -25,5 +24,4 @@
|
|||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 首页轮播 end -->
|
||||
</div>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
{{if !empty($navigation)}}
|
||||
<div class="am-g am-g-fixed small-nav">
|
||||
{{foreach $navigation as $nav}}
|
||||
<div class="am-u-sm-3">
|
||||
{{switch nav.event_type}}
|
||||
{{case 3}}
|
||||
<!-- 地图 -->
|
||||
<a href="javascript:;" {{if $nav['is_need_login'] eq 1 and empty($user)}} class="login-event" {{else /}}{{if !empty($nav['event_value_data']) and !empty($nav['event_value_data'][2]) and !empty($nav['event_value_data'][3])}}class="submit-map-popup" data-lng="{{$nav['event_value_data'][2]}}" data-lat="{{$nav['event_value_data'][3]}}"{{/if}}{{/if}}>
|
||||
{{/case}}
|
||||
{{case 4}}
|
||||
<!-- 电话 -->
|
||||
<a {{if $nav['is_need_login'] eq 1 and empty($user)}} href="javascript:;" class="login-event" {{else /}}{{if !empty($nav['event_value'])}}href="tel:{{$nav.event_value}}"{{else /}}href="javascript:;"{{/if}}{{/if}}>
|
||||
{{/case}}
|
||||
{{default /}}
|
||||
<!-- 默认url地址 -->
|
||||
<a {{if $nav['is_need_login'] eq 1 and empty($user)}} href="javascript:;" class="login-event" {{else /}}{{if !empty($nav['event_value'])}}href="{{$nav.event_value}}" target="_blank"{{else /}}href="javascript:;"{{/if}}{{/if}}>
|
||||
{{/switch}}
|
||||
<div class="nav-icon" style="{{if !empty($nav['bg_color'])}}background:{{$nav.bg_color}};{{/if}}">
|
||||
<img src="{{$nav.images_url}}" alt="{{$nav.name}}" />
|
||||
</div>
|
||||
<div class="mini-nav-title">{{$nav.name}}</div>
|
||||
</a>
|
||||
</div>
|
||||
{{/foreach}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue