diff --git a/config/autoload/middlewares.php b/config/autoload/middlewares.php index 49bdec2..a999228 100644 --- a/config/autoload/middlewares.php +++ b/config/autoload/middlewares.php @@ -1,15 +1,21 @@ [ ], + 'jsonrpc-http' => [ + RequestId::class, + ], ]; diff --git a/extend/Aether/PHP/Hyperf/Middleware/RequestId.php b/extend/Aether/PHP/Hyperf/Middleware/RequestId.php new file mode 100644 index 0000000..e1b0cd2 --- /dev/null +++ b/extend/Aether/PHP/Hyperf/Middleware/RequestId.php @@ -0,0 +1,23 @@ +getHeaderLine('X-Request-Id') ?: uniqid(); + Context::set('request_id', $requestId); + var_dump('requestId: ' . $requestId); + $response = $handler->handle($request); + return $response->withHeader('X-Request-Id', $requestId); + } +} diff --git a/extend/MicroService/src/Contract/TeacherServiceInterface.php b/extend/MicroService/src/Contract/TeacherServiceInterface.php new file mode 100644 index 0000000..8161275 --- /dev/null +++ b/extend/MicroService/src/Contract/TeacherServiceInterface.php @@ -0,0 +1,8 @@ +