Files
common/log/model/entity/log.go
2026-03-12 08:51:17 +08:00

25 lines
1.7 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 entity
import (
"gitee.com/red-future---jilin-g/common/do"
)
// OperationLog 操作日志实体 - 用于记录数据增删改操作行为
type OperationLog struct {
do.MongoBaseDO `bson:",inline"`
Module string `bson:"module" json:"module"` // 模块名:如 order, wallet, market 等
Service string `bson:"service" json:"service"` // 服务名:具体的微服务名称
Operation string `bson:"operation" json:"operation"` // 操作类型create, update, delete
Resource string `bson:"resource" json:"resource"` // 资源类型:如 order, wallet, product 等
ResourceID string `bson:"resource_id" json:"resource_id"` // 资源ID具体操作的数据ID如订单号、钱包ID等
UserID interface{} `bson:"user_id" json:"user_id"` // 操作人ID
UserName string `bson:"user_name" json:"user_name"` // 操作人名称
IPAddress string `bson:"ip_address" json:"ip_address"` // 操作IP地址
UserAgent string `bson:"user_agent" json:"user_agent"` // 用户代理
Description string `bson:"description" json:"description"` // 操作描述
BeforeData map[string]interface{} `bson:"before_data,omitempty" json:"before_data"` // 操作前的数据用于update/delete
AfterData map[string]interface{} `bson:"after_data,omitempty" json:"after_data"` // 操作后的数据用于create/update
ExtraData map[string]interface{} `bson:"extra_data,omitempty" json:"extra_data"` // 额外数据
}