停止重复兑换已拥有道具账号

This commit is contained in:
yml2213
2026-08-09 10:35:30 +08:00
parent c41fd48b1c
commit cd1c3db691
2 changed files with 13 additions and 0 deletions
+4
View File
@@ -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, "兑换上限"):
+9
View File
@@ -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()