Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
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
afe33c71
authored
Nov 18, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
用户修改sn
parent
f1cc3fbb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
app/Http/Controllers/HomeController.php
app/Http/Services/UserService.php
app/Models/UserModel.php
app/Http/Controllers/HomeController.php
View file @
afe33c71
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\Http\Services\UserService
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
class
HomeController
extends
Controller
class
HomeController
extends
Controller
...
...
app/Http/Services/UserService.php
View file @
afe33c71
...
@@ -9,12 +9,10 @@ use Illuminate\Support\Facades\Redis;
...
@@ -9,12 +9,10 @@ use Illuminate\Support\Facades\Redis;
class
UserService
class
UserService
{
{
public
static
function
generateSn
()
public
static
function
generateSn
(
$userId
)
{
{
$maxInquiryId
=
UserModel
::
orderBy
(
'id'
,
'desc'
)
->
value
(
'id'
);
$id
=
str_pad
(
$userId
,
6
,
0
,
STR_PAD_LEFT
);
$id
=
str_pad
((
$maxInquiryId
+
1
),
6
,
0
,
STR_PAD_LEFT
);
return
'SU'
.
$id
;
$time
=
Carbon
::
now
()
->
addMonths
(
-
9
)
->
addDays
(
-
10
)
->
timestamp
;
return
date
(
'Ymd'
,
$time
)
.
$id
;
}
}
}
}
app/Models/UserModel.php
View file @
afe33c71
...
@@ -43,17 +43,20 @@ class UserModel extends Authenticatable implements MustVerifyEmail
...
@@ -43,17 +43,20 @@ class UserModel extends Authenticatable implements MustVerifyEmail
public
static
function
createUser
(
$data
)
public
static
function
createUser
(
$data
)
{
{
return
UserModel
::
insertGetId
([
$userId
=
UserModel
::
insertGetId
([
'first_name'
=>
$data
[
'first_name'
],
'first_name'
=>
$data
[
'first_name'
],
'last_name'
=>
$data
[
'last_name'
],
'last_name'
=>
$data
[
'last_name'
],
'email'
=>
$data
[
'email'
],
'email'
=>
$data
[
'email'
],
'phone'
=>
$data
[
'phone'
],
'phone'
=>
$data
[
'phone'
],
'email_verified_at'
=>
now
(),
'email_verified_at'
=>
now
(),
'company_name'
=>
$data
[
'company_name'
],
'company_name'
=>
$data
[
'company_name'
],
'user_sn'
=>
UserService
::
generateSn
(),
'account_properties'
=>
$data
[
'account_properties'
],
'account_properties'
=>
$data
[
'account_properties'
],
'password'
=>
Hash
::
make
(
$data
[
'password'
]),
'password'
=>
Hash
::
make
(
$data
[
'password'
]),
]);
]);
$userSn
=
UserService
::
generateSn
(
$userId
);
return
self
::
where
(
'id'
,
$userId
)
->
update
([
'user_sn'
=>
$userSn
,
]);
}
}
//获取用户详情
//获取用户详情
...
...
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