Files
aiops/backend/model/login_log.go
T
2026-07-09 14:16:56 +08:00

35 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import "time"
// LoginLog 登录日志(参考 JumpServer / opsx-web-lite) // Logan.Li
type LoginLog struct {
ID uint `gorm:"primarykey" json:"id"`
UserID *uint `json:"user_id"`
Username string `gorm:"size:64;index" json:"username"`
IP string `gorm:"size:64" json:"ip"`
Location string `gorm:"size:128" json:"location"` // IP 归属地
Browser string `gorm:"size:128" json:"browser"` // 浏览器
OS string `gorm:"size:128" json:"os"` // 操作系统
LoginType string `gorm:"size:32;default:password" json:"login_type"` // password / ldap
UserAgent string `gorm:"size:500" json:"user_agent"`
Status string `gorm:"size:32" json:"status"` // success, failed
FailReason string `gorm:"size:255" json:"fail_reason"`
LoginAt time.Time `gorm:"index" json:"login_at"`
CreatedAt time.Time `json:"created_at"`
}
func (LoginLog) TableName() string {
return "audit_login_logs"
}
// LoginLogQuery 登录日志查询
type LoginLogQuery struct {
Username string `form:"username"`
Status string `form:"status"`
StartTime string `form:"start_time"`
EndTime string `form:"end_time"`
Page int `form:"page,default=1"`
PageSize int `form:"page_size,default=20"`
}