Files
lgp-admin-plus-api/app/Http/Controllers/Api/UploadController.php
LQ bcf54c2727 初始化
缺陷:主题配色需要优化整体的同风格
2026-08-14 23:21:21 +08:00

63 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Http\Controllers\Api;
use App\BaseApp\BaseController;
use App\Service\common\UploadService;
use Illuminate\Http\JsonResponse;
class UploadController extends BaseController
{
//
public function __construct()
{
parent::__construct();
$this->service = UploadService::getInstance();
}
/**
* 图片上传
* @Method POST
* @return JsonResponse
* @throws \Exception
*/
public function image()
{
$file = request()->file('file');
return jok(
$this->service->uploadImage($file),
'上传成功'
);
}
/**
* 视频上传
* @Method POST
* @return JsonResponse
*/
public function video()
{
$file = request()->file('file');
return jok(
$this->service->uploadVideo($file),
'上传成功'
);
}
/**
* 文档上传PDF 等)
* @Method POST
* @return JsonResponse
* @throws \Exception
*/
public function file()
{
$file = request()->file('file');
return jok(
$this->service->uploadDocument($file),
'上传成功'
);
}
}