From 394c97167dba56d63b09e22e4835cb4b4cb76349 Mon Sep 17 00:00:00 2001 From: ziming Date: Tue, 17 Jun 2025 16:16:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/zltx_card_v1/internal/zltx_card_v1.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/zltx_card_v1/internal/zltx_card_v1.go b/plugins/zltx_card_v1/internal/zltx_card_v1.go index 1f983fe..6c6ba2b 100644 --- a/plugins/zltx_card_v1/internal/zltx_card_v1.go +++ b/plugins/zltx_card_v1/internal/zltx_card_v1.go @@ -20,7 +20,21 @@ const ( type ZLTXCardV1Service struct{} -func (p *ZLTXCardV1Service) Order(ctx context.Context, request *proto.OrderRequest) (*proto.OrderResponse, error) { +func (p *ZLTXCardV1Service) Order(ctx context.Context, request *proto.OrderRequest) (resp2 *proto.OrderResponse, respErr error) { + + select { + case <-ctx.Done(): + return nil, ctx.Err() + default: + // 继续执行 + } + + defer func() { + if err := recover(); err != nil { + respErr = fmt.Errorf("panic: %v", err) + } + }() + c, err := transConfig(request.Config) if err != nil { return nil, err