Skip to content

Commit d02fe4d

Browse files
authored
Merge pull request #32 from teamones-open/dev_weijer
fixed: 优化验证是否唯一方法由 count 改成 find
2 parents 90adfd9 + dbf9166 commit d02fe4d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/think/Validate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,9 +1033,9 @@ public function unique($value, $rule, array $data = [], string $field = ''): boo
10331033
$currentModel->where($where);
10341034
}
10351035

1036-
$resData = $currentModel->count();
1036+
$existData = $currentModel->find();
10371037

1038-
if ($resData > 0) {
1038+
if (!empty($existData)) {
10391039
return false;
10401040
}
10411041

0 commit comments

Comments
 (0)