新增附件下载

development
温天培 1 year ago
parent 055328e706
commit f507e597f4

@ -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>

@ -9,6 +9,13 @@ namespace GDZZ.Application
/// </summary>
public class AnnexInput : PageInputBase
{
/// <summary>
/// 文件名
/// </summary>
public virtual long Id { get; set; }
/// <summary>
/// 文件名
/// </summary>

@ -63,5 +63,19 @@ namespace GDZZ.Application
var entity = backInput.Adapt<FeedBack>();
await _rep.InsertAsync(entity);
}
/// <summary>
/// 添加意见反馈
/// </summary>
/// <param name="backInput"></param>
/// <returns></returns>
[HttpPost("Mini/UpFeedBack")]
public async Task UpFeedBack(FeedBackInput backInput)
{
var entity = backInput.Adapt<FeedBack>();
await _rep.InsertAsync(entity);
}
}
}

Loading…
Cancel
Save