|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using Entity.Dto.Req;
|
|
|
|
|
using Service.System;
|
|
|
|
|
using Entity.Base;
|
|
|
|
|
using Entity.DbModel.System;
|
|
|
|
|
|
|
|
|
|
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")]
|
|
|
|
|
public async Task<SqlSugarPagedList<SysFile>> Page(PageFileReq input)
|
|
|
|
|
{
|
|
|
|
|
return await _sysFileServices.Page(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|