Prechádzať zdrojové kódy

Merge branch 'master' of https://git.zhongjie51.com/zhongjie51/99ditui

lifa 1 rok pred
rodič
commit
fbd2c6c310

+ 3 - 2
src/platform/ZhonTai.Admin/Domain/Notice/NoticeEntity.cs

@@ -18,8 +18,9 @@ namespace ZhonTai.Admin.Domain.Notice
         /// </summary>
         public string Title { get; set; }
         /// <summary>
-        /// 简介
+        /// 纯文本内容
         /// </summary>
+        [Column(DbType = "text")]
         public string Desc { get; set; }
         /// <summary>
         /// 内容
@@ -37,6 +38,6 @@ namespace ZhonTai.Admin.Domain.Notice
         /// <summary>
         /// 标签
         /// </summary>
-        public string Tags { get; set; }
+        public string Tags { get; set; }        
     }
 }

+ 5 - 0
src/platform/ZhonTai.Admin/Domain/Project/ProjectEntity.cs

@@ -47,6 +47,11 @@ namespace ZhonTai.Admin.Domain.Project
         [Column(DbType = " text")]
         public string Detail { get; set; }
         /// <summary>
+        /// 详情纯文本
+        /// </summary>
+        [Column(DbType = " text")]
+        public string DetailText { get; set; }
+        /// <summary>
         /// 作业要求
         /// </summary>
         public string Works { get; set; }

+ 4 - 0
src/platform/ZhonTai.Admin/Services/Notice/Dto/NoticeAddInput.cs

@@ -29,5 +29,9 @@ namespace ZhonTai.Admin.Services.Notice.Dto
         /// 标签
         /// </summary>
         public string Tags { get; set; }
+        /// <summary>
+        /// 纯文本内容
+        /// </summary>        
+        public string Desc { get; set; }
     }
 }

+ 5 - 1
src/platform/ZhonTai.Admin/Services/Project/Dto/ProjectAddInput.cs

@@ -42,13 +42,17 @@ namespace ZhonTai.Admin.Services.Project.Dto
         /// </summary>
         public string Detail { get; set; }
         /// <summary>
+        /// 详情纯文本
+        /// </summary>        
+        public string DetailText { get; set; }
+        /// <summary>
         /// 作业要求
         /// </summary>
         public string Works { get; set; }
         /// <summary>
         /// 热词 多个词英文逗号分割,
         /// </summary>
-        public string HotWords { get; set; }
+        public string HotWords { get; set; }        
         /// <summary>
         /// 项目价格
         /// </summary>

+ 104 - 0
src/platform/ZhonTai.Admin/Services/Project/ProjectService.cs

@@ -28,6 +28,16 @@ using ZhonTai.Admin.Services.Pkg;
 using ZhonTai.Admin.Domain.ProjectLink;
 using ZhonTai.Admin.Domain.Dict;
 using ZhonTai.Common.Extensions;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using System.ComponentModel.DataAnnotations;
+using System.Data;
+using System.IO;
+using ZhonTai.Admin.Core.Helpers;
+using ZhonTai.Admin.Repositories.ProjectLink;
+using ZhonTai.Common.Files;
+using Microsoft.Extensions.Options;
+using ZhonTai.Admin.Core.Configs;
 
 namespace ZhonTai.Admin.Services.Project
 {
@@ -43,6 +53,8 @@ namespace ZhonTai.Admin.Services.Project
         private readonly IProjectRecordRepository _projectRecordRepository;
         private readonly IProjectLinkRepository _projectLinkRepository;
         private readonly IDictRepository _dictRepository;
+        private OSSConfig _oSSConfig => LazyGetRequiredService<IOptions<OSSConfig>>().Value;
+        private IHttpContextAccessor _httpContextAccessor => LazyGetRequiredService<IHttpContextAccessor>();
 
         public ProjectService(IProjectRepository projectRepository, IProjectPriceRepository projectPriceRepository, IProjectRecordRepository projectRecordRepository, IProjectLinkRepository projectLinkRepository, IDictRepository dictRepository)
         {
@@ -280,6 +292,98 @@ namespace ZhonTai.Admin.Services.Project
             return list;
         }
 
+        ///// <summary>
+        ///// 上传视频文件
+        ///// </summary>
+        ///// <param name="file">文件</param>
+        ///// <param name="ProjectId">文件目录</param>
+        ///// <param name="Company">文件重命名</param>
+        ///// <returns></returns>
+        //public async Task UploadVideoAsync([Required] IFormFile file, [Required] long ProjectId, [Required] string Company)
+        //{
+        //    var localUploadConfig = _oSSConfig.LocalUploadConfig;
+
+        //    var extention = Path.GetExtension(file.FileName).ToLower();
+        //    if (extention != ".xlsx")
+        //    {
+        //        throw new Exception($"请上传excel格式文件");
+        //    }
+        //    var fileLenth = file.Length;
+        //    if (fileLenth <= 0)
+        //    {
+        //        throw new Exception("文件不能为空");
+        //    }
+        //    if (fileLenth > localUploadConfig.MaxSize)
+        //    {
+        //        throw new Exception($"文件大小不能超过{new FileSize(localUploadConfig.MaxSize)}");
+        //    }
+        //    if (ProjectId <= 0)
+        //    {
+        //        throw new Exception($"请输入有效项目Id");
+        //    }
+
+
+        //    string fileDirectory = "link";
+
+        //    string SaveFileName = FreeUtil.NewMongodbId().ToString();
+
+        //    var filePath = Path.Combine(fileDirectory, SaveFileName + extention).ToPath();
+
+        //    var uploadHelper = LazyGetRequiredService<UploadHelper>();
+        //    var env = LazyGetRequiredService<IWebHostEnvironment>();
+        //    fileDirectory = Path.Combine(env.WebRootPath, fileDirectory).ToPath();
+        //    if (!Directory.Exists(fileDirectory))
+        //    {
+        //        Directory.CreateDirectory(fileDirectory);
+        //    }
+        //    filePath = Path.Combine(env.WebRootPath, filePath).ToPath();
+        //    await uploadHelper.SaveAsync(file, filePath);
+
+        //    //导入数据
+        //    var datatable = NOPIHelper.ReadExcel(filePath);
+        //    if (datatable == null || datatable.Rows.Count <= 0)
+        //    {
+        //        throw new Exception($"文件不能为空");
+        //    }
+        //    if (datatable.Columns["编号"] == null || datatable.Columns["口令"] == null || datatable.Columns["短链"] == null || datatable.Columns["二维码"] == null || datatable.Columns["查单链接"] == null)
+        //    {
+        //        throw new Exception($"导入格式不正确");
+        //    }
+        //    var projectAny = await _projectRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.Id == ProjectId).AnyAsync();
+        //    if (!projectAny)
+        //    {
+        //        throw new Exception($"项目不存在");
+        //    }
+        //    var ListCompany = _ProjectLinkRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == ProjectId)
+        //         .GroupBy(m => m.Company).Select(m => m.Key).ToList();
+        //    if (ListCompany.Count > 0 && !ListCompany.Contains(Company))
+        //    {
+        //        throw new Exception($"一个项目只能上传一个推广码来源");
+        //    }
+        //    List<string> listNum = (from d in datatable.AsEnumerable() select d.Field<string>("编号")).ToList();
+        //    var count = await _ProjectLinkRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == ProjectId && m.Company == Company && listNum.Contains(m.Num)).CountAsync();
+        //    if (count > 0)
+        //    {
+        //        throw new Exception($"编码重复");
+        //    }
+        //    List<ProjectLinkEntity> list = new List<ProjectLinkEntity>();
+        //    foreach (DataRow row in datatable.Rows)
+        //    {
+        //        list.Add(new ProjectLinkEntity()
+        //        {
+        //            Num = row["编号"]?.ToString(),
+        //            ShareCommand = row["口令"]?.ToString(),
+        //            ShortUrl = row["短链"]?.ToString(),
+        //            QrcodeUrl = row["二维码"]?.ToString(),
+        //            QueryUrl = row["查单链接"]?.ToString(),
+        //            ProjectId = ProjectId,
+        //            Company = Company,
+        //            TenantId = -1
+        //        });
+        //    }
+        //    await _ProjectLinkRepository.InsertAsync(list);
+        //}
+
         #region 私有方法
         /// <summary>
         /// 获取项目状态

+ 16 - 1
src/platform/ZhonTai.Admin/ZhonTai.Admin.xml

@@ -2639,7 +2639,7 @@
         </member>
         <member name="P:ZhonTai.Admin.Domain.Notice.NoticeEntity.Desc">
             <summary>
-            简介
+            纯文本内容
             </summary>
         </member>
         <member name="P:ZhonTai.Admin.Domain.Notice.NoticeEntity.Content">
@@ -3224,6 +3224,11 @@
             详情
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.DetailText">
+            <summary>
+            详情纯文本
+            </summary>
+        </member>
         <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.Works">
             <summary>
             作业要求
@@ -6795,6 +6800,11 @@
             标签
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Services.Notice.Dto.NoticeAddInput.Desc">
+            <summary>
+            纯文本内容
+            </summary>        
+        </member>
         <member name="P:ZhonTai.Admin.Services.Notice.Dto.NoticeListOutput.Title">
             <summary>
             公告标题
@@ -8296,6 +8306,11 @@
             详情
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.ProjectAddInput.DetailText">
+            <summary>
+            详情纯文本
+            </summary>        
+        </member>
         <member name="P:ZhonTai.Admin.Services.Project.Dto.ProjectAddInput.Works">
             <summary>
             作业要求