feat: 新增附件列表接口

This commit is contained in:
2025-02-28 15:27:49 +08:00
parent eaa6781357
commit 199ef65cdf
2 changed files with 10 additions and 3 deletions

View File

@@ -32,11 +32,15 @@ class AttachmentCategory
'name' => $params['name']??null 'name' => $params['name']??null
]) ])
->language(request()->lang_id) ->language(request()->lang_id)
->order(['sort' => 'asc', 'id' => 'desc']) ->order(['sort' => 'asc', 'id' => 'desc']);
->paginate([ if (!request()->has('scene')) {
$categorys = $categorys->paginate([
'list_rows' => $params['size'], 'list_rows' => $params['size'],
'page' => $params['page'] 'page' => $params['page']
]); ]);
} else if ('all' == request()->param('scene')) {
$categorys = $categorys->select()->hidden(['sort', 'is_show']);
}
return success('获取成功', $categorys); return success('获取成功', $categorys);
} }

View File

@@ -304,9 +304,12 @@ Route::group('v1', function () {
// 附件(下载管理)删除 // 附件(下载管理)删除
Route::delete('delete/:id', 'Attachment/delete'); Route::delete('delete/:id', 'Attachment/delete');
// 附件(下载管理)分类列表
Route::get('categorys', 'AttachmentCategory/index')->append(['scene' => 'all']);
// 附件(下载管理)分类 // 附件(下载管理)分类
Route::group('category', function () { Route::group('category', function () {
// 附件(下载管理)分类列表 // 附件(下载管理)分类分页
Route::get('index', 'AttachmentCategory/index'); Route::get('index', 'AttachmentCategory/index');
// 附件(下载管理)分类详情 // 附件(下载管理)分类详情