优化日志模块:重构操作日志记录与查询功能,支持批量操作日志记录,完善日志查询接口,增加软删除操作类型

This commit is contained in:
2026-01-16 16:55:32 +08:00
committed by 张斌
parent cc940c27b7
commit f0e6bdd37c
8 changed files with 260 additions and 300 deletions

View File

@@ -4,12 +4,20 @@ package consts
type OperationType string
const (
OperationCreate OperationType = "create" // 创建
OperationUpdate OperationType = "update" // 更新
OperationDelete OperationType = "delete" // 删除
OperationInsert OperationType = "insert" // 创建
OperationUpdate OperationType = "update" // 更新
OperationDelete OperationType = "delete" // 删除
OperationDeleteSoft OperationType = "delete_soft" // 软删除
)
// OperationLogCollection 操作日志集合名称常量
const (
OperationLogCollection = "operation_logs" // 操作日志集合名称
)
// 消费者配置(从 Redis Stream 消费请求)
const StreamKey = "log:%s" // 请求 Stream 键名与发消息的key一致
const GroupName = "log:consumer:group" // 消费者组名
const ConsumerName = "message-consumer-1" // 消费者名称(唯一标识)
const BatchSize = 1 // 批处理大小每次读取1条
const AutoAck = true // ACK是否自动确认true自动确认false不确认