From e9cd6876c23a97c01a025641c18fbf0b405ae1dd Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 14 Jan 2026 18:56:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=88=86=E5=B8=83?= =?UTF-8?q?=E5=BC=8F=E9=94=81=EF=BC=8C=E9=98=B2=E6=AD=A2=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/cast/report.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/service/cast/report.go b/pkg/service/cast/report.go index 1c78fe9..990cd0f 100644 --- a/pkg/service/cast/report.go +++ b/pkg/service/cast/report.go @@ -34,6 +34,18 @@ func CreateCompetitiveReport(ctx *gin.Context) { service.Error(ctx, err) return } + + loginInfo := login.GetUserInfoFromC(ctx) + lockKey := fmt.Sprintf("lock_create_competitive_report_%d", loginInfo.ID) + reply := cache.RedisClient.SetNX(lockKey, time.Now().Format("2006-01-02 15:04:05"), time.Second*5) + if !reply.Val() { + service.Error(ctx, errors.New("请勿重复提交")) + return + } + defer func() { + cache.RedisClient.Del(lockKey) + }() + newCtx := NewCtxWithUserInfo(ctx) artistID, _ := strconv.ParseUint(req.ArtistID, 10, 64)