From 20fc00e698fa8a27325d3783fb79f4ec1eae0852 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Wed, 21 Aug 2024 15:18:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=20=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E5=90=8E=E7=BC=80=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=B9=B4=E6=9C=88?= =?UTF-8?q?=E6=97=A5=E6=97=B6=E5=88=86=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Api/Controllers/FileController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/FileController.cs b/Tiobon.Core.Api/Controllers/FileController.cs index 764bfdb7..495e14cb 100644 --- a/Tiobon.Core.Api/Controllers/FileController.cs +++ b/Tiobon.Core.Api/Controllers/FileController.cs @@ -109,9 +109,9 @@ public class FileController : BaseApiController string pathHeader = "wwwroot/files/" + filePath; if (!Directory.Exists(pathHeader)) Directory.CreateDirectory(pathHeader); - long fileName = SnowFlakeSingle.instance.getID(); + var fileName = upload.fileName.Replace("." + ext, "_") + DateTime.Now.ToString("yyyyMMddHHmmss"); - filePath = "/files/" + filePath + "/" + $"{upload.fileName}_{fileName}.{ext}"; + filePath = "/files/" + filePath + "/" + $"{fileName}.{ext}"; //var filepath = Path.Combine(pathHeader, file.FileName); using (var stream = global::System.IO.File.Create("wwwroot/" + filePath)) { @@ -123,7 +123,7 @@ public class FileController : BaseApiController fileAttachment.AttachFileName = upload.file.FileName; fileAttachment.CreateBy = App.User.ID; fileAttachment.CreateTime = DateTime.Now; - fileAttachment.AttachmentName = fileName.ToString(); + fileAttachment.AttachmentName = fileName; fileAttachment.AttachFileExtension = ext; fileAttachment.AttachFileSize = upload.file.Length; fileAttachment.PhysicsPath = filePath; @@ -139,7 +139,7 @@ public class FileController : BaseApiController Id = fileAttachment.Id, AttachFileExtension = fileAttachment.AttachFileExtension, AttachFileName = fileAttachment.AttachFileName, - AttachmentName = fileAttachment.AttachmentName, + AttachmentName = fileName, AttachmentNo = fileAttachment.AttachmentNo, FileURL = fileAttachment.FileURL, PhysicsPath = fileAttachment.PhysicsPath,