feat:自定义公共搜索初始化操作符号支持 !140

This commit is contained in:
Lysander 2023-10-10 05:05:06 +00:00 committed by 妙码生花
parent d242add400
commit 39df7c2821

View File

@ -188,6 +188,7 @@ class Backend extends Api
$search = $this->request->get("search/a", []); $search = $this->request->get("search/a", []);
$initKey = $this->request->get("initKey/s", $pk); $initKey = $this->request->get("initKey/s", $pk);
$initValue = $this->request->get("initValue", ''); $initValue = $this->request->get("initValue", '');
$operator = $this->request->get("operator/s", 'in');
$where = []; $where = [];
$modelTable = strtolower($this->model->getTable()); $modelTable = strtolower($this->model->getTable());
@ -203,7 +204,7 @@ class Backend extends Api
$where[] = [implode("|", $quickSearchArr), "LIKE", '%' . str_replace('%', '\%', $quickSearch) . '%']; $where[] = [implode("|", $quickSearchArr), "LIKE", '%' . str_replace('%', '\%', $quickSearch) . '%'];
} }
if ($initValue) { if ($initValue) {
$where[] = [$initKey, 'in', $initValue]; $where[] = [$initKey, $operator, $initValue];
$limit = 999999; $limit = 999999;
} }