From 9673c62a14617fefcfbe50c32bd8db3d924631a4 Mon Sep 17 00:00:00 2001 From: wuyanwen Date: Thu, 9 Jan 2020 22:20:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/base/CatchRequest.php | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/extend/catcher/base/CatchRequest.php b/extend/catcher/base/CatchRequest.php index fbf6941..001e455 100644 --- a/extend/catcher/base/CatchRequest.php +++ b/extend/catcher/base/CatchRequest.php @@ -2,15 +2,16 @@ namespace catcher\base; use app\Request; -use catcher\CatchAuth; use catcher\exceptions\FailedException; use catcher\exceptions\ValidateFailedException; use think\Validate; class CatchRequest extends Request { - protected $auth; - + /** + * @var bool + */ + protected $needCreatorId = true; /** * 批量验证 * @@ -90,24 +91,10 @@ class CatchRequest extends Request } // 设置默认参数 - $this->param['creator_id'] = $this->user()->id; + if ($this->needCreatorId) { + $this->param['creator_id'] = $this->user()->id; + } return true; } - - - /** - * login user - * - * @time 2020年01月09日 - * @return mixed - */ - public function user() - { - if (!$this->auth) { - $this->auth = new CatchAuth; - } - - return $this->auth->user(); - } }