Skip to content

Commit

Permalink
代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Nov 15, 2019
1 parent 271c443 commit 63d829b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Server/Http/Middleware/ActionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
}
// 执行动作
$actionResult = ($result->callable)(...$this->prepareActionParams($request, $result));
$response = $context['response'];
if($useObjectRequestAndResponse)
{
// 获得控制器中的Response
$response = $result->callable[0]->response;
}
// 视图
if($actionResult instanceof \Imi\Server\View\Annotation\View)
{
Expand Down Expand Up @@ -100,6 +94,15 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

if(isset($viewAnnotation))
{
if($useObjectRequestAndResponse)
{
// 获得控制器中的Response
$response = $result->callable[0]->response;
}
else
{
$response = $context['response'];
}
// 视图渲染
$options = $viewAnnotation->toArray();
$response = $this->view->render($viewAnnotation->renderType, $viewAnnotation->data, $options, $response);
Expand Down

0 comments on commit 63d829b

Please sign in to comment.