From f507e597f4e9183b42df3c84eecb64ee8c59891e Mon Sep 17 00:00:00 2001 From: wtp <1813748440@qq.com> Date: Wed, 22 Nov 2023 15:53:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=99=84=E4=BB=B6=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Annex/AnnexService.cs | 27 +++++++++++++++++++ .../Service/Annex/Dto/AnnexInput.cs | 7 +++++ .../Service/FeedBack/FeedBackService.cs | 14 ++++++++++ 3 files changed, 48 insertions(+) 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); + } + } }