优化结构

This commit is contained in:
Yvan
2026-08-28 00:29:40 +08:00
parent 04ff85116c
commit 03a4131f6e
118 changed files with 758 additions and 834 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ package middleware
import (
"context"
"kra/internal/biz/system"
httpx "kra/pkg/httpx"
httpx "kra/internal/server/httpx"
"kra/internal/config"
"kra/internal/utils/routepath"
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"errors"
"io"
"kra/internal/biz/system"
httpx "kra/pkg/httpx"
httpx "kra/internal/server/httpx"
"log/slog"
"mime"
"net/http"
+2 -2
View File
@@ -13,15 +13,15 @@ import (
"kra/internal/config"
"kra/internal/routecatalog"
"kra/internal/service"
"kra/internal/service/dto"
systemservice "kra/internal/service/system"
"github.com/gin-gonic/gin"
)
const ctxOperationAuditPersistFailedKey = "operation_audit_persist_failed"
func OperationAudit(runtime *config.Store, recorder *service.AuditRecorder) gin.HandlerFunc {
func OperationAudit(runtime *config.Store, recorder *systemservice.AuditRecorder) gin.HandlerFunc {
return func(c *gin.Context) {
if runtime == nil || recorder == nil {
c.Next()
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"errors"
"kra/internal/biz/system"
httpx "kra/pkg/httpx"
httpx "kra/internal/server/httpx"
"net/http"
"strconv"
"strings"
-4
View File
@@ -68,7 +68,3 @@ func redactJSON(raw []byte, contentType string, limit int) string {
}
func stringValue(value any) string { text, _ := value.(string); return text }
func isBootstrapPath(path string) bool {
return strings.HasSuffix(path, "/health") || strings.Contains(path, "/init/")
}
+1 -1
View File
@@ -3,7 +3,7 @@ package middleware
import (
"bytes"
"encoding/json"
httpx "kra/pkg/httpx"
httpx "kra/internal/server/httpx"
"log/slog"
"strings"
+3 -3
View File
@@ -1,8 +1,8 @@
package middleware
import (
"kra/internal/service"
httpx "kra/pkg/httpx"
httpx "kra/internal/server/httpx"
systemservice "kra/internal/service/system"
"net/http"
"strings"
"time"
@@ -10,7 +10,7 @@ import (
"github.com/gin-gonic/gin"
)
func SecurityRateLimit(settings *service.SecurityService) gin.HandlerFunc {
func SecurityRateLimit(settings *systemservice.SecurityService) gin.HandlerFunc {
return func(c *gin.Context) {
path := strings.TrimSuffix(c.Request.URL.Path, "/")
if !strings.HasSuffix(path, "/base/login") && !strings.HasSuffix(path, "/base/captcha") {
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"encoding/hex"
"strings"
"kra/pkg/logging"
"kra/internal/logging"
"github.com/gin-gonic/gin"
"github.com/google/uuid"