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
773a7ca3
authored
Nov 16, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/semour/semour_admin
parents
d10f0c26
d37c3f4b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
87 deletions
app/Admin/Actions/User/UserStatusAction.php
app/Admin/Actions/User/UserTransferAction.php
app/Admin/Controllers/UserController.php
app/Admin/Service/UserService.php
resources/lang/en/user.php
app/Admin/Actions/User/UserStatusAction.php
View file @
773a7ca3
...
@@ -29,9 +29,9 @@ class UserStatusAction extends RowAction
...
@@ -29,9 +29,9 @@ class UserStatusAction extends RowAction
*/
*/
public
function
title
()
public
function
title
()
{
{
$buttonName
=
"启用"
;
$buttonName
=
admin_trans
(
"enable"
)
;
if
(
$this
->
row
->
status
==
User
::
STATUS_NORMAL
)
{
if
(
$this
->
row
->
status
==
User
::
STATUS_NORMAL
)
{
$buttonName
=
"禁用"
;
$buttonName
=
admin_trans
(
"disable"
)
;
}
}
return
$buttonName
;
return
$buttonName
;
}
}
...
@@ -59,11 +59,11 @@ class UserStatusAction extends RowAction
...
@@ -59,11 +59,11 @@ class UserStatusAction extends RowAction
*/
*/
public
function
confirm
()
public
function
confirm
()
{
{
$buttonName
=
"启用"
;
$buttonName
=
admin_trans
(
"enable"
)
;
if
(
$this
->
row
->
status
==
User
::
STATUS_NORMAL
)
{
if
(
$this
->
row
->
status
==
User
::
STATUS_NORMAL
)
{
$buttonName
=
"禁用"
;
$buttonName
=
admin_trans
(
"disable"
)
;
}
}
return
[
"
是否确认
{
$buttonName
}
?"
];
return
[
"
confirm
{
$buttonName
}
?"
];
}
}
/**
/**
...
@@ -85,7 +85,7 @@ class UserStatusAction extends RowAction
...
@@ -85,7 +85,7 @@ class UserStatusAction extends RowAction
}
catch
(
\Throwable
$e
)
{
}
catch
(
\Throwable
$e
)
{
return
$this
->
response
()
->
error
(
$e
->
getMessage
());
return
$this
->
response
()
->
error
(
$e
->
getMessage
());
}
}
return
$this
->
response
()
->
success
(
'操作成功'
)
->
refresh
();
return
$this
->
response
()
->
success
(
admin_trans
(
"succeeded"
)
)
->
refresh
();
}
}
/**
/**
...
...
app/Admin/Actions/User/UserTransferAction.php
View file @
773a7ca3
...
@@ -19,22 +19,16 @@ class UserTransferAction extends BatchAction
...
@@ -19,22 +19,16 @@ class UserTransferAction extends BatchAction
protected
$htmlClasses
=
[
'btn btn-primary btn-sm btn-mini'
];
protected
$htmlClasses
=
[
'btn btn-primary btn-sm btn-mini'
];
// 注意action的构造方法参数一定要给默认值
// 注意action的构造方法参数一定要给默认值
public
function
__construct
(
$title
=
null
,
$action
=
1
)
public
function
__construct
()
{
{
$this
->
title
=
$title
;
$this
->
title
=
trans
(
'user.labels.transfer'
);
$this
->
action
=
$action
;
$this
->
action
=
1
;
}
// 确认弹窗信息
public
function
confirm
()
{
return
'您确定要已选中的文章吗?'
;
}
}
public
function
render
()
public
function
render
()
{
{
$form
=
AssignUserHandle
::
make
();
$form
=
AssignUserHandle
::
make
();
$buttonName
=
trans
(
'user.labels.
handle
'
);
$buttonName
=
trans
(
'user.labels.
transfer
'
);
return
Modal
::
make
()
->
lg
()
->
title
(
$this
->
title
)
->
body
(
$form
->
payload
([]))
->
onLoad
(
$this
->
getModalScript
())
->
button
(
'<button class="btn btn-primary">
return
Modal
::
make
()
->
lg
()
->
title
(
$this
->
title
)
->
body
(
$form
->
payload
([]))
->
onLoad
(
$this
->
getModalScript
())
->
button
(
'<button class="btn btn-primary">
<i class="feather icon-check-circle"></i><span class="d-none d-sm-inline" style="margin-left: 5px">'
.
$buttonName
.
'</span>
<i class="feather icon-check-circle"></i><span class="d-none d-sm-inline" style="margin-left: 5px">'
.
$buttonName
.
'</span>
</button>'
);
</button>'
);
...
@@ -62,14 +56,7 @@ JS;
...
@@ -62,14 +56,7 @@ JS;
// 处理请求
// 处理请求
public
function
handle
(
Request
$request
)
public
function
handle
(
Request
$request
)
{
{
// 获取选中的文章ID数组
$message
=
admin_trans
(
"succeeded"
);
$keys
=
$this
->
getKey
();
// 获取请求参数
$action
=
$request
->
get
(
'action'
);
$message
=
$action
?
'文章发布成功'
:
'文章下线成功'
;
return
$this
->
response
()
->
success
(
$message
)
->
refresh
();
return
$this
->
response
()
->
success
(
$message
)
->
refresh
();
}
}
...
...
app/Admin/Controllers/UserController.php
View file @
773a7ca3
...
@@ -114,23 +114,14 @@ class UserController extends AdminController
...
@@ -114,23 +114,14 @@ class UserController extends AdminController
}
}
UserService
::
createUserAndAddress
(
$params
);
UserService
::
createUserAndAddress
(
$params
);
}
catch
(
\Throwable
$throwable
)
{
}
catch
(
\Throwable
$throwable
)
{
return
$this
->
form
()
->
response
()
var_dump
((
string
)
$throwable
);
return
Form
::
make
()
->
response
()
->
error
(
trans
(
'admin.save_failed'
))
->
error
(
trans
(
'admin.save_failed'
))
->
withExceptionIf
(
$throwable
->
getMessage
(),
$throwable
);
->
withExceptionIf
(
$throwable
->
getMessage
(),
$throwable
);
}
}
$url
=
admin_url
(
"/users/list"
);
$url
=
admin_url
(
"/users/list"
);
return
$this
->
form
()
->
response
()
->
success
(
'操作成功'
)
->
redirect
(
$url
)
->
refresh
();
return
Form
::
make
()
->
response
()
->
success
(
'操作成功'
)
->
redirect
(
$url
)
->
refresh
();
}
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
()
{
return
Form
::
dialog
(
"测试"
);
// return $form;
}
}
}
app/Admin/Service/UserService.php
View file @
773a7ca3
...
@@ -23,10 +23,10 @@ class UserService
...
@@ -23,10 +23,10 @@ class UserService
{
{
$grid
->
filter
(
function
(
$filter
)
{
$grid
->
filter
(
function
(
$filter
)
{
$filter
->
expand
(
true
);
$filter
->
expand
(
true
);
$filter
->
whereBetween
(
'create_time'
,
function
(
$q
)
{
$filter
->
whereBetween
(
'create
d
_time'
,
function
(
$q
)
{
$start
=
strtotime
(
$this
->
input
[
'start'
]
??
null
);
$start
=
strtotime
(
$this
->
input
[
'start'
]
??
null
);
$end
=
strtotime
(
$this
->
input
[
'end'
]
??
null
);
$end
=
strtotime
(
$this
->
input
[
'end'
]
??
null
);
$q
->
whereBetween
(
'create_time'
,
[
$start
,
$end
]);
$q
->
whereBetween
(
'create
d
_time'
,
[
$start
,
$end
]);
})
->
datetime
()
->
width
(
3
);
})
->
datetime
()
->
width
(
3
);
$filter
->
startWith
(
'company_name'
)
->
width
(
2
);
$filter
->
startWith
(
'company_name'
)
->
width
(
2
);
...
@@ -59,8 +59,8 @@ class UserService
...
@@ -59,8 +59,8 @@ class UserService
public
static
function
userListTool
(
Grid
$grid
)
public
static
function
userListTool
(
Grid
$grid
)
{
{
$grid
->
tools
([
$grid
->
tools
([
new
UserTransferAction
(
"转让销售"
),
new
UserTransferAction
(),
new
UserAssignAction
(
"分配销售"
),
new
UserAssignAction
(),
]);
]);
}
}
...
@@ -78,7 +78,7 @@ class UserService
...
@@ -78,7 +78,7 @@ class UserService
// 获取当前行主键值
// 获取当前行主键值
$id
=
$actions
->
getKey
();
$id
=
$actions
->
getKey
();
$actions
->
append
(
'<a style="margin-right: 5px" href="'
.
admin_url
(
"/users/
{
$id
}
"
)
.
'" class="btn btn-primary btn-sm
$actions
->
append
(
'<a style="margin-right: 5px" href="'
.
admin_url
(
"/users/
{
$id
}
"
)
.
'" class="btn btn-primary btn-sm
btn-mini">
detail
</a>'
);
btn-mini">
'
.
admin_trans
(
"detail"
)
.
'
</a>'
);
//状态按钮
//状态按钮
$actions
->
append
(
new
UserStatusAction
());
$actions
->
append
(
new
UserStatusAction
());
});
});
...
@@ -107,8 +107,8 @@ class UserService
...
@@ -107,8 +107,8 @@ class UserService
"remark"
=>
$params
[
"remark"
],
"remark"
=>
$params
[
"remark"
],
"password"
=>
"1234567"
,
"password"
=>
"1234567"
,
"status"
=>
User
::
STATUS_NORMAL
,
"status"
=>
User
::
STATUS_NORMAL
,
"sale_id"
=>
request
()
->
user
[
'userId'
]
??
"1000"
,
"sale_id"
=>
request
()
->
user
->
userId
??
"1000"
,
"sale_name"
=>
request
()
->
user
[
'name'
]
??
"admin"
,
"sale_name"
=>
request
()
->
user
->
name
??
"admin"
,
"created_time"
=>
time
(),
"created_time"
=>
time
(),
"update_time"
=>
time
(),
"update_time"
=>
time
(),
];
];
...
@@ -128,22 +128,22 @@ class UserService
...
@@ -128,22 +128,22 @@ class UserService
]);
]);
if
(
$validator
->
fails
())
{
if
(
$validator
->
fails
())
{
$error
=
$validator
->
errors
()
->
first
();
$error
=
$validator
->
errors
()
->
first
();
throw
new
\Exception
(
"客户地址错误:"
.
$error
);
throw
new
\Exception
(
$error
);
}
}
$addressData
=
[
$addressData
=
[
"user_id"
=>
$userId
,
"user_id"
=>
$userId
,
"first_name"
=>
$address
[
"first_name"
]
??
""
,
"first_name"
=>
$address
[
"first_name"
]
??
""
,
"last_name"
=>
$address
[
"last_name"
]
??
""
,
"last_name"
=>
$address
[
"last_name"
]
??
""
,
"address_type"
=>
$address
[
"address_type"
]
??
""
,
"address_type"
=>
$address
[
"address_type"
]
??
""
,
"company_name"
=>
$address
[
"company_name"
]
??
""
,
"company_name"
=>
$address
[
"company_name"
]
??
""
,
"email"
=>
$address
[
"email"
]
??
""
,
"email"
=>
$address
[
"email"
]
??
""
,
"phone"
=>
$address
[
"phone"
]
??
""
,
"phone"
=>
$address
[
"phone"
]
??
""
,
"country"
=>
$address
[
"country"
]
??
""
,
"country"
=>
$address
[
"country"
]
??
""
,
"province"
=>
$address
[
"province"
]
??
""
,
"province"
=>
$address
[
"province"
]
??
""
,
"city"
=>
$address
[
"city"
]
??
""
,
"city"
=>
$address
[
"city"
]
??
""
,
"post_code"
=>
$address
[
"post_code"
]
??
""
,
"post_code"
=>
$address
[
"post_code"
]
??
""
,
"detail_address"
=>
$address
[
"detail_address"
]
??
""
,
"detail_address"
=>
$address
[
"detail_address"
]
??
""
,
"is_default"
=>
$address
[
"is_default"
]
??
""
,
"is_default"
=>
$address
[
"is_default"
]
??
""
,
"create_time"
=>
time
(),
"create_time"
=>
time
(),
"update_time"
=>
time
(),
"update_time"
=>
time
(),
];
];
...
...
resources/lang/en/user.php
View file @
773a7ca3
<?php
<?php
return
[
return
[
'labels'
=>
[
'labels'
=>
[
'User'
=>
'User'
,
'User'
=>
'User'
,
'user'
=>
'User'
,
'user'
=>
'User'
,
'user_detail'
=>
'User Detail'
,
'handle'
=>
'Handle'
,
'transfer'
=>
'Transfer'
,
'assign'
=>
'Assign'
,
],
],
'fields'
=>
[
'fields'
=>
[
'user_sn'
=>
'客户编码'
,
'user_sn'
=>
'客户编码'
,
'name'
=>
'用户名'
,
'name'
=>
'用户名'
,
'email'
=>
'邮箱'
,
'email'
=>
'邮箱'
,
'email_verified_at'
=>
'邮箱校验时间'
,
'email_verified_at'
=>
'邮箱校验时间'
,
'password'
=>
'密码'
,
'password'
=>
'密码'
,
'remark'
=>
'备注'
,
'remark'
=>
'备注'
,
'phone'
=>
'手机号码'
,
'phone'
=>
'手机号码'
,
'remember_token'
=>
'记住登陆token'
,
'remember_token'
=>
'记住登陆token'
,
'account_properties'
=>
'账号属性'
,
'account_properties'
=>
'账号属性'
,
'status'
=>
'状态'
,
'status'
=>
'状态'
,
'company_name'
=>
'公司名称'
,
'company_name'
=>
'公司名称'
,
'first_name'
=>
'名字'
,
'first_name'
=>
'名字'
,
'sale_id'
=>
'业务员'
,
'sale_id'
=>
'业务员'
,
'sale_name'
=>
'业务员名字'
,
'sale_name'
=>
'业务员名字'
,
'last_name'
=>
'姓氏'
,
'last_name'
=>
'姓氏'
,
'created_time'
=>
'创建时间'
,
'created_time'
=>
'创建时间'
,
'update_time'
=>
'更新时间'
,
'update_time'
=>
'更新时间'
,
'reg_source'
=>
'注册来源'
,
'reg_source'
=>
'注册来源'
,
'user_address'
=>
[
'user_address'
=>
[
'consignee'
=>
'Sales Name'
,
'consignee'
=>
'Sales Name'
,
]
]
],
],
'options'
=>
[
'options'
=>
[
"status"
=>
[
"status"
=>
[
"1"
=>
"正常"
,
"1"
=>
"正常"
,
"-1"
=>
"禁用"
"-1"
=>
"禁用"
],
],
"reg_source"
=>
[
"reg_source"
=>
[
"1"
=>
"网站"
,
"1"
=>
"网站"
,
"2"
=>
"人工新增"
"2"
=>
"人工新增"
],
],
"account_properties"
=>
[
"account_properties"
=>
[
"1"
=>
"个人"
,
"1"
=>
"个人"
,
"2"
=>
"企业"
"2"
=>
"企业"
],
],
],
],
];
];
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