From 597cccf7fac8b49f28f6e7ded6f5451b0a9dc9ee Mon Sep 17 00:00:00 2001 From: timerzz Date: Fri, 26 Jul 2024 14:59:32 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E6=94=B9=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/coach-client/client_us.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/coach-client/client_us.go b/pkg/coach-client/client_us.go index 814d73d..d6918b9 100644 --- a/pkg/coach-client/client_us.go +++ b/pkg/coach-client/client_us.go @@ -3,14 +3,15 @@ package coach_client import ( "context" "fmt" + "log/slog" + "net/url" + "time" + "gitea.timerzz.com/kedaya_haitao/common/pkg/proxy" restry_pool "gitea.timerzz.com/kedaya_haitao/common/pkg/restry-pool" "github.com/go-resty/resty/v2" "github.com/pkg/errors" proxy2 "github.com/timerzz/proxypool/pkg/proxy" - "log/slog" - "net/url" - "time" ) type US struct { @@ -36,7 +37,10 @@ func tryRequest(ctx context.Context, urlPath string, respData any, proxyGetter f default: } - _, err := callByProxy(ctx, p, urlPath, respData) + resp, err := callByProxy(ctx, p, urlPath, respData) + if resp.StatusCode() != 200 { + err = fmt.Errorf("请求错误:%d, %s", resp.StatusCode(), resp.Body()) + } if err != nil { slog.Debug(err.Error()) continue