From 4fa76e3dbbb6165c17e16c5f0cebc9a30e55e802 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Tue, 7 May 2024 16:28:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Api/Controllers/FileController.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/FileController.cs b/Tiobon.Core.Api/Controllers/FileController.cs index 358bd470..2edeb900 100644 --- a/Tiobon.Core.Api/Controllers/FileController.cs +++ b/Tiobon.Core.Api/Controllers/FileController.cs @@ -7,7 +7,7 @@ namespace Tiobon.Core.Controllers; /// 文件服务 /// [Produces("application/json")] -[Route("api/File"), ApiExplorerSettings(GroupName = Grouping.GroupName_Ghre)] +[Route("api/File"), ApiExplorerSettings(GroupName = Grouping.GroupName_System)] public class FileController : BaseApiController { public ITiobonArticleServices _TiobonArticleServices { get; set; } @@ -91,6 +91,11 @@ public class FileController : BaseApiController #region 获取图片 + /// + /// 获取图片 + /// + /// 主键ID + /// [HttpGet("Download/{Id}"), AllowAnonymous] public async Task Download(long Id) { @@ -98,8 +103,7 @@ public class FileController : BaseApiController { var webRootPath = _hostingEnvironment.WebRootPath; - using var _context = ContextFactory.CreateContext(); - //var file = await _context.Ghre_Attachment.Where(o => o.Id == Id).FirstOrDefaultAsync(); + using var _context = ContextFactory.CreateContext(); var file = await _ghre_AttachmentServices.QueryById(Id); if (file == null) return Ok("找不到文件");