细节优化+用户中心钩子添加
parent
e159204a2f
commit
43adac8927
|
|
@ -17,6 +17,7 @@ use app\service\UserService;
|
|||
use app\service\BuyService;
|
||||
use app\service\SeoService;
|
||||
use app\service\MessageService;
|
||||
use app\service\NavigationService;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
|
|
@ -77,18 +78,10 @@ class User extends Common
|
|||
{
|
||||
// 登录校验
|
||||
$this->IsLogin();
|
||||
|
||||
// 订单总数
|
||||
$where = ['user_id'=>$this->user['id'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
|
||||
$this->assign('user_order_count', OrderService::OrderTotal($where));
|
||||
|
||||
// 商品收藏总数
|
||||
$where = ['user_id'=>$this->user['id']];
|
||||
$this->assign('user_goods_favor_count', GoodsService::GoodsFavorTotal($where));
|
||||
|
||||
// 商品浏览总数
|
||||
$where = ['user_id'=>$this->user['id']];
|
||||
$this->assign('user_goods_browse_count', GoodsService::GoodsBrowseTotal($where));
|
||||
// 用户中心基础信息 mini 导航
|
||||
$mini_navigation = NavigationService::UserCenterMiniNavigation(['user'=>$this->user]);
|
||||
$this->assign('mini_navigation', $mini_navigation);
|
||||
|
||||
// 用户订单状态
|
||||
$user_order_status = OrderService::OrderStatusStepTotal(['user_type'=>'user', 'user'=>$this->user, 'is_comments'=>1, 'is_aftersale'=>1]);
|
||||
|
|
@ -143,8 +136,8 @@ class User extends Common
|
|||
$data = GoodsService::GoodsBrowseList($browse_params);
|
||||
$this->assign('goods_browse_list', $data['data']);
|
||||
|
||||
// 用户中心顶部钩子
|
||||
$this->assign('plugins_view_user_center_top_data', Hook::listen('plugins_view_user_center_top', ['hook_name'=>'plugins_view_user_center_top', 'is_backend'=>false, 'user'=>$this->user]));
|
||||
// 钩子
|
||||
$this->PluginsHook();
|
||||
|
||||
// 浏览器名称
|
||||
$this->assign('home_seo_site_title', SeoService::BrowserSeoTitle('用户中心', 1));
|
||||
|
|
@ -152,6 +145,35 @@ class User extends Common
|
|||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 钩子处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-04-22
|
||||
* @desc description
|
||||
*/
|
||||
private function PluginsHook()
|
||||
{
|
||||
// 顶部钩子
|
||||
$this->assign('plugins_view_user_center_top_data', Hook::listen('plugins_view_user_center_top', ['hook_name'=>'plugins_view_user_center_top', 'is_backend'=>false, 'user'=>$this->user]));
|
||||
|
||||
// 基础信息底部钩子
|
||||
$this->assign('plugins_view_user_base_bottom_data', Hook::listen('plugins_view_user_base_bottom', ['hook_name'=>'plugins_view_user_base_bottom', 'is_backend'=>false, 'user'=>$this->user]));
|
||||
|
||||
// 聚合内容顶部钩子
|
||||
$this->assign('plugins_view_user_various_top_data', Hook::listen('plugins_view_user_various_top', ['hook_name'=>'plugins_view_user_various_top', 'is_backend'=>false, 'user'=>$this->user]));
|
||||
|
||||
// 聚合内容底部钩子
|
||||
$this->assign('plugins_view_user_various_bottom_data', Hook::listen('plugins_view_user_various_bottom', ['hook_name'=>'plugins_view_user_various_bottom', 'is_backend'=>false, 'user'=>$this->user]));
|
||||
|
||||
// 聚合内容里面顶部钩子
|
||||
$this->assign('plugins_view_user_various_inside_top_data', Hook::listen('plugins_view_user_various_inside_top', ['hook_name'=>'plugins_view_user_various_inside_top', 'is_backend'=>false, 'user'=>$this->user]));
|
||||
|
||||
// 聚合内容里面底部钩子
|
||||
$this->assign('plugins_view_user_various_bottom_data', Hook::listen('plugins_view_user_various_bottom', ['hook_name'=>'plugins_view_user_various_bottom', 'is_backend'=>false, 'user'=>$this->user]));
|
||||
}
|
||||
|
||||
/**
|
||||
* [ForgetPwdInfo 密码找回]
|
||||
* @author Devil
|
||||
|
|
|
|||
|
|
@ -1,21 +1,3 @@
|
|||
{{if !IsMobile() or (IsMobile() and MyC('common_is_mobile_concise_model') neq 1)}}
|
||||
<!-- 友情链接 -->
|
||||
{{if !empty($link_list)}}
|
||||
<div class="friendship-list am-hide-sm-only">
|
||||
<div class="am-container">
|
||||
<h2>友情链接</h2>
|
||||
<ul>
|
||||
{{foreach $link_list as $v}}
|
||||
<li>
|
||||
<a href="{{$v.url}}" {{if $v['is_new_window_open'] eq 1}} target="_blank"{{/if}} title="{{$v.describe}}">{{$v.name}}</a>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<!-- 底部导航上面钩子 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
|
||||
<div class="plugins-tag">
|
||||
|
|
@ -30,7 +12,6 @@
|
|||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{if !IsMobile() or (IsMobile() and MyC('common_is_mobile_concise_model') neq 1)}}
|
||||
<!-- 底部导航 -->
|
||||
<footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{}">
|
||||
|
|
@ -88,6 +69,19 @@
|
|||
<!-- 页脚信息 -->
|
||||
<div class="am-footer-miscs">
|
||||
<div class="am-container">
|
||||
<!-- 友情链接 -->
|
||||
{{if !empty($link_list)}}
|
||||
<div class="friendship-list am-hide-sm-only">
|
||||
<ul class="am-cf am-margin-bottom-sm">
|
||||
{{foreach $link_list as $v}}
|
||||
<li class="am-fl am-text-center">
|
||||
<a href="{{$v.url}}" {{if $v['is_new_window_open'] eq 1}} target="_blank"{{/if}} title="{{$v.describe}}">{{$v.name}}</a>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<p class="powered">
|
||||
Powered by <a href="http://shopxo.net/" title="ShopXO电商系统" target="_blank">
|
||||
<span class="b">Shop</span><span class="o">XO</span>
|
||||
|
|
|
|||
|
|
@ -61,34 +61,34 @@
|
|||
<div class="user-base-right">
|
||||
<a href="{{:MyUrl('index/message/index')}}" class="am-icon-bell-o message"> 消息 {{if $common_message_total gt 0}}{{$common_message_total}}{{/if}}</a>
|
||||
</div>
|
||||
<ul class="user-base-icon">
|
||||
<li>
|
||||
<a href="{{:MyUrl('index/order/index')}}">
|
||||
<p>{{$user_order_count}}</p>
|
||||
<p>订单总数</p>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{:MyUrl('index/userfavor/goods')}}">
|
||||
<p>{{$user_goods_favor_count}}</p>
|
||||
<p>商品收藏</p>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{:MyUrl('index/usergoodsbrowse/index')}}">
|
||||
<p>{{$user_goods_browse_count}}</p>
|
||||
<p>我的足迹</p>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{:MyUrl('index/userintegral/index')}}">
|
||||
<p>{{$user.integral}}</p>
|
||||
<p>我的积分</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{{if !empty($mini_navigation)}}
|
||||
<ul class="user-base-icon">
|
||||
{{foreach $mini_navigation as $nav}}
|
||||
<li>
|
||||
<a href="{{$nav.url}}">
|
||||
<p>{{$nav.value}}</p>
|
||||
<p>{{$nav.name}}</p>
|
||||
</a>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<!-- 基础信息底部钩子 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_view_user_base_bottom</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($plugins_view_user_base_bottom_data) and is_array($plugins_view_user_base_bottom_data)}}
|
||||
{{foreach $plugins_view_user_base_bottom_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<div class="order-nav">
|
||||
<a href="{{:MyUrl('index/order/index')}}">
|
||||
|
|
@ -140,8 +140,36 @@
|
|||
</ul>
|
||||
{{/if}}
|
||||
|
||||
<!-- 聚合内容顶部钩子 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_view_user_various_top</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($plugins_view_user_various_top_data) and is_array($plugins_view_user_various_top_data)}}
|
||||
{{foreach $plugins_view_user_various_top_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
<!-- 聚合内容 -->
|
||||
<div class="am-g various">
|
||||
<!-- 聚合内容里面顶部钩子 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_view_user_various_inside_top</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($plugins_view_user_various_inside_top_data) and is_array($plugins_view_user_various_inside_top_data)}}
|
||||
{{foreach $plugins_view_user_various_inside_top_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
<!-- 进行中的订单 -->
|
||||
<div class="am-u-md-8">
|
||||
<div class="am-panel am-panel-default">
|
||||
|
|
@ -320,7 +348,35 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 聚合内容里面底部钩子 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_view_user_various_inside_bottom</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($plugins_view_user_various_inside_bottom_data) and is_array($plugins_view_user_various_inside_bottom_data)}}
|
||||
{{foreach $plugins_view_user_various_inside_bottom_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<!-- 聚合内容底部钩子 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_view_user_various_bottom</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($plugins_view_user_various_bottom_data) and is_array($plugins_view_user_various_bottom_data)}}
|
||||
{{foreach $plugins_view_user_various_bottom_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<!-- content end -->
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ namespace app\service;
|
|||
|
||||
use think\Db;
|
||||
use think\facade\Hook;
|
||||
use app\service\BuyService;
|
||||
use app\service\MessageService;
|
||||
use app\service\OrderService;
|
||||
use app\service\GoodsService;
|
||||
|
||||
/**
|
||||
* 导航服务层
|
||||
|
|
@ -486,7 +490,7 @@ class NavigationService
|
|||
* @version 1.0.0
|
||||
* @date 2019-03-15
|
||||
* @desc description
|
||||
* @param array $params [description]
|
||||
* @param [array] $params [输入信息]
|
||||
*/
|
||||
public static function HomeHavTopRight($params = [])
|
||||
{
|
||||
|
|
@ -576,7 +580,7 @@ class NavigationService
|
|||
* @version 1.0.0
|
||||
* @date 2019-03-15
|
||||
* @desc description
|
||||
* @param array $params [description]
|
||||
* @param [array] $params [输入信息]
|
||||
*/
|
||||
public static function UsersPersonalShowFieldList($params = [])
|
||||
{
|
||||
|
|
@ -633,7 +637,7 @@ class NavigationService
|
|||
* @version 1.0.0
|
||||
* @date 2019-03-15
|
||||
* @desc description
|
||||
* @param array $params [description]
|
||||
* @param [array] $params [输入信息]
|
||||
*/
|
||||
public static function UsersSafetyPanelList($params = [])
|
||||
{
|
||||
|
|
@ -681,7 +685,7 @@ class NavigationService
|
|||
* @version 1.0.0
|
||||
* @date 2019-03-15
|
||||
* @desc description
|
||||
* @param array $params [description]
|
||||
* @param [array] $params [输入信息]
|
||||
*/
|
||||
public static function UsersCenterLeftList($params = [])
|
||||
{
|
||||
|
|
@ -836,7 +840,7 @@ class NavigationService
|
|||
* @version 1.0.0
|
||||
* @date 2019-03-15
|
||||
* @desc description
|
||||
* @param array $params [description]
|
||||
* @param [array] $params [输入信息]
|
||||
*/
|
||||
public static function BottomNavigation($params = [])
|
||||
{
|
||||
|
|
@ -894,5 +898,75 @@ class NavigationService
|
|||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户中心基础信息中 mini 导航
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-03-15
|
||||
* @desc description
|
||||
* @param [array] $params [输入信息]
|
||||
*/
|
||||
public static function UserCenterMiniNavigation($params = [])
|
||||
{
|
||||
if(empty($params['user']))
|
||||
{
|
||||
$user_order_count = 0;
|
||||
$user_goods_favor_count = 0;
|
||||
$user_goods_browse_count = 0;
|
||||
$user_integral = 0;
|
||||
} else {
|
||||
// 订单总数
|
||||
$where = ['user_id'=>$params['user']['id'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
|
||||
$user_order_count = OrderService::OrderTotal($where);
|
||||
|
||||
// 商品收藏总数
|
||||
$where = ['user_id'=>$params['user']['id']];
|
||||
$user_goods_favor_count = GoodsService::GoodsFavorTotal($where);
|
||||
|
||||
// 我的足迹总数
|
||||
$where = ['user_id'=>$params['user']['id']];
|
||||
$user_goods_browse_count = GoodsService::GoodsBrowseTotal($where);
|
||||
|
||||
// 用户积分
|
||||
$user_integral = isset($params['user']['integral']) ? $params['user']['integral'] : 0;
|
||||
}
|
||||
|
||||
// 列表
|
||||
$data = [
|
||||
[
|
||||
'name' => '订单总数',
|
||||
'value' => $user_order_count,
|
||||
'url' => MyUrl('index/order/index'),
|
||||
],
|
||||
[
|
||||
'name' => '商品收藏',
|
||||
'value' => $user_goods_favor_count,
|
||||
'url' => MyUrl('index/userfavor/goods'),
|
||||
],
|
||||
[
|
||||
'name' => '我的足迹',
|
||||
'value' => $user_goods_browse_count,
|
||||
'url' => MyUrl('index/usergoodsbrowse/index'),
|
||||
],
|
||||
[
|
||||
'name' => '我的积分',
|
||||
'value' => $user_integral,
|
||||
'url' => MyUrl('index/userintegral/index'),
|
||||
],
|
||||
];
|
||||
|
||||
// 用户中心基础信息中mini导航
|
||||
$hook_name = 'plugins_service_user_center_mini_navigation_handle';
|
||||
Hook::listen($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
'is_backend' => true,
|
||||
'params' => &$params,
|
||||
'data' => &$data,
|
||||
]);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -370,39 +370,16 @@ color: #F5F5F2;font-size: 12px;cursor:pointer;border-radius:0px 0px; position: a
|
|||
/**
|
||||
* 友情链接
|
||||
*/
|
||||
.friendship-list {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.friendship-list h2 {
|
||||
border-bottom: 1px solid #e3e0e0;
|
||||
line-height: 30px;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
}
|
||||
.friendship-list ul {
|
||||
overflow: hidden;
|
||||
padding: 5px 0;
|
||||
}
|
||||
.friendship-list ul li {
|
||||
float: left;
|
||||
line-height: 26px;
|
||||
text-align: center;
|
||||
}
|
||||
.friendship-list ul li:not(:last-child) {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.friendship-list ul li:not(:last-child) a {
|
||||
border-right: 1px solid #d4d4d4;
|
||||
border-right: 1px solid #4a4a4a;
|
||||
padding-right: 10px;
|
||||
}
|
||||
@media only screen and (max-width:1025px) {
|
||||
.friendship-list {
|
||||
padding: 0 5px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 框架覆盖
|
||||
|
|
|
|||
Loading…
Reference in New Issue