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
3350abd8
authored
Nov 10, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增转让客户
parent
d6f05ad6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
13 deletions
app/Admin/Actions/User/UserTransferAction.php
app/Admin/Actions/User/UserTransferAction.php
View file @
3350abd8
...
@@ -3,10 +3,12 @@
...
@@ -3,10 +3,12 @@
namespace
App\Admin\Actions\User
;
namespace
App\Admin\Actions\User
;
use
App\Admin\Forms\User\AssignUserHandle
;
use
App\Models\Order
as
OrderModel
;
use
App\Models\Order
as
OrderModel
;
use
App\Models\User
;
use
App\Models\User
;
use
Dcat\Admin\Grid\BatchAction
;
use
Dcat\Admin\Grid\BatchAction
;
use
Dcat\Admin\Grid\Tools\AbstractTool
;
use
Dcat\Admin\Grid\Tools\AbstractTool
;
use
Dcat\Admin\Widgets\Modal
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Dcat\Admin\Grid\RowAction
;
use
Dcat\Admin\Grid\RowAction
;
...
@@ -14,6 +16,7 @@ use Dcat\Admin\Grid\RowAction;
...
@@ -14,6 +16,7 @@ use Dcat\Admin\Grid\RowAction;
class
UserTransferAction
extends
BatchAction
class
UserTransferAction
extends
BatchAction
{
{
protected
$action
;
protected
$action
;
protected
$htmlClasses
=
[
'btn btn-primary btn-sm btn-mini'
];
// 注意action的构造方法参数一定要给默认值
// 注意action的构造方法参数一定要给默认值
public
function
__construct
(
$title
=
null
,
$action
=
1
)
public
function
__construct
(
$title
=
null
,
$action
=
1
)
...
@@ -25,18 +28,37 @@ class UserTransferAction extends BatchAction
...
@@ -25,18 +28,37 @@ class UserTransferAction extends BatchAction
// 确认弹窗信息
// 确认弹窗信息
public
function
confirm
()
public
function
confirm
()
{
{
return
'您确定要发布已选中的文章吗?'
;
return
'您确定要已选中的文章吗?'
;
}
public
function
render
()
{
$form
=
AssignUserHandle
::
make
();
$buttonName
=
trans
(
'user.labels.handle'
);
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>
</button>'
);
}
protected
function
getModalScript
()
{
// 弹窗显示后往隐藏的id表单中写入批量选中的行ID
$warning
=
trans
(
'global.labels.operate_must_select_data'
);
return
<<<JS
var key = {$this->getSelectedKeysScript()}
if (!key.length){
Dcat.swal.error('$warning');
Dcat.reload();
}
$('#id').val(key);
JS;
}
}
public
function
html
()
public
function
html
()
{
{
$class
=
$this
->
getElementClass
();
$this
->
setHtmlAttribute
([
"class"
=>
"
{
$class
}
btn btn-primary btn-sm btn-mini"
,
]);
return
parent
::
html
();
// TODO: Change the autogenerated stub
return
parent
::
html
();
// TODO: Change the autogenerated stub
}
}
// 处理请求
// 处理请求
public
function
handle
(
Request
$request
)
public
function
handle
(
Request
$request
)
{
{
...
@@ -46,11 +68,6 @@ class UserTransferAction extends BatchAction
...
@@ -46,11 +68,6 @@ class UserTransferAction extends BatchAction
// 获取请求参数
// 获取请求参数
$action
=
$request
->
get
(
'action'
);
$action
=
$request
->
get
(
'action'
);
foreach
(
Post
::
find
(
$keys
)
as
$post
)
{
$post
->
released
=
$action
;
$post
->
save
();
}
$message
=
$action
?
'文章发布成功'
:
'文章下线成功'
;
$message
=
$action
?
'文章发布成功'
:
'文章下线成功'
;
return
$this
->
response
()
->
success
(
$message
)
->
refresh
();
return
$this
->
response
()
->
success
(
$message
)
->
refresh
();
...
@@ -64,5 +81,3 @@ class UserTransferAction extends BatchAction
...
@@ -64,5 +81,3 @@ class UserTransferAction extends BatchAction
];
];
}
}
}
}
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