[优化] 重构 API 处理逻辑,简化参数解析和响应处理

This commit is contained in:
ryan
2026-05-31 13:31:32 +08:00
parent bcd669722e
commit ec70794577
11 changed files with 183 additions and 547 deletions
+1 -6
View File
@@ -1,7 +1,6 @@
package controller
import (
"net/http"
"openflare/service"
"github.com/gin-gonic/gin"
@@ -18,11 +17,7 @@ import (
func CleanupDatabaseObservability(c *gin.Context) {
var input service.DatabaseCleanupInput
if err := decodeOptionalJSONBody(c.Request.Body, &input); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
"message": "参数错误",
"error": err.Error(),
})
respondBadRequest(c, "")
return
}
result, err := service.CleanupDatabaseObservability(input)