Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ucenter
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
53a50fbf
authored
Jan 16, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
注册登录完善
parent
17b8616e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
app/Http/Controllers/Api/AuthController.php
app/Http/Requests/UserRegister.php
app/Http/Services/UserService.php
app/Http/Controllers/Api/AuthController.php
View file @
53a50fbf
...
@@ -18,6 +18,7 @@ class AuthController extends Controller
...
@@ -18,6 +18,7 @@ class AuthController extends Controller
'email'
,
'email'
,
'password'
,
'password'
,
'salt'
,
'salt'
,
'init_org_id'
,
]);
]);
$user
=
UserService
::
register
(
$data
);
$user
=
UserService
::
register
(
$data
);
...
...
app/Http/Requests/UserRegister.php
View file @
53a50fbf
...
@@ -30,7 +30,15 @@ class UserRegister extends FormRequest
...
@@ -30,7 +30,15 @@ class UserRegister extends FormRequest
'password'
=>
'required'
,
'password'
=>
'required'
,
'salt'
=>
'required'
,
'salt'
=>
'required'
,
'mobile'
=>
'required_without:email'
,
'mobile'
=>
'required_without:email'
,
'email'
=>
'required_without:mobile'
'email'
=>
'required_without:mobile'
,
'init_org_id'
=>
'required'
];
}
public
function
attributes
()
{
return
[
'init_org_id'
=>
'组织id'
];
];
}
}
...
...
app/Http/Services/UserService.php
View file @
53a50fbf
...
@@ -18,7 +18,7 @@ class UserService
...
@@ -18,7 +18,7 @@ class UserService
$ucId
=
UserModel
::
where
(
'email'
,
$data
[
'email'
])
->
value
(
'uc_id'
);
$ucId
=
UserModel
::
where
(
'email'
,
$data
[
'email'
])
->
value
(
'uc_id'
);
}
}
if
(
!
$ucId
)
{
if
(
!
$ucId
)
{
//去新增注册
//去新增注册
$data
[
'create_time'
]
=
time
();
$data
[
'create_time'
]
=
time
();
$ucId
=
UserModel
::
insertGetId
(
$data
);
$ucId
=
UserModel
::
insertGetId
(
$data
);
...
@@ -31,7 +31,7 @@ class UserService
...
@@ -31,7 +31,7 @@ class UserService
'create_time'
,
'create_time'
,
])
->
where
(
'uc_id'
,
$ucId
)
->
first
();
])
->
where
(
'uc_id'
,
$ucId
)
->
first
();
UserModel
::
where
(
'uc_id'
,
$user
[
'uc_id'
])
->
update
([
'last_login_time'
],
time
()
);
UserModel
::
where
(
'uc_id'
,
$user
[
'uc_id'
])
->
update
([
'last_login_time'
=>
time
()]
);
return
$user
;
return
$user
;
}
}
...
@@ -58,7 +58,7 @@ class UserService
...
@@ -58,7 +58,7 @@ class UserService
'create_time'
,
'create_time'
,
])
->
where
(
'password'
,
$passwordHash
)
->
first
();
])
->
where
(
'password'
,
$passwordHash
)
->
first
();
UserModel
::
where
(
'uc_id'
,
$user
[
'uc_id'
])
->
update
([
'last_login_time'
],
time
()
);
UserModel
::
where
(
'uc_id'
,
$user
[
'uc_id'
])
->
update
([
'last_login_time'
=>
time
()]
);
return
$user
?:
[];
return
$user
?:
[];
...
...
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