feat: config
This commit is contained in:
@@ -21,18 +21,30 @@ use RedisException;
|
|||||||
])]
|
])]
|
||||||
class ConfigController extends AbstractController
|
class ConfigController extends AbstractController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* 获取配置模块
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
#[RequestMapping(path: "module", methods: "GET")]
|
#[RequestMapping(path: "module", methods: "GET")]
|
||||||
public function getConfigModule()
|
public function getConfigModule()
|
||||||
{
|
{
|
||||||
return (new ConfigService)->getConfigModule();
|
return (new ConfigService)->getConfigModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配置数据
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
#[RequestMapping(path: "form", methods: "GET")]
|
#[RequestMapping(path: "form", methods: "GET")]
|
||||||
public function getConfigForm()
|
public function getConfigForm()
|
||||||
{
|
{
|
||||||
return (new ConfigService)->getConfigForm();
|
return (new ConfigService)->getConfigForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配置
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
#[RequestMapping(path: "update", methods: "POST")]
|
#[RequestMapping(path: "update", methods: "POST")]
|
||||||
public function updateConfig()
|
public function updateConfig()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,10 +64,12 @@ class ConfigService extends BaseService
|
|||||||
*/
|
*/
|
||||||
public function getConfigForm(): array
|
public function getConfigForm(): array
|
||||||
{
|
{
|
||||||
$list = $this->configModel->getConfigByPid($this->request->input('pid'));
|
$pid = (int)$this->request->input('pid');
|
||||||
|
|
||||||
|
$list = $this->configModel->getConfigByPid($pid);
|
||||||
|
|
||||||
foreach ($list as &$item) {
|
foreach ($list as &$item) {
|
||||||
switch ($item['type']) {
|
switch ($item['input_type']) {
|
||||||
case 2:
|
case 2:
|
||||||
$data = explode('|', $item['value']);
|
$data = explode('|', $item['value']);
|
||||||
$item['min'] = (int)$data[0];
|
$item['min'] = (int)$data[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user