package model import ( "time" ) // RequestLog 请求日志实体 type RequestLog struct { ID uint `gorm:"primarykey"` CreatedAt time.Time Method string `json:"method" gorm:"type:varchar(10) not null comment '请求方式';"` // 请求方式 Path string `json:"path" gorm:"type:varchar(100) not null comment '请求接口';"` // 请求接口 Param string `json:"param" gorm:"type:text comment 'Query参数';"` // Query参数 Body string `json:"body" gorm:"type:text comment 'Body参数';"` // Body参数 Form string `json:"form" gorm:"type:text comment 'Form参数';"` // Form参数 Cost int64 `json:"cost" gorm:"type:int comment 'Query参数';"` // 耗时(微秒) StatusCode int `json:"status_code" gorm:"type:int comment '返回状态码';"` // 返回状态码 DeviceId string `json:"device_id" gorm:"type:varchar(50) not null comment '设备指纹';"` // 设备指纹 Ip string `json:"ip" gorm:"type:varchar(50) comment 'IP地址';"` // IP地址 UserAgent string `json:"user_agent" gorm:"type:varchar(500) comment 'UserAgent';"` // UA } func (RequestLog) TableName() string { return "t_request_log" }