33 lines
904 B
C#
33 lines
904 B
C#
using Bunny.Dao.Result;
|
|
using Bunny.Service.IService;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Minio.DataModel.Result;
|
|
|
|
namespace Bunny.WebApi.Controllers;
|
|
|
|
[Route("/api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class MinioController(IMinioService minioService) : ControllerBase
|
|
{
|
|
/// <summary>
|
|
/// 查询所有的桶
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public Result<ListAllMyBucketsResult> GetAllMyBuckets()
|
|
{
|
|
var listAllMyBucketsResult = minioService.GetAllMyBuckets();
|
|
return Result<ListAllMyBucketsResult>.Success(listAllMyBucketsResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传文件
|
|
/// </summary>
|
|
/// <param name="file">文件</param>
|
|
[HttpPost]
|
|
public Result<string> SaveMinioFile(IFormFile? file)
|
|
{
|
|
minioService.SaveMinioFile(file);
|
|
return Result<string>.Success("上传成功");
|
|
}
|
|
} |