mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-20 19:07:03 +08:00
56 lines
1.1 KiB
PHP
56 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
|
* @license https://opensource.org/licenses/GPL-2.0
|
|
* @link https://www.koogua.com
|
|
*/
|
|
|
|
|
|
namespace App\Http\Api\Controllers;
|
|
|
|
use App\Services\MyStorage as StorageService;
|
|
|
|
/**
|
|
* @RoutePrefix("/api/upload")
|
|
*/
|
|
class UploadController extends Controller
|
|
{
|
|
|
|
/**
|
|
* @Post("/avatar/img", name="api.upload.avatar_img")
|
|
*/
|
|
public function uploadAvatarImageAction()
|
|
{
|
|
$service = new StorageService();
|
|
|
|
$file = $service->uploadAvatarImage();
|
|
|
|
if (!$file) {
|
|
return $this->jsonError(['msg' => '上传文件失败']);
|
|
}
|
|
|
|
$data = [
|
|
'src' => $service->getImageUrl($file->path),
|
|
'title' => $file->name,
|
|
];
|
|
|
|
return $this->jsonSuccess(['data' => $data]);
|
|
}
|
|
|
|
/**
|
|
* @Post("/im/img", name="api.upload.im_img")
|
|
*/
|
|
public function uploadImImageAction()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* @Post("/im/file", name="api.upload.im_file")
|
|
*/
|
|
public function uploadImFileAction()
|
|
{
|
|
|
|
}
|
|
|
|
} |