From 76f2d71597b1f1b32ea5509a41de3524337aad41 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 18 Dec 2024 09:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=AA=8C=E8=AF=81=E5=88=86?= =?UTF-8?q?=E7=BB=84=E6=96=B9=E6=B3=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/think/Validate.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/think/Validate.php b/src/think/Validate.php index 7f38ec39ad..d3861ea3b0 100644 --- a/src/think/Validate.php +++ b/src/think/Validate.php @@ -636,10 +636,6 @@ public function check(array $data, array | string $rules = []): bool { $this->error = []; - if ($this->currentScene) { - $this->getScene($this->currentScene); - } - if (empty($rules)) { // 读取验证规则 $rules = $this->rules(); @@ -659,6 +655,10 @@ public function check(array $data, array | string $rules = []): bool $rules = $rules->getRules(); } + if ($this->currentScene) { + $this->getScene($this->currentScene); + } + foreach ($this->append as $key => $rule) { if (!isset($rules[$key])) { $rules[$key] = $rule; @@ -2107,7 +2107,7 @@ protected function getScene(string $scene): void */ protected function getGroupRules(string $group) { - $method = 'group' . Str::studly($group); + $method = 'rules' . Str::studly($group); if (method_exists($this, $method)) { $validate = call_user_func_array([$this, $method], [new self]); return $validate->alias($this->alias)