83 lines
2.1 KiB
C#
83 lines
2.1 KiB
C#
using Dlhis.Common.Request;
|
|
using Dlhis.Common.Response;
|
|
using Dlhis.Common.Services;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Dlhis.Common.Controllers;
|
|
|
|
/// <summary>
|
|
/// 文件上传/下载
|
|
/// </summary>
|
|
[Authorize]
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class ApkFileController : ControllerBase
|
|
{
|
|
private IApkFIileService _apkFIileService;
|
|
|
|
public ApkFileController(IApkFIileService apkFIileService)
|
|
{
|
|
_apkFIileService = apkFIileService;
|
|
}
|
|
/// <summary>
|
|
/// minlo文件上传
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("minio")]
|
|
public async Task<ApkFileResponse> FormSingleFileUpload([FromForm] ApkRequest request)
|
|
{
|
|
return await _apkFIileService.FormSingleFileUpload(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// minlo文件下载
|
|
/// </summary>
|
|
/// <param name="fileName"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("miniourl")]
|
|
public async Task<string> RequestDownloadFile(string fileName)
|
|
{
|
|
return await _apkFIileService.RequestDownloadFile(fileName);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 本地文件上传
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("uploadlocal")]
|
|
[RequestSizeLimit(100_000_0000)]
|
|
|
|
public async Task<ApkFileFormLocalResponse> FormLocalFileUpload([FromForm] ApkRequest request)
|
|
{
|
|
return await _apkFIileService.FormLocalFileUpload(request);
|
|
}
|
|
/// <summary>
|
|
/// 查看最新版本
|
|
/// </summary>
|
|
/// <param name="fileName"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("lateFile")]
|
|
public async Task<ApkFileFormLocalResponse> LatestFile(string fileName)
|
|
{
|
|
return await _apkFIileService.LatestFile(fileName);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 本地文件下载
|
|
/// </summary>
|
|
/// <param name="fileName"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("downlocal")]
|
|
public IActionResult FormLocalDownloadFile(string fileName)
|
|
{
|
|
return _apkFIileService.FormLocalDownloadFile(fileName);
|
|
}
|
|
}
|
|
|
|
|
|
|