@@ -2,7 +2,7 @@ namespace YhCore.Model.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件信息(旧 BestSchool.Entity.FileObj,GetEnclosure/FileSave/FileSaveImage/FileMergeSave 共用)。
|
||||
/// fileurl 为相对路径(如 /UploadFile/docprint/20260101/{guid}.jpg,与旧库数据格式一致);
|
||||
/// fileurl 为相对路径(如 /upload/docprint/20260101/{guid}.jpg,与旧库数据格式一致);
|
||||
/// host 为文件访问主机前缀(旧 AuthConfig.weboa_url,新 Config.FileWebPath)。
|
||||
/// </summary>
|
||||
public class FileObj
|
||||
@@ -19,7 +19,7 @@ namespace YhCore.Model.Dto
|
||||
/// <summary>文件真实名称(含扩展名)。</summary>
|
||||
public string filename { get; set; }
|
||||
|
||||
/// <summary>相对访问路径(如 /UploadFile/docprint/20260101/{guid}.jpg)。</summary>
|
||||
/// <summary>相对访问路径(如 /upload/docprint/20260101/{guid}.jpg)。</summary>
|
||||
public string fileurl { get; set; }
|
||||
|
||||
/// <summary>文件主机前缀(Config.FileWebPath)。</summary>
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace YhCore.Service.Impl
|
||||
if (appType.ToLower() == "noticemsg") appType = "notice";
|
||||
string dtStr = DateTime.Now.ToString("yyyyMMdd");
|
||||
string physicalDir = Path.Combine(StorageRoot(), appType, dtStr);
|
||||
string outFilePath = "/UploadFile/" + appType + "/" + dtStr + "/";
|
||||
string outFilePath = "/upload/" + appType + "/" + dtStr + "/";
|
||||
|
||||
if (!Directory.Exists(physicalDir))
|
||||
Directory.CreateDirectory(physicalDir);
|
||||
@@ -109,7 +109,7 @@ namespace YhCore.Service.Impl
|
||||
if (appType.ToLower() == "noticemsg") appType = "notice";
|
||||
string dtStr = DateTime.Now.ToString("yyyyMMdd");
|
||||
string physicalDir = Path.Combine(StorageRoot(), appType, dtStr);
|
||||
string outFilePath = "/UploadFile/" + appType + "/" + dtStr + "/";
|
||||
string outFilePath = "/upload/" + appType + "/" + dtStr + "/";
|
||||
|
||||
if (!Directory.Exists(physicalDir))
|
||||
Directory.CreateDirectory(physicalDir);
|
||||
@@ -169,7 +169,7 @@ namespace YhCore.Service.Impl
|
||||
if (appType.ToLower() == "noticemsg") appType = "notice";
|
||||
string dtStr = DateTime.Now.ToString("yyyyMMdd");
|
||||
string physicalDir = Path.Combine(StorageRoot(), appType, dtStr);
|
||||
string outFilePath = "/UploadFile/" + appType + "/" + dtStr + "/";
|
||||
string outFilePath = "/upload/" + appType + "/" + dtStr + "/";
|
||||
if (!Directory.Exists(physicalDir))
|
||||
Directory.CreateDirectory(physicalDir);
|
||||
|
||||
@@ -214,22 +214,22 @@ namespace YhCore.Service.Impl
|
||||
if (string.IsNullOrEmpty(fileUrl))
|
||||
return "";
|
||||
|
||||
// 相对路径如 /UploadFile/docprint/20260101/{guid}.jpg → Config.FilePath + 子路径
|
||||
// 相对路径如 /upload/docprint/20260101/{guid}.jpg → Config.FilePath + 子路径
|
||||
var relative = fileUrl.TrimStart('/');
|
||||
const string prefix = "UploadFile/";
|
||||
const string prefix = "upload/";
|
||||
if (relative.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
||||
relative = relative.Substring(prefix.Length);
|
||||
|
||||
return Path.Combine(StorageRoot(), relative.Replace('/', Path.DirectorySeparatorChar));
|
||||
}
|
||||
|
||||
/// <summary>存储根目录(旧 Server.MapPath("~/UploadFile/");Config.FilePath 缺省时退回进程目录/UploadFile)。</summary>
|
||||
/// <summary>存储根目录(旧 Server.MapPath("~/upload/");Config.FilePath 缺省时退回进程目录/upload)。</summary>
|
||||
public static string StorageRoot()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Config.FilePath))
|
||||
return Config.FilePath;
|
||||
|
||||
return Path.Combine(AppContext.BaseDirectory, "UploadFile");
|
||||
return Path.Combine(AppContext.BaseDirectory, "upload");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace YhCore.Service.Impl
|
||||
/// 降级说明:
|
||||
/// 1. 旧 SendMessage/SendUnread/Backlog(短信、已读未读、待办中心)新项目缺失,全部降级为纯落库;
|
||||
/// 2. 教师/头像改走教务 SDK(Yh.SchClass.OpenApi),教师标识用 teaId(TeaSerId)对齐新教务;
|
||||
/// 3. 签名存文件系统(DES 加密,Config.FilePath 替代旧 Server.MapPath("~/UploadFile/"));
|
||||
/// 3. 签名存文件系统(DES 加密,Config.FilePath 替代旧 Server.MapPath("~/upload/"));
|
||||
/// 4. 旧 ServiceResult 的 Data/OtherData/Page 三段合并为单个 Result 对象
|
||||
/// (getshenheFlow / getStepInfo / getStepByJE / getdocOftable)。
|
||||
/// Excel 导入导出与审批单 PDF(DownMBOfSHRole/UpfileExcelSHRole/downUpfileSHRoleFK/ExceltotalListSHRole/
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace YhCore.Service.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 公共文件服务(移植旧 BestSchool.Service.Common.GetEnclosure/FileSaveEnclosure +
|
||||
/// BestSchool.Common.UpLoadFile.FileSave/FileSaveImage/FileChunkSave/FileMergeSave)。
|
||||
/// 存储约定:物理根目录 = Config.FilePath(≈旧 ~/UploadFile/),相对路径仍存 /UploadFile/{AppType}/{yyyyMMdd}/{guid}{ext}
|
||||
/// BestSchool.Common.upload.FileSave/FileSaveImage/FileChunkSave/FileMergeSave)。
|
||||
/// 存储约定:物理根目录 = Config.FilePath(≈旧 ~/upload/),相对路径仍存 /upload/{AppType}/{yyyyMMdd}/{guid}{ext}
|
||||
/// (与旧库数据格式一致,兼容历史记录);host 取 Config.FileWebPath(≈旧 AuthConfig.weboa_url)。
|
||||
/// 旧 ToOfficeHelper.OfficeConvertToPDF(Office COM 转 PDF)新项目缺失,降级:上传不做转 PDF,
|
||||
/// 预览时本地无 .pdf 则降级 officeapps.live.com 在线预览。
|
||||
@@ -21,10 +21,10 @@ namespace YhCore.Service.Interfaces
|
||||
/// <summary>存储附件信息(旧 FileSaveEnclosure:Common_UpFiles 落库,返回 SerID;文件名非法字符替换为 _)。</summary>
|
||||
Task<int> SaveEnclosureAsync(FileObj file, string appType);
|
||||
|
||||
/// <summary>单文件上传(旧 UpLoadFile.FileSave:扩展名白名单 + 保存 + 返回 FileObj)。</summary>
|
||||
/// <summary>单文件上传(旧 upload.FileSave:扩展名白名单 + 保存 + 返回 FileObj)。</summary>
|
||||
Task<FileObj> SaveFileAsync(string appType, IFormFile file);
|
||||
|
||||
/// <summary>图片多文件上传(旧 UpLoadFile.FileSaveImage:jpg/gif/png/jpeg)。</summary>
|
||||
/// <summary>图片多文件上传(旧 upload.FileSaveImage:jpg/gif/png/jpeg)。</summary>
|
||||
Task<List<FileObj>> SaveFileImageAsync(string appType, IFormFileCollection files);
|
||||
|
||||
/// <summary>保存分片(旧 FileChunkSave:临时目录 {guid}/ 下按索引存块)。</summary>
|
||||
@@ -33,7 +33,7 @@ namespace YhCore.Service.Interfaces
|
||||
/// <summary>合并分片(旧 FileMergeSave:按块合并 → 正式目录 + FileObj)。</summary>
|
||||
Task<FileObj> MergeSaveAsync(string appType, string guid, string fileName);
|
||||
|
||||
/// <summary>相对路径 → 物理路径(fileurl 以 /UploadFile/ 开头 → Config.FilePath + 子路径)。</summary>
|
||||
/// <summary>相对路径 → 物理路径(fileurl 以 /upload/ 开头 → Config.FilePath + 子路径)。</summary>
|
||||
string MapPhysicalPath(string fileUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"Redis": {
|
||||
"ConnectionString": "localhost:6379,defaultDatabase=0"
|
||||
},
|
||||
"FILE_PATH": "UploadFile",
|
||||
"FILE_PATH": "upload",
|
||||
"FILE_WEB_PATH": "",
|
||||
"wkhtmltopdf_path": "",
|
||||
"yh": {
|
||||
|
||||
Reference in New Issue
Block a user