From dc671f0f4daaf8ebd64496f29a6d013529ae0ce1 Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 30 Apr 2025 17:27:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=AF=E5=90=A6=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增默认会员头像配置 --- application/api/lang/zh-cn/user.php | 4 +++- application/common/model/User.php | 2 +- application/config.php | 10 +++++++--- application/index/controller/User.php | 5 ++++- application/index/lang/zh-cn/user.php | 5 +++++ application/index/view/layout/default.html | 3 ++- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/application/api/lang/zh-cn/user.php b/application/api/lang/zh-cn/user.php index e98e4cd0..7cb4cb90 100644 --- a/application/api/lang/zh-cn/user.php +++ b/application/api/lang/zh-cn/user.php @@ -24,7 +24,9 @@ return [ 'Account can not be empty' => '账户不能为空', 'Username or password is incorrect' => '用户名或密码不正确', 'You are not logged in' => '你当前还未登录', - 'You\'ve logged in, do not login again' => '你已经存在,请不要重复登录', + 'User center already closed' => '会员中心已经关闭', + 'User register already closed' => '会员注册已经关闭', + 'You\'ve logged in, do not login again' => '你已经登录,请不要重复登录', 'Profile' => '个人资料', 'Verify email' => '邮箱验证', 'Change password' => '修改密码', diff --git a/application/common/model/User.php b/application/common/model/User.php index 2a8ee688..44a4a838 100644 --- a/application/common/model/User.php +++ b/application/common/model/User.php @@ -45,7 +45,7 @@ class User extends Model public function getAvatarAttr($value, $data) { if (!$value) { - $value = config('fastadmin.user_letter_avatar') ? letter_avatar($data['nickname']) : '/assets/img/avatar.png'; + $value = config('fastadmin.user_letter_avatar') ? letter_avatar($data['nickname']) : (config('fastadmin.user_default_avatar') ?: '/assets/img/avatar.png'); } return cdnurl($value, true); } diff --git a/application/config.php b/application/config.php index a45dcf54..39fab0f8 100755 --- a/application/config.php +++ b/application/config.php @@ -269,7 +269,9 @@ return [ 'fastadmin' => [ //是否开启前台会员中心 'usercenter' => true, - //会员注册验证码类型email/mobile/wechat/text/false + //是否开启用户注册,不会影响使用手机号快捷注册登录 + 'user_register' => true, + //会员注册验证码类型,支持email/mobile/wechat/text/false 'user_register_captcha' => 'text', //是否启用发送前验证码(用于短信和邮件发送) 'user_api_captcha' => false, @@ -279,9 +281,11 @@ return [ 'user_home_url' => '/u/{uid}', //是否启用会员字母头像 'user_letter_avatar' => true, - //是否启用会员等级规则none/auto/up,auto表示自动升降级,up表示只升不降 + //会员默认头像,仅当user_letter_avatar为false时有效 + 'user_default_avatar' => '/assets/img/avatar.png', + //是否启用会员等级规则,支持none/auto/up,none表示不影响等级,auto表示自动升降级,up表示只升不降 'user_level_rule' => '', - //会员等级积分字典 + //会员等级积分字典,键名表示等级,值表示所需的积分 'user_level_dict' => [1 => 0, 2 => 30, 3 => 100, 4 => 500, 5 => 1000, 6 => 2000, 7 => 3000, 8 => 5000, 9 => 8000, 10 => 10000], //登录验证码 'login_captcha' => true, diff --git a/application/index/controller/User.php b/application/index/controller/User.php index ec9d3deb..45043e95 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -66,9 +66,12 @@ class User extends Frontend */ public function register() { + if (!config('fastadmin.user_register')) { + $this->error(__('User register already closed')); + } $url = $this->request->request('url', '', 'url_clean'); if ($this->auth->id) { - $this->success(__('You\'ve logged in, do not login again'), $url ? $url : url('user/index')); + $this->success(__('You\'ve logged in, do not login again'), $url ?: url('user/index')); } if ($this->request->isPost()) { $username = $this->request->post('username'); diff --git a/application/index/lang/zh-cn/user.php b/application/index/lang/zh-cn/user.php index b471c8f4..41ef37bd 100755 --- a/application/index/lang/zh-cn/user.php +++ b/application/index/lang/zh-cn/user.php @@ -19,8 +19,12 @@ return [ 'Change' => '修改', 'Click to edit' => '点击编辑', 'Email/Mobile/Username' => '邮箱/手机/用户名', + 'Sign in with account' => '账号密码登录', + 'Sign in with mobile phone' => '手机验证码登录', 'Sign up successful' => '注册成功', 'Email active successful' => '邮箱激活成功', + 'Please enter your mobile phone number' => '请输入你的手机号', + 'Please enter %s numbers' => '请输入%s位数字', 'Username can not be empty' => '用户名不能为空', 'Username must be 3 to 30 characters' => '用户名必须3-30个字符', 'Username must be 6 to 30 characters' => '用户名必须6-30个字符', @@ -61,6 +65,7 @@ return [ 'Logged in successful' => '登录成功', 'Logout successful' => '退出成功', 'User center already closed' => '会员中心已经关闭', + 'User register already closed' => '会员注册已经关闭', 'Don\'t have an account? Sign up' => '还没有账号?点击注册', 'Already have an account? Sign in' => '已经有账号?点击登录', 'Operation failed' => '操作失败', diff --git a/application/index/view/layout/default.html b/application/index/view/layout/default.html index 93f67612..38b47e7d 100644 --- a/application/index/view/layout/default.html +++ b/application/index/view/layout/default.html @@ -38,9 +38,10 @@
  • {:__('Sign out')}
  • {else /}
  • {:__('Sign in')}
  • + {if config('fastadmin.user_register')}
  • {:__('Sign up')}
  • {/if} - + {/if}