diff --git a/GDZZ.Application/Service/Annex/AnnexService.cs b/GDZZ.Application/Service/Annex/AnnexService.cs index 3f3d63f..fe3a5d9 100644 --- a/GDZZ.Application/Service/Annex/AnnexService.cs +++ b/GDZZ.Application/Service/Annex/AnnexService.cs @@ -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(); } + + /// + /// 下载附件 + /// + /// + /// + [HttpGet("/Annex/download")] + public async Task 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; + } + + + + /// /// 增加附件管理 /// diff --git a/GDZZ.Application/Service/Annex/Dto/AnnexInput.cs b/GDZZ.Application/Service/Annex/Dto/AnnexInput.cs index ae91a9f..4029cd7 100644 --- a/GDZZ.Application/Service/Annex/Dto/AnnexInput.cs +++ b/GDZZ.Application/Service/Annex/Dto/AnnexInput.cs @@ -9,6 +9,13 @@ namespace GDZZ.Application /// public class AnnexInput : PageInputBase { + + + /// + /// 文件名 + /// + public virtual long Id { get; set; } + /// /// 文件名 /// diff --git a/GDZZ.Application/Service/FeedBack/FeedBackService.cs b/GDZZ.Application/Service/FeedBack/FeedBackService.cs index d2b8890..ca9d965 100644 --- a/GDZZ.Application/Service/FeedBack/FeedBackService.cs +++ b/GDZZ.Application/Service/FeedBack/FeedBackService.cs @@ -63,5 +63,19 @@ namespace GDZZ.Application var entity = backInput.Adapt(); await _rep.InsertAsync(entity); } + + + /// + /// 添加意见反馈 + /// + /// + /// + [HttpPost("Mini/UpFeedBack")] + public async Task UpFeedBack(FeedBackInput backInput) + { + var entity = backInput.Adapt(); + await _rep.InsertAsync(entity); + } + } }