This commit is contained in:
walkor 2022-09-25 18:03:40 +08:00
parent 2b3bc7f1b5
commit 08241c7869
2 changed files with 4 additions and 4 deletions

View File

@ -276,7 +276,7 @@ trait Crud
$field = current($allow_column); $field = current($allow_column);
} }
foreach ($where as $column => $value) { foreach ($where as $column => $value) {
if (!$value || !isset($allow_column[$column]) || if ($value === '' || !isset($allow_column[$column]) ||
(is_array($value) && ($value[0] == 'undefined' || $value[1] == 'undefined'))) { (is_array($value) && ($value[0] == 'undefined' || $value[1] == 'undefined'))) {
unset($where[$column]); unset($where[$column]);
} }

View File

@ -255,7 +255,7 @@ class TableController extends Base
$order = $order === 'ascend' ? 'asc' : 'desc'; $order = $order === 'ascend' ? 'asc' : 'desc';
$paginator = Util::db()->table($table); $paginator = Util::db()->table($table);
foreach ($request->get() as $column => $value) { foreach ($request->get() as $column => $value) {
if (!$value) { if ($value === '') {
continue; continue;
} }
if (isset($allow_column[$column])) { if (isset($allow_column[$column])) {
@ -278,9 +278,9 @@ class TableController extends Base
$items_map[$item->id] = (array)$item; $items_map[$item->id] = (array)$item;
} }
$formatted_items = []; $formatted_items = [];
foreach ($items_map as $item) { foreach ($items_map as $index => $item) {
if ($item['pid'] && isset($items_map[$item['pid']])) { if ($item['pid'] && isset($items_map[$item['pid']])) {
$items_map[$item['pid']]['children'][] = $item; $items_map[$item['pid']]['children'][] = &$items_map[$index];
} }
} }
foreach ($items_map as $item) { foreach ($items_map as $item) {