diff --git a/Tiobon.Core.Model/Base/Ghrh/Ghrh_ResumeHome.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghrh/Ghrh_ResumeHome.Dto.Base.cs index 10b3253a..c347a5cc 100644 --- a/Tiobon.Core.Model/Base/Ghrh/Ghrh_ResumeHome.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghrh/Ghrh_ResumeHome.Dto.Base.cs @@ -64,7 +64,8 @@ namespace Tiobon.Core.Model.Models /// /// 性别 /// - public int? Gender { get; set; } + [Display(Name = "Telephone"), Description("性别"), MaxLength(32, ErrorMessage = "性别 不能超过 32 个字符")] + public string Gender { get; set; } /// /// 身份证号码 diff --git a/Tiobon.Core.Model/Models/Ghrh/Ghrh_ResumeHome.cs b/Tiobon.Core.Model/Models/Ghrh/Ghrh_ResumeHome.cs index 0b81dc9e..b12a969c 100644 --- a/Tiobon.Core.Model/Models/Ghrh/Ghrh_ResumeHome.cs +++ b/Tiobon.Core.Model/Models/Ghrh/Ghrh_ResumeHome.cs @@ -13,7 +13,7 @@ *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │ *│ 作者:SimonHsiao │ *└──────────────────────────────────┘ -*/ +*/ using System.ComponentModel; using System.ComponentModel.DataAnnotations; using SqlSugar; @@ -66,7 +66,8 @@ namespace Tiobon.Core.Model.Models /// /// 性别 /// - public int? Gender { get; set; } + [Display(Name = "Telephone"), Description("性别"), MaxLength(32, ErrorMessage = "性别 不能超过 32 个字符")] + public string Gender { get; set; } /// /// 身份证号码 diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs index b9fb0e26..cd14d64e 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs @@ -7,6 +7,7 @@ using Newtonsoft.Json.Linq; using SqlSugar; using Tiobon.Core.Common; using Tiobon.Core.Common.Caches; +using Tiobon.Core.Common.Helper; using Tiobon.Core.IRepository.Base; using Tiobon.Core.IServices; using Tiobon.Core.Model; @@ -48,7 +49,11 @@ public class Ghre_CourseWareServices : BaseServices x.CourseName)); } var result = await base.Add(entity); - entity.Attachments.ForEach(x => x.CourseWareId = result); + entity.Attachments.ForEach(x => + { + x.CourseWareId = result; + x.RelativePath = x.RelativePath.Replace("/Advanced", null); + }); await _ghre_CourseWareAttachmentServices.Add(entity.Attachments); return result; } @@ -63,7 +68,11 @@ public class Ghre_CourseWareServices : BaseServices x.CourseWareId == Id); - editModel.Attachments.ForEach(x => x.CourseWareId = Id); + editModel.Attachments.ForEach(x => + { + x.CourseWareId = Id; + x.RelativePath = x.RelativePath.Replace("/Advanced", null); + }); await _ghre_CourseWareAttachmentServices.Add(editModel.Attachments); @@ -86,6 +95,10 @@ public class Ghre_CourseWareServices : BaseServices(); result.result.DT_TableDataT1[0].Attachments = await _ghre_CourseWareAttachmentServices.Query(x => x.CourseWareId == body.id); + if (result.result.DT_TableDataT1[0].Attachments.Any()) + { + result.result.DT_TableDataT1[0].Attachments.ForEach(x => x.RelativePath = "/Advanced" + x.RelativePath); + } var IDS = result.result.DT_TableDataT1[0].CourseIds2; result.result.DT_TableDataT1[0].Courses = await _ghre_CourseServices.Query(x => IDS.Contains(x.Id)); @@ -202,13 +215,23 @@ public class Ghre_CourseWareServices : BaseServices x.CourseWareId == id); var webRootPath = _hostingEnvironment.WebRootPath; var outPath = $"/files/upload/{result.CourseWareName}_{result.VersionNo}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.zip"; - var files = attachments.Select(x => $"{webRootPath}{"\\" + x.RelativePath}").ToArray(); - if (files.Length > 0) + if (attachments.Any()) { + var newFilePath = $"{webRootPath}/files/upload/{SnowFlakeSingle.Instance.NextId()}"; + + Directory.CreateDirectory(newFilePath); + + attachments.ForEach(x => + { + if (File.Exists($"{webRootPath}{"\\" + x.RelativePath}")) + FileHelper.FileCoppy($"{webRootPath}{"\\" + x.RelativePath}", $"{newFilePath}/{x.AttachmentName}"); + }); + + var files = attachments.Select(x => $"{newFilePath}{"\\" + x.AttachmentName}").ToArray(); if (files.Length > 1) CreateZip($"{webRootPath}{outPath}", files); else - outPath = attachments[0].RelativePath; + outPath = newFilePath + "/" + attachments[0].AttachmentName; return ServiceResult.OprateSuccess(null, "/Advanced" + outPath); } else