You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

using Microsoft.AspNetCore.Mvc;
7 months ago
using System.ComponentModel.DataAnnotations;
using Entity.Dto.Req;
using Service.System;
using Entity.Base;
using Entity.DbModel.System;
using HybirdFrameworkCore.Entity;
7 months ago
namespace WebStarter.Controllers.System
{
[Produces("application/json")]
[ApiController]
public class SysFileController
{
private readonly SysFileServices _sysFileServices;
private readonly IWebHostEnvironment _webHostEnvironment;
public SysFileController(SysFileServices sysFileServices, IWebHostEnvironment webHostEnvironment)
{
_sysFileServices = sysFileServices;
_webHostEnvironment = webHostEnvironment;
}
[HttpPost]
[Route("/api/sysFile/page")]
6 months ago
public async Task<Result<PageResult<SysFile>>> Page(PageFileReq input)
7 months ago
{
6 months ago
return Result<PageResult<SysFile>>.Success(await _sysFileServices.Page(input));
7 months ago
}
[HttpPost]
[Route("/api/sysFile/uploadFile")]
public async Task<SysFile> UploadFile([Required] IFormFile file, [FromQuery] string? path)
{
return await _sysFileServices.UploadFile(file, path);
}
[HttpPost]
[Route("/api/sysFile/uploadFileFromBase64")]
public async Task<SysFile> UploadFileFromBase64(UploadFileFromBase64Req input)
{
return await _sysFileServices.UploadFileFromBase64(input);
}
[HttpPost]
[Route("/api/sysFile/uploadFiles")]
public async Task<List<SysFile>> UploadFiles([Required] List<IFormFile> files)
{
return await _sysFileServices.UploadFiles(files);
}
[HttpPost]
[Route("/api/sysFile/uploadAvatar")]
public async Task<SysFile> UploadAvatar([Required] IFormFile file)
{
return await _sysFileServices.UploadAvatar(file, _webHostEnvironment.WebRootPath);
}
}
}