From f814e682cf66ebdf794ceb240f8f53b280bd2d50 Mon Sep 17 00:00:00 2001 From: huang <1724659546@qq.com> Date: Wed, 1 Oct 2025 00:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/infra/models/execution.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/infra/models/execution.go b/internal/infra/models/execution.go index 96c55d9..9a8a58d 100644 --- a/internal/infra/models/execution.go +++ b/internal/infra/models/execution.go @@ -180,6 +180,9 @@ func (a AuditContextKey) String() string { // UserActionLog 记录用户的操作历史,用于审计 type UserActionLog struct { + // 用 ID 和 Time 组成复合主键, 防止高并发时时间重复 + ID uint `gorm:"primaryKey"` + // Time 是操作发生的时间,作为主键和超表的时间分区键 Time time.Time `gorm:"primaryKey" json:"time"`