代码优化

master
xiaochanghai 1 year ago
parent dd1a008166
commit 4fa76e3dbb
  1. 8
      Tiobon.Core.Api/Controllers/FileController.cs

@ -7,7 +7,7 @@ namespace Tiobon.Core.Controllers;
/// 文件服务
/// </summary>
[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 获取图片
/// <summary>
/// 获取图片
/// </summary>
/// <param name="Id">主键ID</param>
/// <returns></returns>
[HttpGet("Download/{Id}"), AllowAnonymous]
public async Task<IActionResult> Download(long Id)
{
@ -99,7 +104,6 @@ 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();
var file = await _ghre_AttachmentServices.QueryById(Id);
if (file == null)
return Ok("找不到文件");

Loading…
Cancel
Save