This commit is contained in:
2026-08-15 01:12:04 +08:00
parent f63acae353
commit 6698e59c3a
45 changed files with 725 additions and 415 deletions
+6 -6
View File
@@ -36,13 +36,13 @@ func (h *SystemConfig) GetSecurity(c *gin.Context) {
func (h *SystemConfig) SetSecurity(c *gin.Context) {
var req dto.SecurityConfigRequest
if c.ShouldBindJSON(&req) != nil {
httpx.Fail(c, "参数错误")
if err := c.ShouldBindJSON(&req); err != nil {
httpx.Fail(c, err.Error())
return
}
result, err := h.settings.SaveSecurityRequest(c.Request.Context(), &req)
if err != nil {
httpx.Fail(c, err.Error())
httpx.Fail(c, "设置安全配置失败")
return
}
httpx.Write(c, httpx.CodeSuccess, result, "设置成功")
@@ -54,12 +54,12 @@ func (h *SystemConfig) Get(c *gin.Context) {
func (h *SystemConfig) Set(c *gin.Context) {
var req dto.SetSystemConfigRequest
if c.ShouldBindJSON(&req) != nil {
httpx.Fail(c, "参数错误")
if err := c.ShouldBindJSON(&req); err != nil {
httpx.Fail(c, err.Error())
return
}
if err := h.system.SaveSystemConfig(c.Request.Context(), &req); err != nil {
httpx.Fail(c, "配置保存失败: "+err.Error())
httpx.Fail(c, "设置失败")
return
}
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "设置成功")