Skip to content

Commit b7bf114

Browse files
committed
改进where数组查询
1 parent 39839b4 commit b7bf114

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/db/concern/WhereQuery.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function where($field, $op = null, $condition = null)
4848
$param = func_get_args();
4949
array_shift($param);
5050

51-
if (is_array($field)) {
51+
if (is_array($field) && !empty($field) && array_is_list($field)) {
5252
return $this->where(function ($query) use ($param, $condition, $op, $field) {
5353
return $query->parseWhereExp('AND', $field, $op, $condition, $param);
5454
});
@@ -96,7 +96,7 @@ public function whereOr($field, $op = null, $condition = null)
9696
$param = func_get_args();
9797
array_shift($param);
9898

99-
if (is_array($field) && !empty($field)) {
99+
if (is_array($field) && !empty($field) && array_is_list($field)) {
100100
return $this->where(function ($query) use ($param, $condition, $op, $field) {
101101
return $query->parseWhereExp('OR', $field, $op, $condition, $param);
102102
});
@@ -119,7 +119,7 @@ public function whereXor($field, $op = null, $condition = null)
119119
$param = func_get_args();
120120
array_shift($param);
121121

122-
if (is_array($field) && !empty($field)) {
122+
if (is_array($field) && !empty($field) && array_is_list($field)) {
123123
return $this->where(function ($query) use ($param, $condition, $op, $field) {
124124
return $query->parseWhereExp('XOR', $field, $op, $condition, $param);
125125
});

0 commit comments

Comments
 (0)