正在显示
4 个修改的文件
包含
27 行增加
和
0 行删除
| @@ -39,4 +39,18 @@ class FileController extends BaseController | @@ -39,4 +39,18 @@ class FileController extends BaseController | ||
| 39 | $path = Upload::url2path($this->param['url'] ?? ''); | 39 | $path = Upload::url2path($this->param['url'] ?? ''); |
| 40 | return Storage::disk('upload')->download($path); | 40 | return Storage::disk('upload')->download($path); |
| 41 | } | 41 | } |
| 42 | + | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 文件列表 | ||
| 46 | + * @author:dc | ||
| 47 | + * @time 2023/5/29 11:42 | ||
| 48 | + */ | ||
| 49 | + public function lists(){ | ||
| 50 | + $files = Upload::lists($this->param['config'] ?? 'default'); | ||
| 51 | + return $this->success($files); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + | ||
| 42 | } | 56 | } |
| @@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Facade; | @@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Facade; | ||
| 11 | * @method static array filePut(string $filename, string $content, string|array $config="default") | 11 | * @method static array filePut(string $filename, string $content, string|array $config="default") |
| 12 | * @method static string url2path(string $url, string|array $disk="upload") | 12 | * @method static string url2path(string $url, string|array $disk="upload") |
| 13 | * @method static string path2url(string $path, string|array $disk="upload") | 13 | * @method static string path2url(string $path, string|array $disk="upload") |
| 14 | + * @method static array lists(string $config) | ||
| 14 | */ | 15 | */ |
| 15 | class Upload extends Facade | 16 | class Upload extends Facade |
| 16 | { | 17 | { |
| @@ -272,4 +272,15 @@ class UploadService extends BaseService | @@ -272,4 +272,15 @@ class UploadService extends BaseService | ||
| 272 | $this->config(); | 272 | $this->config(); |
| 273 | return Storage::disk($this->config['disk'])->url($path); | 273 | return Storage::disk($this->config['disk'])->url($path); |
| 274 | } | 274 | } |
| 275 | + | ||
| 276 | + /** | ||
| 277 | + * 文件列表 | ||
| 278 | + * @return array | ||
| 279 | + * @author:dc | ||
| 280 | + * @time 2023/5/29 11:49 | ||
| 281 | + */ | ||
| 282 | + public function lists($config){ | ||
| 283 | + $this->config($config); | ||
| 284 | + return Storage::disk($this->config['disk'])->allFiles(); | ||
| 285 | + } | ||
| 275 | } | 286 | } |
| @@ -187,6 +187,7 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () { | @@ -187,6 +187,7 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () { | ||
| 187 | //文件操作 | 187 | //文件操作 |
| 188 | Route::prefix('file')->group(function () { | 188 | Route::prefix('file')->group(function () { |
| 189 | Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload'); | 189 | Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload'); |
| 190 | + Route::get('/lists', [\App\Http\Controllers\Bside\FileController::class, 'lists'])->name('file_lists'); | ||
| 190 | }); | 191 | }); |
| 191 | //图片操作 | 192 | //图片操作 |
| 192 | Route::prefix('images')->group(function () { | 193 | Route::prefix('images')->group(function () { |
-
请 注册 或 登录 后发表评论