From 2e1a1a5a0d8f82289428df83fde4d0b554b7d59f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 6 Mar 2023 18:13:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=89=B9=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/concern/WhereQuery.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/db/concern/WhereQuery.php b/src/db/concern/WhereQuery.php index 05866764..a6412f37 100644 --- a/src/db/concern/WhereQuery.php +++ b/src/db/concern/WhereQuery.php @@ -494,18 +494,15 @@ protected function whereEq(string $field, $value): array */ protected function parseArrayWhereItems(array $field, string $logic) { - if (key($field) !== 0) { - $where = []; - foreach ($field as $key => $val) { - if ($val instanceof Raw) { - $where[] = [$key, 'exp', $val]; - } else { - $where[] = is_null($val) ? [$key, 'NULL', ''] : [$key, is_array($val) ? 'IN' : '=', $val]; - } + $where = []; + foreach ($field as $key => $val) { + if (is_int($key)) { + $where[] = $val; + } elseif ($val instanceof Raw) { + $where[] = [$key, 'exp', $val]; + } else { + $where[] = is_null($val) ? [$key, 'NULL', ''] : [$key, is_array($val) ? 'IN' : '=', $val]; } - } else { - // 数组批量查询 - $where = $field; } if (!empty($where)) {