From 538006c3c65c1d339ed057653ec8863da76c8a05 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Thu, 15 Oct 2020 10:00:35 +0800 Subject: [PATCH] =?UTF-8?q?update:rewrite=20request=20post=EF=BC=8C?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=A5=20creator=5Fid=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/base/CatchRequest.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/extend/catcher/base/CatchRequest.php b/extend/catcher/base/CatchRequest.php index e1cf765..3fce0de 100644 --- a/extend/catcher/base/CatchRequest.php +++ b/extend/catcher/base/CatchRequest.php @@ -4,6 +4,7 @@ namespace catcher\base; use app\Request; use catcher\exceptions\FailedException; use catcher\exceptions\ValidateFailedException; +use think\App; class CatchRequest extends Request { @@ -60,9 +61,27 @@ class CatchRequest extends Request // 设置默认参数 if ($this->needCreatorId) { $this->param['creator_id'] = $this->user()->id; - $this->post['creator_id'] = $this->user()->id; } return true; } + + /** + * rewrite post + * + * @time 2020年10月15日 + * @param string $name + * @param null $default + * @param string $filter + * @return array|mixed|null + */ + public function post($name = '', $default = null, $filter = '') + { + if ($this->needCreatorId) { + $this->post['creator_id'] = $this->user()->id; + } + + return parent::post($name, $default, $filter); // TODO: Change the autogenerated stub + } + }