Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
61a677fe
authored
Nov 21, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增邮箱判断
parent
56373fb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
app/Admin/Service/UserService.php
app/Models/User.php
app/Admin/Service/UserService.php
View file @
61a677fe
...
...
@@ -111,6 +111,12 @@ class UserService
{
try
{
DB
::
beginTransaction
();
//判断邮箱是否唯一
$email
=
$params
[
'email'
]
??
''
;
$userInfo
=
User
::
getInfoByEmail
(
$email
);
if
(
$userInfo
)
{
throw
new
\Exception
(
"user email already exists"
);
}
$userData
=
[
"company_name"
=>
$params
[
"company_name"
]
??
""
,
"user_sn"
=>
$params
[
"user_sn"
]
??
""
,
...
...
app/Models/User.php
View file @
61a677fe
...
...
@@ -64,6 +64,12 @@ class User extends BaseModel
$res
=
self
::
where
(
'id'
,
$userId
)
->
first
();
return
(
$res
)
?
$res
->
toArray
()
:
[];
}
//根据邮箱获取用户信息
public
static
function
getInfoByEmail
(
$email
)
{
$res
=
self
::
where
(
'email'
,
$email
)
->
first
();
return
(
$res
)
?
$res
->
toArray
()
:
[];
}
// 批量获取用户信息
public
static
function
getInfoByUserIds
(
$userId
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment