切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
F4NNIU
5 years ago
提交者
Gitee
5 years ago
提交
8c99271e6689fa01bdbdeccac505a88663e5a7f4
2 个父辈
6c7b53a9
568fd153
!195 改善前台用户设置
Merge pull request !195 from F4NNIU/user_profile_improvement
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
26 行增加
和
2 行删除
application/api/controller/User.php
application/api/controller/Validate.php
application/api/lang/zh-cn/user.php
application/index/view/user/profile.html
application/api/controller/User.php
查看文件 @
8c99271
...
...
@@ -158,7 +158,13 @@ class User extends Api
}
$user
->
username
=
$username
;
}
$user
->
nickname
=
$nickname
;
if
(
$nickname
)
{
$exists
=
\app\common\model\User
::
where
(
'nickname'
,
$nickname
)
->
where
(
'id'
,
'<>'
,
$this
->
auth
->
id
)
->
find
();
if
(
$exists
)
{
$this
->
error
(
__
(
'Nickname already exists'
));
}
$user
->
nickname
=
$nickname
;
}
$user
->
bio
=
$bio
;
$user
->
avatar
=
$avatar
;
$user
->
save
();
...
...
application/api/controller/Validate.php
查看文件 @
8c99271
...
...
@@ -54,6 +54,23 @@ class Validate extends Api
}
/**
* 检测昵称
*
* @param string $nickname 昵称
* @param string $id 排除会员ID
*/
public
function
check_nickname_available
()
{
$email
=
$this
->
request
->
request
(
'nickname'
);
$id
=
(
int
)
$this
->
request
->
request
(
'id'
);
$count
=
User
::
where
(
'nickname'
,
'='
,
$email
)
->
where
(
'id'
,
'<>'
,
$id
)
->
count
();
if
(
$count
>
0
)
{
$this
->
error
(
__
(
'昵称已经被占用'
));
}
$this
->
success
();
}
/**
* 检测手机
*
* @param string $mobile 手机号
...
...
application/api/lang/zh-cn/user.php
查看文件 @
8c99271
...
...
@@ -11,6 +11,7 @@ return [
'Password must be 6 to 30 characters'
=>
'密码必须6-30个字符'
,
'Mobile is incorrect'
=>
'手机格式不正确'
,
'Username already exist'
=>
'用户名已经存在'
,
'Nickname already exist'
=>
'昵称已经存在'
,
'Email already exist'
=>
'邮箱已经存在'
,
'Mobile already exist'
=>
'手机号已经存在'
,
'Username is incorrect'
=>
'用户名不正确'
,
...
...
application/index/view/user/profile.html
查看文件 @
8c99271
...
...
@@ -59,7 +59,7 @@
<
div
class
=
"
form-group
"
>
<
label
class
=
"
control-label
col-xs-12
col-sm-2
"
>
{
:__('Nickname')
}
:</
label
>
<
div
class
=
"
col-xs-12
col-sm-4
"
>
<
input
type
=
"
text
"
class
=
"
form-control
"
id
=
"
nickname
"
name
=
"
nickname
"
value
=
"
{
$user.nickname|htmlentities
}
"
data-rule
=
"
required
"
placeholder
=
""
>
<
input
type
=
"
text
"
class
=
"
form-control
"
id
=
"
nickname
"
name
=
"
nickname
"
value
=
"
{
$user.nickname|htmlentities
}
"
data-rule
=
"
required
;
remote
(
{
:url('api/validate/check_nickname_available')
}
,
id
=
{
$user.id
}
)
"
placeholder
=
""
>
</
div
>
</
div
>
<
div
class
=
"
form-group
"
>
...
...
请
注册
或
登录
后发表评论