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
6b80ce3e
authored
Nov 16, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化客户列表
parent
773a7ca3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
app/Admin/Controllers/UserController.php
app/Admin/Service/UserService.php
app/Admin/Controllers/UserController.php
View file @
6b80ce3e
...
...
@@ -114,13 +114,13 @@ class UserController extends AdminController
}
UserService
::
createUserAndAddress
(
$params
);
}
catch
(
\Throwable
$throwable
)
{
var_dump
((
string
)
$throwable
);
//
var_dump((string)$throwable);
return
Form
::
make
()
->
response
()
->
error
(
trans
(
'admin.save_failed'
))
->
withExceptionIf
(
$throwable
->
getMessage
(),
$throwable
);
}
$url
=
admin_url
(
"/users
/list
"
);
return
Form
::
make
()
->
response
()
->
success
(
'操作成功'
)
->
redirect
(
$url
)
->
refresh
(
);
$url
=
admin_url
(
"/users"
);
return
Form
::
make
()
->
response
()
->
success
(
admin_trans
(
"succeeded"
))
->
redirect
(
$url
);
}
...
...
app/Admin/Service/UserService.php
View file @
6b80ce3e
...
...
@@ -104,8 +104,8 @@ class UserService
"phone"
=>
$params
[
"phone"
],
"email"
=>
$params
[
"email"
],
"reg_source"
=>
User
::
REG_SOURCE_MANUAL
,
"remark"
=>
$params
[
"remark"
],
"password"
=>
"123456
7
"
,
"remark"
=>
$params
[
"remark"
]
??
""
,
"password"
=>
"123456"
,
"status"
=>
User
::
STATUS_NORMAL
,
"sale_id"
=>
request
()
->
user
->
userId
??
"1000"
,
"sale_name"
=>
request
()
->
user
->
name
??
"admin"
,
...
...
@@ -115,6 +115,9 @@ class UserService
$userId
=
User
::
insertData
(
$userData
);
foreach
(
$params
[
'user_address_list'
]
as
$address
)
{
if
(
$address
[
'_remove_'
])
{
continue
;
}
$validator
=
Validator
::
make
(
$address
,
[
'first_name'
=>
'required'
,
'last_name'
=>
'required'
,
...
...
@@ -128,7 +131,7 @@ class UserService
]);
if
(
$validator
->
fails
())
{
$error
=
$validator
->
errors
()
->
first
();
throw
new
\Exception
(
$error
);
throw
new
\Exception
(
"user addressList failed:"
.
$error
);
}
$addressData
=
[
"user_id"
=>
$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