From cd1c3db69167dcb1e88b026ee37368f9f43e8762 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Sun, 9 Aug 2026 10:35:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E6=AD=A2=E9=87=8D=E5=A4=8D=E5=85=91?= =?UTF-8?q?=E6=8D=A2=E5=B7=B2=E6=8B=A5=E6=9C=89=E9=81=93=E5=85=B7=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/seckill/scheduler.go | 4 ++++ internal/seckill/scheduler_test.go | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/internal/seckill/scheduler.go b/internal/seckill/scheduler.go index 9a7dc3f..e97747c 100644 --- a/internal/seckill/scheduler.go +++ b/internal/seckill/scheduler.go @@ -920,6 +920,10 @@ func classifyRetryStop(message string) (account bool, product bool, reason strin func classifyXiaodianRetryStop(message string) (account bool, product bool, reason string) { switch { + case strings.Contains(message, "已拥有该道具"), + strings.Contains(message, "已经拥有该道具"), + strings.Contains(message, "已拥有该商品"): + return true, false, "账号已拥有该道具" case strings.Contains(message, "已达限量"), strings.Contains(message, "已达本次活动兑换上限"), strings.Contains(message, "兑换上限"): diff --git a/internal/seckill/scheduler_test.go b/internal/seckill/scheduler_test.go index a6e483d..8df7e21 100644 --- a/internal/seckill/scheduler_test.go +++ b/internal/seckill/scheduler_test.go @@ -112,6 +112,15 @@ func TestClassifyRetryStop(t *testing.T) { } } +func TestClassifyXiaodianRetryStopOwnedItem(t *testing.T) { + for _, message := range []string{"您已拥有该道具!", "已经拥有该道具", "账号已拥有该商品"} { + acc, prod, reason := classifyXiaodianRetryStop(message) + if !acc || prod || reason != "账号已拥有该道具" { + t.Errorf("classifyXiaodianRetryStop(%q) = (%v,%v,%q), want (true,false,'账号已拥有该道具')", message, acc, prod, reason) + } + } +} + func TestFilterCooldownAttempts(t *testing.T) { attempts := makeAttempts("a", "b", "c") now := time.Now()