|
|
|
@ -9,6 +9,12 @@ using GDZZ.Application.Help;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using System;
|
|
|
|
|
using Furion;
|
|
|
|
|
using GDZZ.Core.Service;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
|
|
|
|
|
namespace GDZZ.Application
|
|
|
|
|
{
|
|
|
|
@ -42,6 +48,27 @@ namespace GDZZ.Application
|
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下载附件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/Annex/download")]
|
|
|
|
|
public async Task<IActionResult> DownloadFileInfo([FromQuery] AnnexInput input)
|
|
|
|
|
{
|
|
|
|
|
var annexfile = await this._rep.FirstOrDefaultAsync(x => x.Id == input.Id);
|
|
|
|
|
if (annexfile == null)
|
|
|
|
|
throw Oops.Oh("文件为空,下载失败");
|
|
|
|
|
var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, annexfile.FileUrl, annexfile.FileName);
|
|
|
|
|
var fileName = HttpUtility.UrlEncode(annexfile.FileName, Encoding.GetEncoding("UTF-8"));
|
|
|
|
|
var result = new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加附件管理
|
|
|
|
|
/// </summary>
|
|
|
|
|