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