webman迁移-优化

This commit is contained in:
2026-03-18 15:10:40 +08:00
parent ea77c7b3a1
commit e2ae55319e
70 changed files with 1278 additions and 137 deletions

View File

@@ -24,6 +24,25 @@ class Group extends Backend
return null;
}
public function select(Request $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) return $response;
list($where, $alias, $limit, $order) = $this->queryBuilder();
$data = $this->model
->alias($alias)
->where($where)
->order($order)
->limit(9999)
->select()
->toArray();
return $this->success('', [
'options' => $data,
]);
}
public function add(Request $request): Response
{
$response = $this->initializeBackend($request);
@@ -106,8 +125,9 @@ class Group extends Backend
unset($rules[$ruKey]);
}
}
$row->rules = array_values($rules);
return $this->success('', ['row' => $row]);
$rowData = $row->toArray();
$rowData['rules'] = array_values($rules);
return $this->success('', ['row' => $rowData]);
}
private function handleRules(array $data): array

View File

@@ -27,8 +27,8 @@ class Rule extends Backend
$this->model = new UserRule();
$this->tree = Tree::instance();
$isTree = filter_var($request->get('isTree', $request->post('isTree', true)), FILTER_VALIDATE_BOOLEAN);
$this->initValue = $request->get('initValue', $request->post('initValue', []));
$this->initValue = is_array($this->initValue) ? array_filter($this->initValue) : [];
$initValue = $request->get('initValue') ?? $request->post('initValue') ?? [];
$this->initValue = is_array($initValue) ? array_filter($initValue) : [];
$this->keyword = $request->get('quickSearch', $request->post('quickSearch', ''));
$this->assembleTree = $isTree && !$this->initValue;
return null;