userLog.go 961 B

123456789101112131415161718
  1. package model
  2. type UserOperationLog struct {
  3. Id interface{} `json:"id" bson:"_id"` // 自增ID
  4. Username string `json:"user_name" bson:"user_name"` // 用户名
  5. RoleId string `json:"role_id" bson:"role_id"` // 角色ID
  6. Path string `json:"url" bson:"url"` // 请求路径
  7. Method string `json:"method" bson:"method"` // 请求方法
  8. StatusCode int `json:"status_code" bson:"status_code"` // HTTP状态码
  9. Dur int64 `json:"dur" bson:"dur"` // 请求耗时(毫秒)
  10. ClientIP string `json:"client_ip" bson:"client_ip"` // 客户端IP
  11. ErrorMessage string `json:"error_message" bson:"error_message"` // 错误信息
  12. CreatedAt int64 `json:"created_at" bson:"created_at"`
  13. }
  14. func (m *UserOperationLog) TableName() string {
  15. return "userOperationLog"
  16. }