feat: backend core - auth, user, role, permission, device, webhook, monitoring, cache, repository, service, middleware, API handlers
2026-04-02 11:19:50 +08:00
|
|
|
package domain
|
|
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
|
|
// OperationLog 操作日志
|
|
|
|
|
type OperationLog struct {
|
2026-05-12 00:28:38 +08:00
|
|
|
ID int64 `gorm:"primaryKey;autoIncrement;index:idx_operation_logs_created_at_id,priority:2" json:"id"`
|
feat: backend core - auth, user, role, permission, device, webhook, monitoring, cache, repository, service, middleware, API handlers
2026-04-02 11:19:50 +08:00
|
|
|
UserID *int64 `gorm:"index" json:"user_id,omitempty"`
|
|
|
|
|
OperationType string `gorm:"type:varchar(50)" json:"operation_type"`
|
|
|
|
|
OperationName string `gorm:"type:varchar(100)" json:"operation_name"`
|
|
|
|
|
RequestMethod string `gorm:"type:varchar(10)" json:"request_method"`
|
|
|
|
|
RequestPath string `gorm:"type:varchar(200)" json:"request_path"`
|
|
|
|
|
RequestParams string `gorm:"type:text" json:"request_params"`
|
|
|
|
|
ResponseStatus int `json:"response_status"`
|
|
|
|
|
IP string `gorm:"type:varchar(50)" json:"ip"`
|
|
|
|
|
UserAgent string `gorm:"type:varchar(500)" json:"user_agent"`
|
2026-05-12 00:28:38 +08:00
|
|
|
CreatedAt time.Time `gorm:"autoCreateTime;index:idx_operation_logs_created_at_id,priority:1" json:"created_at"`
|
feat: backend core - auth, user, role, permission, device, webhook, monitoring, cache, repository, service, middleware, API handlers
2026-04-02 11:19:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TableName 指定表名
|
|
|
|
|
func (OperationLog) TableName() string {
|
|
|
|
|
return "operation_logs"
|
|
|
|
|
}
|