平安校园
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.
 
 
 
 
 
 

88 lines
2.0 KiB

  1. //
  2. namespace SafeCampus.Web.Core;
  3. /// <summary>
  4. /// 文件管理控制器
  5. /// </summary>
  6. [ApiDescriptionSettings(Tag = "文件管理")]
  7. [Route("sys/dev/[controller]")]
  8. public class FileController : BaseController
  9. {
  10. private readonly IFileService _fileService;
  11. public FileController(IFileService fileService)
  12. {
  13. _fileService = fileService;
  14. }
  15. /// <summary>
  16. /// 文件查询分页
  17. /// </summary>
  18. /// <param name="input"></param>
  19. /// <returns></returns>
  20. [HttpGet("page")]
  21. public async Task<dynamic> Page([FromQuery] FilePageInput input)
  22. {
  23. return await _fileService.Page(input);
  24. }
  25. /// <summary>
  26. /// 上传本地文件
  27. /// </summary>
  28. /// <param name="file"></param>
  29. /// <returns></returns>
  30. [HttpPost("uploadLocal")]
  31. [DisplayName("上传本地文件")]
  32. [DisableRequestSizeLimit]
  33. public async Task<long> UploadLocal([FromForm] IFormFile file)
  34. {
  35. return await _fileService.UploadFile(SysDictConst.FILE_ENGINE_LOCAL, file);
  36. }
  37. /// <summary>
  38. /// 上传MINIO文件
  39. /// </summary>
  40. /// <param name="file"></param>
  41. /// <returns></returns>
  42. [HttpPost("uploadMinio")]
  43. [DisplayName("上传MINIO文件")]
  44. [DisableRequestSizeLimit]
  45. public async Task<long> UploadMinio([FromForm] IFormFile file)
  46. {
  47. return await _fileService.UploadFile(SysDictConst.FILE_ENGINE_MINIO, file);
  48. }
  49. /// <summary>
  50. /// 删除文件
  51. /// </summary>
  52. /// <param name="input"></param>
  53. /// <returns></returns>
  54. [HttpPost("delete")]
  55. [DisplayName("删除文件")]
  56. public async Task Delete([FromBody] BaseIdListInput input)
  57. {
  58. await _fileService.Delete(input);
  59. }
  60. /// <summary>
  61. /// 下载文件
  62. /// </summary>
  63. /// <param name="input"></param>
  64. /// <returns></returns>
  65. [HttpGet("download")]
  66. [DisplayName("下载文件")]
  67. public async Task<IActionResult> DownLoad([FromQuery] BaseIdInput input)
  68. {
  69. return await _fileService.Download(input);
  70. }
  71. }