优化webman-buildadmin框架

This commit is contained in:
2026-03-19 16:30:10 +08:00
parent 6b8dfcc441
commit eb0be3fba6
7 changed files with 58 additions and 17 deletions

View File

@@ -80,6 +80,11 @@ class Backend extends Api
*/
protected bool $dataLimitFieldAutoFill = true;
/**
* 添加时自动填充 admin_id当模型有 admin_id 字段但无数据权限限制时使用)
*/
protected bool $autoFillAdminId = false;
/**
* 查看请求返回的主表字段
*/
@@ -357,8 +362,10 @@ class Backend extends Api
$order = $order ?: $this->defaultSortField;
if ($order && is_string($order)) {
$order = explode(',', $order);
$order = [$order[0] => $order[1] ?? 'asc'];
$orderParts = explode(',', $order);
$orderField = trim($orderParts[0] ?? '');
$orderDir = trim($orderParts[1] ?? 'asc');
$order = $orderField !== '' ? [$orderField => $orderDir ?: 'asc'] : [];
}
if (!$this->orderGuarantee) {
$this->orderGuarantee = [$pk => 'desc'];