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
ca951ee9
authored
Nov 21, 2022
by
孙龙
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://git.ichunt.net/semour/semour_admin
parents
16dc8515
f66afe25
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
4 deletions
app/Admin/Actions/User/UserEditAction.php
app/Admin/Renderable/UserDetail.php
app/Admin/Service/UserService.php
app/Models/User.php
config/app.php
app/Admin/Actions/User/UserEditAction.php
View file @
ca951ee9
...
...
@@ -29,7 +29,7 @@ class UserEditAction extends AbstractTool
public
function
render
()
{
$form
=
EditUserHandle
::
make
([
'key'
=>
$this
->
getKey
()]);
$buttonName
=
trans
(
'user.labels.handle
'
);
$buttonName
=
admin_trans
(
'edit
'
);
return
Modal
::
make
()
->
lg
()
->
title
(
$this
->
title
)
->
body
(
$form
->
payload
([
'key'
=>
$this
->
getKey
()]))
->
onLoad
(
$this
->
getModalScript
())
->
button
(
'<button style="margin-right: 5px" class="btn btn-sm btn-primary">
<i class="feather icon-check-circle"></i> <span class="d-none d-sm-inline" style="margin-left: 5px">'
.
...
...
app/Admin/Renderable/UserDetail.php
View file @
ca951ee9
...
...
@@ -21,7 +21,7 @@ class UserDetail extends \Dcat\Admin\Support\LazyRenderable
return
Show
::
make
(
$id
,
new
User
(),
function
(
Show
$show
)
{
$show
->
panel
()
->
tools
(
function
(
Show\Tools
$tools
)
{
$userEditAction
=
new
UserEditAction
(
"用户编辑"
);
$userEditAction
=
new
UserEditAction
(
admin_trans
(
"edit"
)
);
$userEditAction
->
setKey
(
$this
->
key
);
$tools
->
disableDelete
();
$tools
->
disableEdit
();
...
...
app/Admin/Service/UserService.php
View file @
ca951ee9
...
...
@@ -51,7 +51,7 @@ class UserService
$grid
->
column
(
'remark'
);
$grid
->
column
(
'sale_name'
);
$grid
->
column
(
'order_num_data'
)
->
display
(
function
(
$order_num_data
)
{
$data
=
InquiryService
::
getInquiryCountByUserIds
([
$this
->
id
])[
$this
->
id
]
??
[
$data
=
OrderService
::
getUserOrderStatistical
([
$this
->
id
])[
$this
->
id
]
??
[
"pending"
=>
0
,
"all"
=>
0
];
...
...
@@ -68,6 +68,8 @@ class UserService
return
$time
?
date
(
'Y-m-d H:i:s'
,
$time
)
:
''
;
})
->
sortable
();;
$grid
->
column
(
'status'
)
->
using
(
admin_trans
(
'user.options.status'
));
//客户来源
$grid
->
column
(
'reg_source'
)
->
using
(
admin_trans
(
'user.options.reg_source'
));
}
public
static
function
userListTool
(
Grid
$grid
)
...
...
@@ -111,6 +113,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"
]
??
""
,
...
...
@@ -143,6 +151,7 @@ class UserService
'phone'
=>
'required'
,
'country'
=>
'required'
,
'city'
=>
'required'
,
'address_type'
=>
'required'
,
'post_code'
=>
'required'
,
'detail_address'
=>
'required'
,
'is_default'
=>
'required'
,
...
...
app/Models/User.php
View file @
ca951ee9
...
...
@@ -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
)
...
...
config/app.php
View file @
ca951ee9
...
...
@@ -67,7 +67,7 @@ return [
|
*/
'timezone'
=>
'
UTC
'
,
'timezone'
=>
'
Asia/Shanghai
'
,
/*
|--------------------------------------------------------------------------
...
...
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