user_logs.go 1017 B

123456789101112131415161718192021222324252627282930
  1. package entity
  2. // 用户访问日志
  3. // 记录敏感接口请求
  4. type UserLogs struct {
  5. MysqlBaseModel
  6. UserId int64 `json:"userId" gorm:"comment:用户Id"`
  7. UserAgent string `json:"userAgent" gorm:"type:varchar(1024);comment:客户端信息"`
  8. Ip string `json:"ip" gorm:"type:varchar(64);comment:ip"`
  9. Action string `json:"action" gorm:"type:varchar(20);comment:请求方法"`
  10. Query string `json:"query" gorm:"type:text;comment:query"`
  11. Path string `json:"path" gorm:"type:varchar(200);comment:path"`
  12. Status int `json:"status" gorm:"comment:状态"`
  13. Request string `json:"request" gorm:"type:text;comment:请求内容消息"`
  14. Response string `json:"response" gorm:"type:text;comment:请求返回信息"`
  15. Elapsed string `json:"elapsed" gorm:"type:varchar(50);comment:耗时"`
  16. }
  17. func (*UserLogs) TableName() string {
  18. return ModelPrefix + "user_logs"
  19. }
  20. func (*UserLogs) Comment() string {
  21. return "用户操作日志"
  22. }
  23. func NewUserLogs() *UserLogs {
  24. return &UserLogs{}
  25. }