Skip to content

Commit 8e93a13

Browse files
authored
Merge pull request #65 from teamones-open/fix_schema
fxied: 自定义字段查询修复非 in 和 not in sql 数值可能误传数组情况
2 parents 9d5325e + 543d011 commit 8e93a13

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/think/model/RelationModel.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,10 +2011,13 @@ private function parserFilterCustomItemCondition(&$filterData, $field, $conditio
20112011
$filterData["_string"] = "JSON_UNQUOTE( JSON_EXTRACT(`json`, '$.{$field}' ) ) {$itemCondition} ({$itemValue})";
20122012
}
20132013
} else {
2014+
if (is_array($itemValue)) {
2015+
$itemValue = json_encode($itemValue, JSON_UNESCAPED_UNICODE);
2016+
}
20142017
if (!empty($moduleCode)) {
2015-
$filterData["JSON_UNQUOTE( JSON_EXTRACT(`{$moduleCode}`.`json`, '$.{$field}' ) )"] = $condition;
2018+
$filterData["JSON_UNQUOTE( JSON_EXTRACT(`{$moduleCode}`.`json`, '$.{$field}' ) )"] = [$itemCondition, $itemValue];
20162019
} else {
2017-
$filterData["JSON_UNQUOTE( JSON_EXTRACT(`json`, '$.{$field}' ) )"] = $condition;
2020+
$filterData["JSON_UNQUOTE( JSON_EXTRACT(`json`, '$.{$field}' ) )"] = [$itemCondition, $itemValue];
20182021
}
20192022
}
20202023
} else {

0 commit comments

Comments
 (0)