From 037b5f3861706d8f3ef4f4bddbe06d18190294ce Mon Sep 17 00:00:00 2001 From: tw Date: Thu, 29 Jan 2026 14:58:17 +0800 Subject: [PATCH 1/3] TCC add branchHeaders --- src/TCC.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TCC.php b/src/TCC.php index ec313dd..c36589a 100644 --- a/src/TCC.php +++ b/src/TCC.php @@ -73,6 +73,7 @@ public function callBranch($body, string $tryUrl, string $confirmUrl, string $ca $branchRequest->branchId = $branchId; $branchRequest->op = Operation::TRY; $branchRequest->body = $body; + $branchRequest->branchHeaders = TransContext::getBranchHeaders(); return $this->api->transRequestBranch($branchRequest); case Protocol::GRPC: if (! $body instanceof Message) { From 7c3e307cf21cd5945a62497eb24d0054dd77a858 Mon Sep 17 00:00:00 2001 From: tw Date: Fri, 30 Jan 2026 10:29:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Middleware/DtmMiddleware.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Middleware/DtmMiddleware.php b/src/Middleware/DtmMiddleware.php index 9c785d3..e3b3cea 100644 --- a/src/Middleware/DtmMiddleware.php +++ b/src/Middleware/DtmMiddleware.php @@ -16,6 +16,7 @@ use DtmClient\Exception\OngingException; use DtmClient\Exception\RuntimeException; use Hyperf\Contract\ConfigInterface; +use Hyperf\Contract\StdoutLoggerInterface; use Hyperf\Di\Annotation\AnnotationCollector; use Hyperf\Grpc\StatusCode; use Hyperf\HttpMessage\Stream\SwooleStream; @@ -33,11 +34,14 @@ class DtmMiddleware implements MiddlewareInterface protected ConfigInterface $config; - public function __construct(Barrier $barrier, ResponseInterface $response, ConfigInterface $config) + protected StdoutLoggerInterface $logger; + + public function __construct(Barrier $barrier, ResponseInterface $response, ConfigInterface $config, StdoutLoggerInterface $logger) { $this->barrier = $barrier; $this->response = $response; $this->config = $config; + $this->logger = $logger; } public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface @@ -137,6 +141,7 @@ protected function handlerBarrierCall(callable $businessCall): ResponseInterface $this->isGRPC() && $response = $response->withTrailer('grpc-status', (string) $failureException->getCode())->withTrailer('grpc-message', $failureException->getMessage()); return $response; } catch (\Throwable $throwable) { + $this->logger->error($throwable); $code = $this->isGRPC() ? 200 : Result::FAILURE_STATUS; $response = $response->withStatus($code); $this->isGRPC() && $response = $response->withTrailer('grpc-status', (string) Result::FAILURE_STATUS)->withTrailer('grpc-message', $throwable->getMessage()); From edae028f5cf03565fcea0f946ba7fe8e4064e030 Mon Sep 17 00:00:00 2001 From: tw Date: Wed, 4 Feb 2026 11:10:22 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95-=E8=BD=ACstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Middleware/DtmMiddleware.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Middleware/DtmMiddleware.php b/src/Middleware/DtmMiddleware.php index e3b3cea..33eed7b 100644 --- a/src/Middleware/DtmMiddleware.php +++ b/src/Middleware/DtmMiddleware.php @@ -141,7 +141,7 @@ protected function handlerBarrierCall(callable $businessCall): ResponseInterface $this->isGRPC() && $response = $response->withTrailer('grpc-status', (string) $failureException->getCode())->withTrailer('grpc-message', $failureException->getMessage()); return $response; } catch (\Throwable $throwable) { - $this->logger->error($throwable); + $this->logger->error((string)$throwable); $code = $this->isGRPC() ? 200 : Result::FAILURE_STATUS; $response = $response->withStatus($code); $this->isGRPC() && $response = $response->withTrailer('grpc-status', (string) Result::FAILURE_STATUS)->withTrailer('grpc-message', $throwable->getMessage());