Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bf1c2934
authored
Nov 07, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置
parent
1e1ccfd2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletions
+67
-1
app/Admin/Controllers/SiteConfigController.php
+17
-0
app/Admin/Extensions/Form/SiteConfigForm.php
+47
-0
app/Admin/routes.php
+3
-1
No files found.
app/Admin/Controllers/SiteConfigController.php
0 → 100644
View file @
bf1c2934
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\Form\SiteConfigForm
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Layout\Content
;
class
SiteConfigController
extends
AdminController
{
public
function
index
(
Content
$content
)
:
Content
{
return
$content
->
header
(
'全局设置'
)
->
description
(
''
)
->
body
(
new
SiteConfigForm
());
}
}
app/Admin/Extensions/Form/SiteConfigForm.php
0 → 100644
View file @
bf1c2934
<?php
namespace
App\Admin\Extensions\Form
;
use
Dcat\Admin\Widgets\Form
;
// use Dcat\Admin\Widgets\Form;
// 全局设置
class
SiteConfigForm
extends
Form
{
public
function
handle
(
array
$input
)
{
$data
=
[
'site_config'
=>
$input
,
];
admin_setting
(
$data
);
return
$this
->
response
()
->
location
(
'site-config'
)
->
success
(
'设置成功'
);
}
/**
* Build a form here.
*/
public
function
form
()
{
$data
=
admin_setting
(
'site_config'
);
$data
=
json_decode
(
$data
,
true
);
$this
->
number
(
'prescription_limit'
,
'医师开方上限(每天)'
)
->
required
()
->
default
((
$data
[
'prescription_limit'
]
??
0
));
$this
->
radio
(
'prescription_period_status'
,
'医师开方时间段'
)
->
options
([
1
=>
'开启'
,
0
=>
'关闭'
])
->
when
(
1
,
function
(
Form
$form
)
use
(
$data
)
{
$form
->
width
(
4
)
->
time
(
'prescription_period_start'
,
'开始'
)
->
format
(
'HH:mm'
)
->
rules
(
'required_if:prescription_period_status,1'
)
->
setLabelClass
([
'asterisk'
])
->
default
((
$data
[
'prescription_period_start'
]
??
''
));
$form
->
width
(
4
)
->
time
(
'prescription_period_end'
,
'截止'
)
->
format
(
'HH:mm'
)
->
rules
(
'required_if:prescription_period_status,1'
)
->
setLabelClass
([
'asterisk'
])
->
default
((
$data
[
'prescription_period_end'
]
??
''
));
})
->
default
((
$data
[
'prescription_period_status'
]
??
0
));
$this
->
number
(
'prescription_limit_buy_7'
,
'7日内限购(全局)'
)
->
required
()
->
default
((
$data
[
'prescription_limit_buy_7'
]
??
0
));
$this
->
switch
(
'prescription_auto'
,
'医师自动开方'
)
->
default
((
$data
[
'prescription_auto'
]
??
0
));
$this
->
disableResetButton
();
}
}
app/Admin/routes.php
View file @
bf1c2934
...
...
@@ -28,8 +28,10 @@
$router
->
resource
(
'pharmacy'
,
'PharmacyController'
);
// 药师
$router
->
resource
(
'pharmacist'
,
'PharmacistController'
);
//标签
//
标签
$router
->
resource
(
'tag'
,
'TagController'
);
// 设置
$router
->
resource
(
'site-config'
,
'SiteConfigController'
);
// 导入日志
$router
->
resource
(
'/import-log'
,
'Common\ImportLogController'
)
->
names
(
'import-log'
);
});
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