Files
common/log/model/entity/log.go

25 lines
1.7 KiB
Go
Raw Normal View History

2025-12-30 16:14:15 +08:00
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"` // 额外数据
}