Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-Server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
李帅
2022-12-26 16:15:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
80140bc26804e1e69e2d7b338546560084f120c5
80140bc2
1 parent
26af4b6d
1.微调一下接口,打印参数
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
app/Admin/Controllers/PushController.php
app/Admin/Controllers/PushController.php
0 → 100755
View file @
80140bc
<?php
namespace
App\Admin\Controllers
;
use
App\Models\Push
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
class
PushController
extends
AdminController
{
protected
$title
=
'推送服务'
;
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
Push
(),
function
(
Grid
$grid
)
{
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'title'
);
$grid
->
column
(
'terminal'
);
$grid
->
column
(
'push_type'
);
$grid
->
column
(
'push_time'
);
$grid
->
column
(
'action_type'
);
$grid
->
column
(
'user_type'
);
$grid
->
column
(
'updated_at'
)
->
sortable
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
new
Push
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'title'
);
$show
->
field
(
'terminal'
);
$show
->
field
(
'push_type'
);
$show
->
field
(
'push_time'
);
$show
->
field
(
'action_type'
);
$show
->
field
(
'user_type'
);
$show
->
field
(
'updated_at'
);
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
()
{
return
Form
::
make
(
new
Push
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
$form
->
block
(
8
,
function
(
Form\BlockForm
$form
)
{
// 设置标题
$form
->
title
(
'基本设置'
);
// 显示底部提交按钮
$form
->
showFooter
();
// 设置字段宽度
$form
->
width
(
8
,
3
);
$form
->
radio
(
'terminal'
)
->
addElementClass
(
'terminal'
)
->
options
([
1
=>
'Android'
,
2
=>
'IOS'
])
->
default
(
2
);
$form
->
text
(
'title'
)
->
addElementClass
(
'title'
);
$form
->
textarea
(
'content'
)
->
addElementClass
(
'push_content'
);
$form
->
radio
(
'push_type'
,
'发送时间'
)
->
addElementClass
(
'push_type'
)
->
options
([
1
=>
'立即'
,
2
=>
'定时'
])
->
default
(
1
)
->
when
(
2
,
function
(
Form\BlockForm
$form
)
{
$form
->
datetime
(
'push_time'
);
});
$form
->
select
(
'action_type'
)
->
addElementClass
(
'action_type'
)
->
options
([
'打开应用'
,
'临境'
,
'会员介绍页'
,
'众妙页'
]);
$form
->
radio
(
'user_type'
,
'目标人群'
)
->
options
([
1
=>
'所有人'
,
2
=>
'指定用户'
])
->
default
(
1
)
->
when
(
2
,
function
(
Form\BlockForm
$form
)
{
$form
->
text
(
'user_id'
)
->
placeholder
(
"多个用户用逗号,分开"
);
});
});
$form
->
block
(
4
,
function
(
Form\BlockForm
$form
)
{
$form
->
width
(
9
,
1
);
$form
->
html
(
view
(
'admin.form.push'
));
});
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
}
public
function
store
()
{
dd
(
request
()
->
all
());
}
}
Please
register
or
login
to post a comment