2025-11-24 18:44:06 +08:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"platform/web/globals/orm"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// LogsRequest 访问日志表
|
|
|
|
|
type LogsRequest struct {
|
2025-12-15 14:48:30 +08:00
|
|
|
ID int32 `json:"id" gorm:"column:id"` // 访问日志ID
|
|
|
|
|
IP orm.Inet `json:"ip" gorm:"column:ip;not null"` // IP地址
|
|
|
|
|
UA string `json:"ua" gorm:"column:ua"` // 用户代理
|
|
|
|
|
UserID *int32 `json:"user_id,omitempty" gorm:"column:user_id"` // 用户ID
|
|
|
|
|
ClientID *int32 `json:"client_id,omitempty" gorm:"column:client_id"` // 客户端ID
|
|
|
|
|
Method string `json:"method" gorm:"column:method"` // 请求方法
|
|
|
|
|
Path string `json:"path" gorm:"column:path"` // 请求路径
|
|
|
|
|
Status int16 `json:"status" gorm:"column:status"` // 响应状态码
|
|
|
|
|
Error *string `json:"error,omitempty" gorm:"column:error"` // 错误信息
|
|
|
|
|
Time time.Time `json:"time" gorm:"column:time"` // 请求时间
|
|
|
|
|
Latency string `json:"latency" gorm:"column:latency"` // 请求延迟
|
2025-11-24 18:44:06 +08:00
|
|
|
|
2025-12-08 14:22:30 +08:00
|
|
|
User *User `json:"user,omitempty" gorm:"foreignKey:UserID"`
|
|
|
|
|
Client *Client `json:"client,omitempty" gorm:"foreignKey:ClientID"`
|
2025-11-24 18:44:06 +08:00
|
|
|
}
|