mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-07-08 22:40:43 +08:00
会员等级
This commit is contained in:
@ -47,9 +47,14 @@
|
||||
<em>
|
||||
<span class="s-name">
|
||||
{{if !empty($user)}}
|
||||
Hi, {{$user.user_name_view}}
|
||||
<em>Hi,</em>
|
||||
{{if !empty($user['icon'])}}
|
||||
<img src="{{$user.icon}}" class="common-user-icon" {{if !empty($user['icon_title'])}}title="{{$user.icon_title}}"{{/if}} />
|
||||
{{/if}}
|
||||
<em>{{$user.user_name_view}}</em>
|
||||
{{else /}}
|
||||
您好,欢迎来到 {{:MyC('home_site_name')}}
|
||||
<em>您好,欢迎来到</em>
|
||||
<em>{{:MyC('home_site_name')}}</em>
|
||||
{{/if}}
|
||||
</span>
|
||||
</em>
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
<div class="top-nav-items">
|
||||
<div class="menu-hd">
|
||||
{{if empty($user)}}
|
||||
<span>您好,欢迎来到 {{:MyC('home_site_name')}}</span>
|
||||
<em>您好,欢迎来到</em>
|
||||
<em>{{:MyC('home_site_name')}}</em>
|
||||
{{if MyC('home_user_login_state') eq 1}}
|
||||
[<a href="{{:MyUrl('index/user/logininfo')}}">登录</a>]
|
||||
{{/if}}
|
||||
@ -13,7 +14,12 @@
|
||||
[<a href="{{:MyUrl('index/user/regInfo')}}">注册</a>]
|
||||
{{/if}}
|
||||
{{else /}}
|
||||
<span>您好 {{$user.user_name_view}},欢迎来到 {{:MyC('home_site_name')}}</span>
|
||||
<em>您好</em>
|
||||
{{if !empty($user['icon'])}}
|
||||
<img src="{{$user.icon}}" class="common-user-icon" {{if !empty($user['icon_title'])}}title="{{$user.icon_title}}"{{/if}} />
|
||||
{{/if}}
|
||||
<em>{{$user.user_name_view}},欢迎来到</em>
|
||||
<em>{{:MyC('home_site_name')}}</em>
|
||||
[<a href="{{:MyUrl('index/user/logout')}}">退出</a>]
|
||||
{{/if}}
|
||||
|
||||
|
||||
@ -44,8 +44,13 @@
|
||||
<div class="user-base">
|
||||
<div class="user-base-left">
|
||||
<div class="user-avatar">
|
||||
<img src="{{$user.avatar}}" />
|
||||
<p class="user-name">{{$user.user_name_view}}</p>
|
||||
<img src="{{$user.avatar}}" class="avatar" />
|
||||
<div class="user-name">
|
||||
{{if !empty($user['icon'])}}
|
||||
<img src="{{$user.icon}}" class="common-user-icon" {{if !empty($user['icon_title'])}}title="{{$user.icon_title}}"{{/if}} />
|
||||
{{/if}}
|
||||
<span>{{$user.user_name_view}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items">
|
||||
<a href="javascript:;" class="am-icon-camera-retro" data-am-modal="{target:'#user-avatar-popup'}"> 修改头像</a>
|
||||
|
||||
@ -73,6 +73,11 @@ class Hook extends Controller
|
||||
case 'plugins_service_buy_handle' :
|
||||
$ret = $this->FullReductionCalculate($params);
|
||||
break;
|
||||
|
||||
// 用户登录成功信息纪录钩子 icon处理
|
||||
case 'plugins_service_user_login_success_record' :
|
||||
$ret = $this->UserLoginSuccessIconHandle($params);
|
||||
break;
|
||||
}
|
||||
return $ret;
|
||||
} else {
|
||||
@ -80,6 +85,29 @@ class Hook extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户icon处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-04-28
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
private function UserLoginSuccessIconHandle($params = [])
|
||||
{
|
||||
if(!empty($params['user']))
|
||||
{
|
||||
// 用户等级
|
||||
$level = Service::UserLevelMatching($params['user']);
|
||||
if(!empty($level) && $level['images_url'])
|
||||
{
|
||||
$params['user']['icon'] = $level['images_url'];
|
||||
}
|
||||
}
|
||||
return DataReturn('处理成功', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 满减计算
|
||||
* @author Devil
|
||||
@ -136,7 +164,7 @@ class Hook extends Controller
|
||||
// 价格处理
|
||||
$goods['price'] = Service::PriceCalculate($goods['price'], $level['discount_rate'], 0);
|
||||
$price_title = empty($level['name']) ? '会员价' : $level['name'];
|
||||
$goods['show_field_price_text'] = '<span class="plugins-membershiplevel-goods-price-icon">'.$price_title.'</span>';
|
||||
$goods['show_field_price_text'] = '<span class="plugins-membershiplevel-goods-price-icon" title="'.$price_title.'">'.$price_title.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,12 +114,6 @@ class Service
|
||||
'checked_data' => '1,30',
|
||||
'error_msg' => '名称长度 1~30 个字符',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'images_url',
|
||||
'checked_data' => '255',
|
||||
'error_msg' => '请上传图标',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'rules_min',
|
||||
@ -172,19 +166,22 @@ class Service
|
||||
'checked_data' => $params['rules_min'],
|
||||
'error_msg' => '规则最大值不能最小值相等',
|
||||
],
|
||||
[
|
||||
];
|
||||
if(intval($params['rules_max']) > 0)
|
||||
{
|
||||
$p[] = [
|
||||
'checked_type' => 'max',
|
||||
'key_name' => 'rules_min',
|
||||
'checked_data' => intval($params['rules_max']),
|
||||
'error_msg' => '规则最小值不能大于最大值['.intval($params['rules_max']).']',
|
||||
],
|
||||
[
|
||||
];
|
||||
$p[] = [
|
||||
'checked_type' => 'min',
|
||||
'key_name' => 'rules_max',
|
||||
'checked_data' => intval($params['rules_min']),
|
||||
'error_msg' => '规则最大值不能小于最小值['.intval($params['rules_min']).']',
|
||||
],
|
||||
];
|
||||
];
|
||||
}
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
@ -373,14 +370,19 @@ class Service
|
||||
/**
|
||||
* 用户等级匹配
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2019-04-27T00:32:00+0800
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-04-28
|
||||
* @desc description
|
||||
* @param [array] $user [用户信息]
|
||||
*/
|
||||
public static function UserLevelMatching()
|
||||
public static function UserLevelMatching($user = [])
|
||||
{
|
||||
// 用户
|
||||
$user = UserService::LoginUserInfo();
|
||||
// 未指定用户信息,则从服务层读取
|
||||
if(empty($user))
|
||||
{
|
||||
$user = UserService::LoginUserInfo();
|
||||
}
|
||||
if(!empty($user))
|
||||
{
|
||||
// 缓存key
|
||||
@ -438,6 +440,12 @@ class Service
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 等级icon
|
||||
if(!empty($level) && empty($level['images_url']))
|
||||
{
|
||||
$level['images_url'] = empty($base['data']['default_level_images']) ? config('shopxo.attachment_host').'/static/plugins/images/membershiplevel/level-default-images.png' : $base['data']['default_level_images'];
|
||||
}
|
||||
cache($key, $level);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,9 @@
|
||||
],
|
||||
"plugins_service_buy_handle":[
|
||||
"app\\plugins\\membershiplevel\\Hook"
|
||||
],
|
||||
"plugins_service_user_login_success_record":[
|
||||
"app\\plugins\\membershiplevel\\Hook"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -24,11 +24,14 @@
|
||||
|
||||
<div class="am-form-group am-form-file">
|
||||
<label class="block">图标<span class="am-form-group-label-tips">建议50像数x50像数</span></label>
|
||||
<ul class="plug-file-upload-view images_url-images-view" data-form-name="images_url" data-max-number="1" data-delete="0" data-dialog-type="images">
|
||||
<li>
|
||||
<input type="text" name="images_url" value="{{if !empty($data['images_url'])}}{{$data.images_url}}{{/if}}" data-validation-message="请上传图标" required />
|
||||
<img src="{{if !empty($data['images_url'])}}{{$data.images_url}}{{else /}}{{$attachment_host}}/static/plugins/images/membershiplevel/default-images.jpg{{/if}}" />
|
||||
</li>
|
||||
<ul class="plug-file-upload-view images_url-images-view" data-form-name="images_url" data-max-number="1" data-delete="1" data-dialog-type="images">
|
||||
{{if !empty($data['images_url'])}}
|
||||
<li>
|
||||
<input type="text" name="images_url" value="{{$data.images_url_old}}" data-validation-message="请上传图标" />
|
||||
<img src="{{$data.images_url}}" />
|
||||
<i>×</i>
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
<div class="plug-file-upload-submit" data-view-tag="ul.images_url-images-view">+上传图标</div>
|
||||
</div>
|
||||
|
||||
@ -753,6 +753,15 @@ class UserService
|
||||
$user['avatar'] = config('shopxo.attachment_host').'/static/index/'.strtolower(config('DEFAULT_THEME', 'default')).'/images/default-user-avatar.jpg';
|
||||
}
|
||||
|
||||
// 用户登录成功信息纪录钩子
|
||||
$hook_name = 'plugins_service_user_login_success_record';
|
||||
$ret = Hook::listen($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
'is_backend' => true,
|
||||
'user' => &$user,
|
||||
'user_id' => $user_id
|
||||
]);
|
||||
|
||||
if($is_app == true)
|
||||
{
|
||||
return $user;
|
||||
|
||||
@ -151,5 +151,9 @@ return array (
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevel\\Hook',
|
||||
),
|
||||
'plugins_service_user_login_success_record' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevel\\Hook',
|
||||
),
|
||||
);
|
||||
?>
|
||||
File diff suppressed because one or more lines are too long
@ -130,9 +130,9 @@ color: #F5F5F2;font-size: 12px;cursor:pointer;border-radius:0px 0px; position: a
|
||||
.am-footer {text-align:center; display:block;position: relative;margin: 0px auto; padding: 10px 0px; }
|
||||
|
||||
/* 导航上用户 */
|
||||
.navigation-user {display: block; position: absolute;right:0px ;top:0px;font-size: 14px;line-height:33px;height:33px ;width:110px;text-align:center;background: #e1363f;cursor: pointer;}
|
||||
.navigation-user .nav-user{background:#e0313b; width: 33px;height: 33px;border-radius: 33px;position: absolute;left:-28px;z-index: 2;padding: 1px;overflow: hidden;}
|
||||
.navigation-user b{display:block;position: absolute;width: 40px;height: 40px;border-radius:45px;z-index: 1;left: -31px;top: -4px;background: #fff;}
|
||||
.navigation-user {display: block; position: absolute;right:0px;bottom:6px;font-size: 12px;line-height:26px;height:25px ;width:85px;text-align:center;background: #e1363f;cursor: pointer;}
|
||||
.navigation-user .nav-user{background:#e0313b; width: 25px;height: 25px;border-radius: 25px;position: absolute;left:-22px;z-index: 2;padding: 1px;overflow: hidden;}
|
||||
.navigation-user b{display:block;position: absolute;width: 25px;height: 27px;border-radius:45px;z-index: 1;left: -19px;top: -1px;background: #fff;}
|
||||
.navigation-user .am-icon-angle-right { margin-left: 5px; }
|
||||
.navigation-user * { color:#fcff00; text-decoration: none; }
|
||||
.navigation-user b.line{display: block;width:100%;height:2px ;border-bottom:2px solid #d2364c;position: absolute;top:180px;z-index:5;}
|
||||
@ -739,6 +739,12 @@ ul.am-dropdown-content > .am-active > a:focus,
|
||||
}
|
||||
}
|
||||
|
||||
/* 用户 */
|
||||
img.common-user-icon {
|
||||
max-height: 15px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户中心
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
.user-base a, .order-base a, .order-nav a{text-decoration: none;}
|
||||
.user-avatar{text-align: center;}
|
||||
.user-avatar .user-name{font-weight: 500;}
|
||||
.user-avatar img{width: 80px; height: 80px; border-radius: 100%;}
|
||||
.user-avatar img.avatar {width: 80px; height: 80px; border-radius: 100%;}
|
||||
.user-avatar .user-name{margin-top: 5px;}
|
||||
.user-base-left .items a{color: #f8f8f8;}
|
||||
.user-base-right a:not(:last-child){margin-right: 15px;}
|
||||
|
||||
@ -2,4 +2,17 @@
|
||||
padding: 3px 5px;
|
||||
background: #fee85c;
|
||||
color: #d19432;
|
||||
position: relative;
|
||||
}
|
||||
.plugins-membershiplevel-goods-price-icon:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
background: url(../../images/membershiplevel/flash.gif) no-repeat center;
|
||||
background-size: contain;
|
||||
opacity: 0.3;
|
||||
}
|
||||
BIN
public/static/plugins/images/membershiplevel/flash.gif
Normal file
BIN
public/static/plugins/images/membershiplevel/flash.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 1.9 KiB |
Reference in New Issue
Block a user