优化结构

This commit is contained in:
Yvan
2026-08-28 13:56:12 +08:00
parent 33ba777137
commit 56f9440a6b
32 changed files with 159 additions and 270 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ func (h *API) ApplySync(c *gin.Context) {
return
}
if err := h.service.ApplyAPISyncRequest(c.Request.Context(), &req); err != nil {
Fail(c, "忽略失败")
Fail(c, "同步失败")
return
}
OK(c)
+8 -8
View File
@@ -138,7 +138,7 @@ func (h *Audit) DataAccess(c *gin.Context) {
}
items, total, err := h.service.DataAccessRequest(c.Request.Context(), &req)
if err != nil {
Fail(c, "获取失败:"+err.Error())
Fail(c, "获取失败")
return
}
Write(c, CodeSuccess, PageResult{List: items, Total: total, Page: req.Page, PageSize: req.PageSize}, "获取成功")
@@ -150,7 +150,7 @@ func (h *Audit) DeleteDataAccess(c *gin.Context) {
return
}
if err := h.service.DeleteDataAccess(c.Request.Context(), req.IDs); err != nil {
Fail(c, "删除失败:"+err.Error())
Fail(c, "删除失败")
return
}
Write(c, CodeSuccess, gin.H{}, "删除成功")
@@ -238,7 +238,7 @@ func (h *Audit) DeleteError(c *gin.Context) {
return
}
if err := h.service.DeleteErrors(c.Request.Context(), []uint{id}); err != nil {
Fail(c, "删除失败:"+err.Error())
Fail(c, "删除失败")
return
}
Write(c, CodeSuccess, gin.H{}, "删除成功")
@@ -250,7 +250,7 @@ func (h *Audit) DeleteErrors(c *gin.Context) {
return
}
if err := h.service.DeleteErrors(c.Request.Context(), ids); err != nil {
Fail(c, "批量删除失败:"+err.Error())
Fail(c, "批量删除失败")
return
}
Write(c, CodeSuccess, gin.H{}, "批量删除成功")
@@ -262,7 +262,7 @@ func (h *Audit) UpdateError(c *gin.Context) {
return
}
if err := h.service.UpdateErrorRequest(c.Request.Context(), &req); err != nil {
Fail(c, "更新失败:"+err.Error())
Fail(c, "更新失败")
return
}
Write(c, CodeSuccess, gin.H{}, "更新成功")
@@ -275,7 +275,7 @@ func (h *Audit) Error(c *gin.Context) {
}
item, err := h.service.Error(c.Request.Context(), id)
if err != nil {
Fail(c, "查询失败:"+err.Error())
Fail(c, "查询失败")
return
}
OKWithData(c, item)
@@ -297,7 +297,7 @@ func (h *Audit) Errors(c *gin.Context) {
}
items, total, err := h.service.ErrorsFilter(c.Request.Context(), p, size, c.Query("form"), c.Query("info"), createdAtRange)
if err != nil {
Fail(c, "获取失败:"+err.Error())
Fail(c, "获取失败")
return
}
Write(c, CodeSuccess, PageResult{List: items, Total: total, Page: p, PageSize: size}, "获取成功")
@@ -309,7 +309,7 @@ func (h *Audit) CreateError(c *gin.Context) {
return
}
if err := h.recorder.CreateErrorMutationRequest(c.Request.Context(), &req); err != nil {
Fail(c, "创建失败:"+err.Error())
Fail(c, "创建失败")
return
}
Write(c, CodeSuccess, gin.H{}, "创建成功")
+1 -1
View File
@@ -1,5 +1,5 @@
// This file is the handler package's single vocabulary for HTTP replies: the
// envelope helpers come from pkg/httpx and Claims from the auth middleware, so
// envelope helpers come from server/httpx and Claims from the auth middleware, so
// handlers name one package instead of two.
package handler