feat:增加搜索关键词包含百分号时的处理 !127

This commit is contained in:
Lysander 2023-06-25 19:36:25 +00:00 committed by 妙码生花
parent d6e37e0486
commit 3b770b5fcc

View File

@ -172,7 +172,7 @@ class Backend extends Api
foreach ($quickSearchArr as $k => $v) {
$quickSearchArr[$k] = stripos($v, ".") === false ? $tableAlias . $v : $v;
}
$where[] = [implode("|", $quickSearchArr), "LIKE", "%{$quickSearch}%"];
$where[] = [implode("|", $quickSearchArr), "LIKE", '%' . str_replace('%', '\%', $quickSearch) . '%'];
}
if ($initValue) {
$where[] = [$initKey, 'in', $initValue];
@ -254,7 +254,7 @@ class Backend extends Api
break;
case 'LIKE':
case 'NOT LIKE':
$where[] = [$fieldName, $field['operator'], "%{$field['val']}%"];
$where[] = [$fieldName, $field['operator'], '%' . str_replace('%', '\%', $field['val']) . '%'];
break;
case '>':
case '>=':