2022-08-26 20:15:36 +08:00
|
|
|
package router
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"mayfly-go/internal/sys/api"
|
|
|
|
|
"mayfly-go/internal/sys/application"
|
2023-01-14 16:29:52 +08:00
|
|
|
"mayfly-go/pkg/req"
|
2022-08-26 20:15:36 +08:00
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func InitSysConfigRouter(router *gin.RouterGroup) {
|
2022-09-09 18:26:08 +08:00
|
|
|
r := &api.Config{ConfigApp: application.GetConfigApp()}
|
2023-07-08 20:05:55 +08:00
|
|
|
configG := router.Group("sys/configs")
|
|
|
|
|
|
|
|
|
|
baseP := req.NewPermission("config:base")
|
|
|
|
|
|
|
|
|
|
reqs := [...]*req.Conf{
|
|
|
|
|
req.NewGet("", r.Configs).RequiredPermission(baseP),
|
|
|
|
|
|
|
|
|
|
// 获取指定配置key对应的值
|
2023-07-20 20:34:05 +08:00
|
|
|
req.NewGet("/value", r.GetConfigValueByKey).RequiredPermission(baseP),
|
2023-07-08 20:05:55 +08:00
|
|
|
|
|
|
|
|
req.NewPost("", r.SaveConfig).Log(req.NewLogSave("保存系统配置信息")).RequiredPermissionCode("config:save"),
|
2022-08-26 20:15:36 +08:00
|
|
|
}
|
2023-07-08 20:05:55 +08:00
|
|
|
|
|
|
|
|
req.BatchSetGroup(configG, reqs[:])
|
2022-08-26 20:15:36 +08:00
|
|
|
}
|