Updata:解决冲突
This commit is contained in:
commit
ab79cd8833
File diff suppressed because it is too large
Load Diff
@ -34,6 +34,18 @@ func CreateCompetitiveReport(ctx *gin.Context) {
|
|||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
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)
|
newCtx := NewCtxWithUserInfo(ctx)
|
||||||
artistID, _ := strconv.ParseUint(req.ArtistID, 10, 64)
|
artistID, _ := strconv.ParseUint(req.ArtistID, 10, 64)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user