From 329c100893d9bf643f831afd71ed6261f1b3126f Mon Sep 17 00:00:00 2001 From: alina <1449359159@qq.com> Date: Thu, 30 Mar 2023 17:18:39 +0800 Subject: [PATCH] =?UTF-8?q?Onsite=E6=9C=8D=E5=8B=99=E8=A4=87=E8=A3=BD?= =?UTF-8?q?=E6=99=82=E8=A4=87=E8=A3=BD=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShowEasy/ONSiteMaintain_UpdService.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_UpdService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_UpdService.cs index 9dabe41..02dcaa4 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_UpdService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_UpdService.cs @@ -6,6 +6,7 @@ using SqlSugar; using SqlSugar.Base; using System; using System.Collections.Generic; +using System.IO; using System.Linq; namespace EasyBL.WEBAPP.ShowEasy @@ -1449,6 +1450,18 @@ namespace EasyBL.WEBAPP.ShowEasy { PreviewFileModel.FileID = Guid.NewGuid().ToString(); PreviewFileModel.ParentID = ServiceBaseInfoModel.PreviewFile; + var sServerPath = System.Web.HttpContext.Current.Server.MapPath("/"); + var sFromFullPath = sServerPath + PreviewFileModel.FilePath; + if (File.Exists(sFromFullPath)) + { + var sToFullPath = sFromFullPath.Insert(sFromFullPath.LastIndexOf(@"."), @"(1)"); + if (File.Exists(sToFullPath)) + { + sToFullPath = sToFullPath.Insert(sToFullPath.LastIndexOf(@"."), @"(1)"); + } + Common.FnCopyFile(sFromFullPath, sToFullPath); + PreviewFileModel.FilePath = sToFullPath.Replace(sServerPath, ""); + } } if (lstPreviewFile.Count() > 0) @@ -1458,11 +1471,23 @@ namespace EasyBL.WEBAPP.ShowEasy //PreviewFile var lstBannerFile = db.Queryable() - .Where(x => x.OrgID == i_crm.ORIGID && x.ParentID == OldBannerFileGuid).ToList(); + .Where(x => x.OrgID == i_crm.ORIGID && x.ParentID == OldBannerFileGuid).ToList(); foreach (var BannerFileModel in lstBannerFile) { BannerFileModel.FileID = Guid.NewGuid().ToString(); BannerFileModel.ParentID = ServiceBaseInfoModel.BannerFile; + var sServerPath = System.Web.HttpContext.Current.Server.MapPath("/"); + var sFromFullPath = sServerPath + BannerFileModel.FilePath; + if (File.Exists(sFromFullPath)) + { + var sToFullPath = sFromFullPath.Insert(sFromFullPath.LastIndexOf(@"."), @"(1)"); + if (File.Exists(sToFullPath)) + { + sToFullPath = sToFullPath.Insert(sToFullPath.LastIndexOf(@"."), @"(1)"); + } + Common.FnCopyFile(sFromFullPath, sToFullPath); + BannerFileModel.FilePath = sToFullPath.Replace(sServerPath, ""); + } } if (lstBannerFile.Count() > 0)