Skip to content

Commit 4556263

Browse files
committed
改进where数组查询
1 parent a96c127 commit 4556263

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
@@ -50,7 +50,7 @@ public function where($field, $op = null, $condition = null)
5050
$param = func_get_args();
5151
array_shift($param);
5252

53-
if (is_array($field)) {
53+
if (is_array($field) && !empty($field) && array_is_list($field)) {
5454
return $this->where(function ($query) use ($param, $condition, $op, $field) {
5555
return $query->parseWhereExp('AND', $field, $op, $condition, $param);
5656
});
@@ -98,7 +98,7 @@ public function whereOr($field, $op = null, $condition = null)
9898
$param = func_get_args();
9999
array_shift($param);
100100

101-
if (is_array($field) && !empty($field)) {
101+
if (is_array($field) && !empty($field) && array_is_list($field)) {
102102
return $this->where(function ($query) use ($param, $condition, $op, $field) {
103103
return $query->parseWhereExp('OR', $field, $op, $condition, $param);
104104
});
@@ -121,7 +121,7 @@ public function whereXor($field, $op = null, $condition = null)
121121
$param = func_get_args();
122122
array_shift($param);
123123

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

0 commit comments

Comments
 (0)