diff --git a/app/admin/controller/routine/Attachment.php b/app/admin/controller/routine/Attachment.php index 91c840e..6a0bfff 100644 --- a/app/admin/controller/routine/Attachment.php +++ b/app/admin/controller/routine/Attachment.php @@ -14,7 +14,7 @@ class Attachment extends Backend protected ?object $model = null; protected array|string $quickSearchField = 'name'; - protected array $withJoinTable = ['admin', 'user']; + protected array $withJoinTable = ['admin']; protected array|string $defaultSortField = ['last_upload_time' => 'desc']; protected function initController(Request $request): ?Response diff --git a/app/common/model/Attachment.php b/app/common/model/Attachment.php index be2786f..0f49c1b 100644 --- a/app/common/model/Attachment.php +++ b/app/common/model/Attachment.php @@ -37,9 +37,4 @@ class Attachment extends Model { return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id'); } - - public function user(): BelongsTo - { - return $this->belongsTo(User::class, 'user_id'); - } } diff --git a/app/functions.php b/app/functions.php index 2540183..b02fc06 100644 --- a/app/functions.php +++ b/app/functions.php @@ -200,7 +200,8 @@ if (!function_exists('get_controller_path')) { $parts = explode('\\', $relative); $path = []; foreach ($parts as $p) { - $path[] = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $p)); + // 与 admin_rule.name / 前端 path 一致:驼峰首字母小写(如 AdminInfo -> adminInfo),不用 snake_case + $path[] = lcfirst($p); } return implode('/', $path); } @@ -216,7 +217,19 @@ if (!function_exists('get_controller_path')) { if (count($parts) < 2) { return $parts[0] ?? null; } - return implode('/', array_slice($parts, 1, -1)) ?: $parts[1]; + // admin/routine.Attachment/index -> routine/attachment(ThinkPHP 风格 URL 中带点的控制器段) + $middle = array_slice($parts, 1, -1); + $segments = []; + foreach ($middle as $m) { + if (str_contains($m, '.')) { + foreach (explode('.', $m) as $dotPart) { + $segments[] = lcfirst($dotPart); + } + } else { + $segments[] = lcfirst($m); + } + } + return $segments !== [] ? implode('/', $segments) : ($parts[1] ?? null); } } diff --git a/extend/ba/Auth.php b/extend/ba/Auth.php index 6fdd077..ba30168 100644 --- a/extend/ba/Auth.php +++ b/extend/ba/Auth.php @@ -85,6 +85,15 @@ class Auth } } elseif (in_array($rule, $name)) { $list[] = $rule; + } else { + // 仅勾选父级菜单(如 auth/admin)时,允许访问子路径(auth/admin/index、add 等) + $baseRule = preg_replace('/\?.*$/U', '', $rule); + foreach ((array) $name as $n) { + if ($baseRule !== '' && str_starts_with((string) $n, $baseRule . '/')) { + $list[] = $rule; + break; + } + } } } if ($relation === 'or' && !empty($list)) { diff --git a/web/src/lang/backend/en/routine/attachment.ts b/web/src/lang/backend/en/routine/attachment.ts index 23606ff..a38b96d 100644 --- a/web/src/lang/backend/en/routine/attachment.ts +++ b/web/src/lang/backend/en/routine/attachment.ts @@ -1,6 +1,5 @@ export default { 'Upload administrator': 'Upload administrator', - 'Upload user': 'Upload member', 'Storage mode': 'Storage mode', 'Physical path': 'Physical path', 'image width': 'Picture width', diff --git a/web/src/lang/backend/zh-cn/routine/attachment.ts b/web/src/lang/backend/zh-cn/routine/attachment.ts index a33d93a..11886df 100644 --- a/web/src/lang/backend/zh-cn/routine/attachment.ts +++ b/web/src/lang/backend/zh-cn/routine/attachment.ts @@ -1,6 +1,5 @@ export default { 'Upload administrator': '上传管理员', - 'Upload user': '上传会员', 'Storage mode': '存储方式', 'Physical path': '物理路径', 'image width': '图片宽度', diff --git a/web/src/views/backend/routine/attachment/index.vue b/web/src/views/backend/routine/attachment/index.vue index e279069..47fc897 100644 --- a/web/src/views/backend/routine/attachment/index.vue +++ b/web/src/views/backend/routine/attachment/index.vue @@ -82,13 +82,6 @@ const baTable = new baTableClass(new baTableApi('/admin/routine.Attachment/'), { operator: 'LIKE', operatorPlaceholder: t('Fuzzy query'), }, - { - label: t('routine.attachment.Upload user'), - prop: 'user.nickname', - align: 'center', - operator: 'LIKE', - operatorPlaceholder: t('Fuzzy query'), - }, { label: t('utils.size'), prop: 'size',