From 12dc61f761518cb6fbb162c77f144e7a24554e92 Mon Sep 17 00:00:00 2001 From: watsonhaw5566 <348748267@qq.com> Date: Fri, 19 Sep 2025 14:44:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=94=B9=E8=BF=9B=20whereJsonConta?= =?UTF-8?q?ins=20=E6=96=B9=E6=B3=95=E6=94=AF=E6=8C=81=E6=95=B0=E7=BB=84?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=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 | 147 +++++++++++++++++----------------- 1 file changed, 74 insertions(+), 73 deletions(-) diff --git a/src/db/concern/WhereQuery.php b/src/db/concern/WhereQuery.php index 3eaae5b0..7181171e 100644 --- a/src/db/concern/WhereQuery.php +++ b/src/db/concern/WhereQuery.php @@ -9,7 +9,7 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- -declare (strict_types = 1); +declare (strict_types=1); namespace think\db\concern; @@ -22,8 +22,8 @@ trait WhereQuery /** * 指定AND查询条件. * - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 * @param mixed $condition 查询条件 * * @return $this @@ -88,8 +88,8 @@ protected function parseQueryWhere(BaseQuery $query): void /** * 指定OR查询条件. * - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 * @param mixed $condition 查询条件 * * @return $this @@ -112,8 +112,8 @@ public function whereOr($field, $op = null, $condition = null) /** * 指定XOR查询条件. * - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 * @param mixed $condition 查询条件 * * @return $this @@ -135,7 +135,7 @@ public function whereXor($field, $op = null, $condition = null) /** * 指定Null查询条件. * - * @param mixed $field 查询字段 + * @param mixed $field 查询字段 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -148,7 +148,7 @@ public function whereNull(string $field, string $logic = 'AND') /** * 指定NotNull查询条件. * - * @param mixed $field 查询字段 + * @param mixed $field 查询字段 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -161,8 +161,8 @@ public function whereNotNull(string $field, string $logic = 'AND') /** * 指定Exists查询条件. * - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -180,8 +180,8 @@ public function whereExists($condition, string $logic = 'AND') /** * 指定NotExists查询条件. * - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -199,9 +199,9 @@ public function whereNotExists($condition, string $logic = 'AND') /** * 指定In查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -213,9 +213,9 @@ public function whereIn(string $field, $condition, string $logic = 'AND') /** * 指定NotIn查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -227,9 +227,9 @@ public function whereNotIn(string $field, $condition, string $logic = 'AND') /** * 指定Like查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -241,9 +241,9 @@ public function whereLike(string $field, $condition, string $logic = 'AND') /** * 指定NotLike查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -255,9 +255,9 @@ public function whereNotLike(string $field, $condition, string $logic = 'AND') /** * 指定Between查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -269,9 +269,9 @@ public function whereBetween(string $field, $condition, string $logic = 'AND') /** * 指定NotBetween查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -283,9 +283,9 @@ public function whereNotBetween(string $field, $condition, string $logic = 'AND' /** * 指定FIND_IN_SET查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -297,22 +297,23 @@ public function whereFindInSet(string $field, $condition, string $logic = 'AND') /** * 指定json_contains查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 支持传入 string | array + * @param string $logic 查询逻辑 and or xor * * @return $this */ - public function whereJsonContains(string $field, $condition, string $logic = 'AND') + public function whereJsonContains(string $field, mixed $condition, string $logic = 'AND') { if (str_contains($field, '->')) { [$field1, $field2] = explode('->', $field); - $field = 'json_extract(' . $field1 . ',\'$.' . $field2 . '\')'; + $field = 'json_extract(' . $field1 . ',\'$.' . $field2 . '\')'; } - $value = is_string($condition) ? '"' . $condition . '"' : $condition; - $name = $this->bindValue($value); + $value = is_array($condition) ? json_encode($condition) : (is_string($condition) ? '"' . $condition . '"' : $condition); + $name = $this->bindValue($value); $bind[$name] = $value; + return $this->whereRaw('json_contains(' . $field . ',:' . $name . ')', $bind, $logic); } @@ -324,17 +325,17 @@ public function whereOrJsonContains(string $field, $condition) /** * 比较两个字段. * - * @param string $field1 查询字段 + * @param string $field1 查询字段 * @param string $operator 比较操作符 - * @param string $field2 比较字段 - * @param string $logic 查询逻辑 and or xor + * @param string $field2 比较字段 + * @param string $logic 查询逻辑 and or xor * * @return $this */ public function whereColumn(string $field1, string $operator, ?string $field2 = null, string $logic = 'AND') { if (is_null($field2)) { - $field2 = $operator; + $field2 = $operator; $operator = '='; } @@ -344,8 +345,8 @@ public function whereColumn(string $field1, string $operator, ?string $field2 = /** * 设置软删除字段及条件. * - * @param string $field 查询字段 - * @param mixed $condition 查询条件 + * @param string $field 查询字段 + * @param mixed $condition 查询条件 * * @return $this */ @@ -375,9 +376,9 @@ public function withTrashed() /** * 指定Exp查询条件. * - * @param mixed $field 查询字段 + * @param mixed $field 查询字段 * @param string $where 查询条件 - * @param array $bind 参数绑定 + * @param array $bind 参数绑定 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -392,10 +393,10 @@ public function whereExp(string $field, string $where, array $bind = [], string /** * 指定字段Raw查询. * - * @param string $field 查询字段表达式 - * @param mixed $op 查询表达式 + * @param string $field 查询字段表达式 + * @param mixed $op 查询表达式 * @param string $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -403,7 +404,7 @@ public function whereFieldRaw(string $field, $op, $condition = null, string $log { if (is_null($condition)) { $condition = $op; - $op = '='; + $op = '='; } $this->options['where'][$logic][] = [new Raw($field), $op, $condition]; @@ -415,7 +416,7 @@ public function whereFieldRaw(string $field, $op, $condition = null, string $log * 指定表达式查询条件. * * @param string $where 查询条件 - * @param array $bind 参数绑定 + * @param array $bind 参数绑定 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -431,7 +432,7 @@ public function whereRaw(string $where, array $bind = [], string $logic = 'AND') * 指定表达式查询条件 OR. * * @param string $where 查询条件 - * @param array $bind 参数绑定 + * @param array $bind 参数绑定 * * @return $this */ @@ -443,12 +444,12 @@ public function whereOrRaw(string $where, array $bind = []) /** * 分析查询表达式. * - * @param string $logic 查询逻辑 and or xor - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @param array $param 查询参数 - * @param bool $strict 严格模式 + * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 + * @param mixed $condition 查询条件 + * @param array $param 查询参数 + * @param bool $strict 严格模式 * * @return $this */ @@ -510,11 +511,11 @@ protected function parseStrictWhere($field, $op, $condition, string $logic): sel /** * 分析查询表达式. * - * @param string $logic 查询逻辑 and or xor - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @param array $param 查询参数 + * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 + * @param mixed $condition 查询条件 + * @param array $param 查询参数 * * @return array */ @@ -554,7 +555,7 @@ protected function parseWhereItem(string $logic, $field, $op, $condition, array * 相等查询的主键处理. * * @param string $field 字段名 - * @param mixed $value 字段值 + * @param mixed $value 字段值 * * @return array */ @@ -570,7 +571,7 @@ protected function whereEq(string $field, $value): array /** * 数组批量查询. * - * @param array $field 批量查询 + * @param array $field 批量查询 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -590,7 +591,7 @@ protected function parseArrayWhereItems(array $field, string $logic) if (!empty($where)) { $this->options['where'][$logic] = isset($this->options['where'][$logic]) ? - array_merge($this->options['where'][$logic], $where) : $where; + array_merge($this->options['where'][$logic], $where) : $where; } return $this; @@ -622,13 +623,13 @@ public function removeWhereField(string $field, string $logic = 'AND') /** * 条件查询. * - * @param mixed $condition 满足条件(支持闭包) - * @param Closure|array $query 满足条件后执行的查询表达式(闭包或数组) + * @param mixed $condition 满足条件(支持闭包) + * @param Closure|array $query 满足条件后执行的查询表达式(闭包或数组) * @param Closure|array $otherwise 不满足条件后执行 * * @return $this */ - public function when($condition, Closure | array $query, Closure | array | null $otherwise = null): self + public function when($condition, Closure|array $query, Closure|array|null $otherwise = null): self { // 处理条件为 Closure 的情况 if ($condition instanceof Closure) { @@ -645,7 +646,7 @@ public function when($condition, Closure | array $query, Closure | array | null return $this; } - protected function executeQuery(Closure | array $query, $condition): void + protected function executeQuery(Closure|array $query, $condition): void { if ($query instanceof Closure) { $query($this, $condition); From 616d40e706ed77eaa264373b364255afa1f5993a Mon Sep 17 00:00:00 2001 From: watsonhaw5566 <348748267@qq.com> Date: Fri, 19 Sep 2025 14:50:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?style:=20=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/concern/WhereQuery.php | 147 +++++++++++++++++----------------- 1 file changed, 73 insertions(+), 74 deletions(-) diff --git a/src/db/concern/WhereQuery.php b/src/db/concern/WhereQuery.php index 7181171e..be976c7e 100644 --- a/src/db/concern/WhereQuery.php +++ b/src/db/concern/WhereQuery.php @@ -9,7 +9,7 @@ // +---------------------------------------------------------------------- // | Author: liu21st // +---------------------------------------------------------------------- -declare (strict_types=1); +declare (strict_types = 1); namespace think\db\concern; @@ -22,8 +22,8 @@ trait WhereQuery /** * 指定AND查询条件. * - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 * @param mixed $condition 查询条件 * * @return $this @@ -88,8 +88,8 @@ protected function parseQueryWhere(BaseQuery $query): void /** * 指定OR查询条件. * - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 * @param mixed $condition 查询条件 * * @return $this @@ -112,8 +112,8 @@ public function whereOr($field, $op = null, $condition = null) /** * 指定XOR查询条件. * - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 * @param mixed $condition 查询条件 * * @return $this @@ -135,7 +135,7 @@ public function whereXor($field, $op = null, $condition = null) /** * 指定Null查询条件. * - * @param mixed $field 查询字段 + * @param mixed $field 查询字段 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -148,7 +148,7 @@ public function whereNull(string $field, string $logic = 'AND') /** * 指定NotNull查询条件. * - * @param mixed $field 查询字段 + * @param mixed $field 查询字段 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -161,8 +161,8 @@ public function whereNotNull(string $field, string $logic = 'AND') /** * 指定Exists查询条件. * - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -180,8 +180,8 @@ public function whereExists($condition, string $logic = 'AND') /** * 指定NotExists查询条件. * - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -199,9 +199,9 @@ public function whereNotExists($condition, string $logic = 'AND') /** * 指定In查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -213,9 +213,9 @@ public function whereIn(string $field, $condition, string $logic = 'AND') /** * 指定NotIn查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -227,9 +227,9 @@ public function whereNotIn(string $field, $condition, string $logic = 'AND') /** * 指定Like查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -241,9 +241,9 @@ public function whereLike(string $field, $condition, string $logic = 'AND') /** * 指定NotLike查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -255,9 +255,9 @@ public function whereNotLike(string $field, $condition, string $logic = 'AND') /** * 指定Between查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -269,9 +269,9 @@ public function whereBetween(string $field, $condition, string $logic = 'AND') /** * 指定NotBetween查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -283,9 +283,9 @@ public function whereNotBetween(string $field, $condition, string $logic = 'AND' /** * 指定FIND_IN_SET查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -297,23 +297,22 @@ public function whereFindInSet(string $field, $condition, string $logic = 'AND') /** * 指定json_contains查询条件. * - * @param mixed $field 查询字段 - * @param mixed $condition 查询条件 支持传入 string | array - * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor * * @return $this */ - public function whereJsonContains(string $field, mixed $condition, string $logic = 'AND') + public function whereJsonContains(string $field, $condition, string $logic = 'AND') { if (str_contains($field, '->')) { [$field1, $field2] = explode('->', $field); - $field = 'json_extract(' . $field1 . ',\'$.' . $field2 . '\')'; + $field = 'json_extract(' . $field1 . ',\'$.' . $field2 . '\')'; } - $value = is_array($condition) ? json_encode($condition) : (is_string($condition) ? '"' . $condition . '"' : $condition); - $name = $this->bindValue($value); + $value = is_array($condition) ? json_encode($condition) : (is_string($condition) ? '"' . $condition . '"' : $condition); + $name = $this->bindValue($value); $bind[$name] = $value; - return $this->whereRaw('json_contains(' . $field . ',:' . $name . ')', $bind, $logic); } @@ -325,17 +324,17 @@ public function whereOrJsonContains(string $field, $condition) /** * 比较两个字段. * - * @param string $field1 查询字段 + * @param string $field1 查询字段 * @param string $operator 比较操作符 - * @param string $field2 比较字段 - * @param string $logic 查询逻辑 and or xor + * @param string $field2 比较字段 + * @param string $logic 查询逻辑 and or xor * * @return $this */ public function whereColumn(string $field1, string $operator, ?string $field2 = null, string $logic = 'AND') { if (is_null($field2)) { - $field2 = $operator; + $field2 = $operator; $operator = '='; } @@ -345,8 +344,8 @@ public function whereColumn(string $field1, string $operator, ?string $field2 = /** * 设置软删除字段及条件. * - * @param string $field 查询字段 - * @param mixed $condition 查询条件 + * @param string $field 查询字段 + * @param mixed $condition 查询条件 * * @return $this */ @@ -376,9 +375,9 @@ public function withTrashed() /** * 指定Exp查询条件. * - * @param mixed $field 查询字段 + * @param mixed $field 查询字段 * @param string $where 查询条件 - * @param array $bind 参数绑定 + * @param array $bind 参数绑定 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -393,10 +392,10 @@ public function whereExp(string $field, string $where, array $bind = [], string /** * 指定字段Raw查询. * - * @param string $field 查询字段表达式 - * @param mixed $op 查询表达式 + * @param string $field 查询字段表达式 + * @param mixed $op 查询表达式 * @param string $condition 查询条件 - * @param string $logic 查询逻辑 and or xor + * @param string $logic 查询逻辑 and or xor * * @return $this */ @@ -404,7 +403,7 @@ public function whereFieldRaw(string $field, $op, $condition = null, string $log { if (is_null($condition)) { $condition = $op; - $op = '='; + $op = '='; } $this->options['where'][$logic][] = [new Raw($field), $op, $condition]; @@ -416,7 +415,7 @@ public function whereFieldRaw(string $field, $op, $condition = null, string $log * 指定表达式查询条件. * * @param string $where 查询条件 - * @param array $bind 参数绑定 + * @param array $bind 参数绑定 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -432,7 +431,7 @@ public function whereRaw(string $where, array $bind = [], string $logic = 'AND') * 指定表达式查询条件 OR. * * @param string $where 查询条件 - * @param array $bind 参数绑定 + * @param array $bind 参数绑定 * * @return $this */ @@ -444,12 +443,12 @@ public function whereOrRaw(string $where, array $bind = []) /** * 分析查询表达式. * - * @param string $logic 查询逻辑 and or xor - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @param array $param 查询参数 - * @param bool $strict 严格模式 + * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 + * @param mixed $condition 查询条件 + * @param array $param 查询参数 + * @param bool $strict 严格模式 * * @return $this */ @@ -511,11 +510,11 @@ protected function parseStrictWhere($field, $op, $condition, string $logic): sel /** * 分析查询表达式. * - * @param string $logic 查询逻辑 and or xor - * @param mixed $field 查询字段 - * @param mixed $op 查询表达式 - * @param mixed $condition 查询条件 - * @param array $param 查询参数 + * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 + * @param mixed $condition 查询条件 + * @param array $param 查询参数 * * @return array */ @@ -555,7 +554,7 @@ protected function parseWhereItem(string $logic, $field, $op, $condition, array * 相等查询的主键处理. * * @param string $field 字段名 - * @param mixed $value 字段值 + * @param mixed $value 字段值 * * @return array */ @@ -571,7 +570,7 @@ protected function whereEq(string $field, $value): array /** * 数组批量查询. * - * @param array $field 批量查询 + * @param array $field 批量查询 * @param string $logic 查询逻辑 and or xor * * @return $this @@ -623,13 +622,13 @@ public function removeWhereField(string $field, string $logic = 'AND') /** * 条件查询. * - * @param mixed $condition 满足条件(支持闭包) - * @param Closure|array $query 满足条件后执行的查询表达式(闭包或数组) + * @param mixed $condition 满足条件(支持闭包) + * @param Closure|array $query 满足条件后执行的查询表达式(闭包或数组) * @param Closure|array $otherwise 不满足条件后执行 * * @return $this */ - public function when($condition, Closure|array $query, Closure|array|null $otherwise = null): self + public function when($condition, Closure | array $query, Closure | array | null $otherwise = null): self { // 处理条件为 Closure 的情况 if ($condition instanceof Closure) { @@ -646,7 +645,7 @@ public function when($condition, Closure|array $query, Closure|array|null $other return $this; } - protected function executeQuery(Closure|array $query, $condition): void + protected function executeQuery(Closure | array $query, $condition): void { if ($query instanceof Closure) { $query($this, $condition); @@ -654,4 +653,4 @@ protected function executeQuery(Closure|array $query, $condition): void $this->where($query); } } -} +} \ No newline at end of file From e22676deaa3e4b9b3b1061176648aba8f2e5b931 Mon Sep 17 00:00:00 2001 From: watsonhaw5566 <348748267@qq.com> Date: Fri, 24 Oct 2025 17:51:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8C=85=E5=89=8D?= =?UTF-8?q?=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 16ee6048..d291bd31 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "topthink/think-orm", + "name": "watsonhaw/think-orm", "description": "the PHP Database&ORM Framework", "keywords": [ "orm",