文件上传接口优化

master
xiaochanghai 1 month ago
parent 666b5dd4f7
commit 7b9399a047
  1. 6
      Tiobon.Core.Services/Ghre/Ghre_AttachmentServices.cs

@ -32,7 +32,7 @@ public class Ghre_AttachmentServices : BaseServices<Ghre_Attachment, Ghre_Attach
ext = upload.fileName.Substring(dotPos + 1);
}
var id = SnowFlakeSingle.Instance.NextId();
await FileMerge(upload.id, "." + ext, id);
await FileMerge(upload.id, "." + ext, id, upload.masterId);
using var _context = ContextFactory.CreateContext();
@ -71,13 +71,13 @@ public class Ghre_AttachmentServices : BaseServices<Ghre_Attachment, Ghre_Attach
return ServiceResult<FileUploadResult>.OprateSuccess("", null);
}
public static async Task<object> FileMerge(string lastModified, string fileExts, long NewfileName)
public static async Task<object> FileMerge(string lastModified, string fileExts, long NewfileName, string masterId)
{
string erro = "";
bool ok = false;
try
{
string wwwroot = $"{Directory.GetCurrentDirectory()}/wwwroot/files/upload/";
string wwwroot = $"{Directory.GetCurrentDirectory()}/wwwroot/files/upload/{masterId}/";
var temporary = Path.Combine(wwwroot, lastModified);//临时文件夹
//fileName = Request.Form["fileName"];//文件名
string fileExt = fileExts;//获取文件后缀

Loading…
Cancel
Save