From cb9fb04cad7ce6d60ad8c895db87f4591574badc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 7 Nov 2016 14:36:30 +0800 Subject: [PATCH] =?UTF-8?q?Model=E7=B1=BB=E7=9A=84validateData=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=A2=9E=E5=8A=A0batch=E6=89=B9=E9=87=8F=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index ff6c1142..8073ca06 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -890,9 +890,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess * @access protected * @param array $data 验证数据 * @param mixed $rule 验证规则 + * @param bool $batch 批量验证 * @return bool */ - protected function validateData($data, $rule = null) + protected function validateData($data, $rule = null, $batch = null) { $info = is_null($rule) ? $this->validate : $rule; @@ -911,7 +912,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $validate->scene($scene); } } - $batch = $this->batchValidate; + $batch = is_null($batch) ? $this->batchValidate : $batch; if (!$validate->batch($batch)->check($data)) { $this->error = $validate->getError();