数据结构优化

This commit is contained in:
李琦
2026-01-20 11:00:42 +08:00
parent 29a642c285
commit b088ba48be
17 changed files with 1073 additions and 49 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/niangaodev/art-code/models"
"github.com/niangaodev/art-code/repositories"
"github.com/niangaodev/art-code/utils"
)
// OperationLogMiddleware 操作日志中间件
@@ -46,11 +47,16 @@ func OperationLogMiddleware() gin.HandlerFunc {
username, _ := c.Get("username")
// 获取IP归属地
ip := c.ClientIP()
region := utils.GetRegion(ip)
// 构建操作日志
operationLog := &models.OperationLog{
UserID: userID.(uint),
Username: username.(string),
IP: c.ClientIP(),
IP: ip,
Region: region,
Path: c.Request.URL.Path,
Method: c.Request.Method,
Params: string(requestBody),