fix
This commit is contained in:
@@ -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{}, "设置成功")
|
||||
|
||||
Reference in New Issue
Block a user