From c1717c9a6c47aaba855d8344d00f5a705bb18f11 Mon Sep 17 00:00:00 2001 From: QTom Date: Tue, 17 Mar 2026 15:25:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E6=B5=8B=E8=AF=95=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E5=88=B0=20403=20=E6=97=B6=E5=B0=86=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E6=A0=87=E8=AE=B0=E4=B8=BA=20error=20=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/internal/service/account_test_service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/internal/service/account_test_service.go b/backend/internal/service/account_test_service.go index d30b670d..12617336 100644 --- a/backend/internal/service/account_test_service.go +++ b/backend/internal/service/account_test_service.go @@ -308,7 +308,14 @@ func (s *AccountTestService) testClaudeAccountConnection(c *gin.Context, account if resp.StatusCode != http.StatusOK { body, _ := io.ReadAll(resp.Body) - return s.sendErrorAndEnd(c, fmt.Sprintf("API returned %d: %s", resp.StatusCode, string(body))) + errMsg := fmt.Sprintf("API returned %d: %s", resp.StatusCode, string(body)) + + // 403 表示账号被上游封禁,标记为 error 状态 + if resp.StatusCode == http.StatusForbidden { + _ = s.accountRepo.SetError(ctx, account.ID, errMsg) + } + + return s.sendErrorAndEnd(c, errMsg) } // Process SSE stream