From 0633074410f8779d2127bf257dfd6db30fc12f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=81=E7=81=AB=E8=A1=8C=E8=80=85?= Date: Sun, 10 Oct 2021 19:57:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=8F=82=E5=88=AB=E5=90=8D=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Base/DzqController.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Base/DzqController.php b/src/Base/DzqController.php index b26b110..9c09ca7 100644 --- a/src/Base/DzqController.php +++ b/src/Base/DzqController.php @@ -52,6 +52,9 @@ abstract class DzqController implements RequestHandlerInterface public $providers = []; + //输入参数别名,仅限根字段 + protected $paramsAlias = []; + public function handle(ServerRequestInterface $request): ResponseInterface { $this->request = $request; @@ -108,6 +111,7 @@ abstract class DzqController implements RequestHandlerInterface public function c9IbQHXVFFWu($name) { + $this->setParamsAlias(); if (method_exists($this, 'beforeMain')) { $this->beforeMain($name); } @@ -127,13 +131,24 @@ abstract class DzqController implements RequestHandlerInterface } } } - - + private function setParamsAlias() + { + $this->saveParamsAlias = []; + foreach ($this->paramsAlias as $k => $v) { + $p = $this->inPut($v); + if (!empty($p)) { + $this->saveParamsAlias[$k] = $p; + } + } + } /* * 接口入参 */ public function inPut($name='', $checkValid = true) { + if(!empty($this->saveParamsAlias[$name])){ + return $this->saveParamsAlias[$name]; + } if(empty($name)){ if($this->parseBody instanceof \Illuminate\Support\Collection){ return $this->parseBody->merge($this->queryParams)->all(); -- Gitee