1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-21 03:17:05 +08:00
koogua 0336a54911 1.源文件增加版权信息
2.群组状态和课程协同
2021-06-13 15:49:47 +08:00

107 lines
2.3 KiB
PHP

<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Http\Home\Controllers;
use App\Services\MyStorage as StorageService;
use App\Validators\Validator as AppValidator;
/**
* @RoutePrefix("/upload")
*/
class UploadController extends Controller
{
public function initialize()
{
$authUser = $this->getAuthUser();
$validator = new AppValidator();
$validator->checkAuthUser($authUser->id);
}
/**
* @Post("/avatar/img", name="home.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("/cover/img", name="home.upload.cover_img")
*/
public function uploadCoverImageAction()
{
$service = new StorageService();
$file = $service->uploadCoverImage();
if (!$file) {
return $this->jsonError(['msg' => '上传文件失败']);
}
$data = [
'src' => $service->getImageUrl($file->path),
'title' => $file->name,
];
return $this->jsonSuccess(['data' => $data]);
}
/**
* @Post("/content/img", name="home.upload.content_img")
*/
public function uploadContentImageAction()
{
$service = new StorageService();
$file = $service->uploadContentImage();
if (!$file) {
return $this->jsonError(['msg' => '上传文件失败']);
}
$data = [
'src' => $service->getImageUrl($file->path),
'title' => $file->name,
];
return $this->jsonSuccess(['data' => $data]);
}
/**
* @Post("/im/img", name="home.upload.im_img")
*/
public function uploadImImageAction()
{
}
/**
* @Post("/im/file", name="home.upload.im_file")
*/
public function uploadImFileAction()
{
}
}