using Microsoft.AspNetCore.Mvc; using System.ComponentModel.DataAnnotations; using Entity.Dto.Req; using Service.System; using Entity.Base; using Entity.DbModel.System; using HybirdFrameworkCore.Entity; 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>> Page(PageFileReq input) { return Result>.Success(await _sysFileServices.Page(input)); } [HttpPost] [Route("/api/sysFile/uploadFile")] public async Task UploadFile([Required] IFormFile file, [FromQuery] string? path) { return await _sysFileServices.UploadFile(file, _webHostEnvironment.WebRootPath); } [HttpPost] [Route("/api/app/uploadFile")] public async Task> AppUploadFile([Required] IFormFile file) { return Result.Success(await _sysFileServices.UploadFile(file, _webHostEnvironment.WebRootPath)); } [HttpPost] [Route("/api/sysFile/uploadFileFromBase64")] public async Task UploadFileFromBase64(UploadFileFromBase64Req input) { return await _sysFileServices.UploadFileFromBase64(input); } [HttpPost] [Route("/api/sysFile/uploadFiles")] public async Task> UploadFiles([Required] List files) { return await _sysFileServices.UploadFiles(files); } [HttpPost] [Route("/api/sysFile/uploadAvatar")] public async Task UploadAvatar([Required] IFormFile file) { return await _sysFileServices.UploadAvatar(file, _webHostEnvironment.WebRootPath); } /// /// App上传头像 /// /// /// /// [HttpPost] [Route("/api/app/sysFile/uploadAvatar")] public async Task UploadAppAvatar([Required] IFormFile file, [FromForm] string loginNo) { return await _sysFileServices.UploadAppAvatar(file, _webHostEnvironment.WebRootPath,loginNo); } } }