Files
nl-jqrl-api/app/Http/Controllers/Api/UploadController.php

48 lines
909 B
PHP
Raw Normal View History

2025-05-12 16:13:46 +08:00
<?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),
'上传成功'
);
}
}