zmq 1 year ago
parent
commit
d4e3374690

+ 4 - 0
src/platform/ZhonTai.Admin/Domain/KuaKe/KuaKeEntity.cs

@@ -46,5 +46,9 @@ namespace ZhonTai.Admin.Domain.KuaKe
         ///状态 1未报备 2报备成功 3报备失败
         /// </summary>
         public int Status { get; set; } = 1;
+        /// <summary>
+        /// 项目Id
+        /// </summary>        
+        public long ProjectId { get; set; }
     }    
 }

+ 1 - 1
src/platform/ZhonTai.Admin/Services/AdKuake/AdKuaKeService.cs

@@ -168,7 +168,7 @@ namespace ZhonTai.Admin.Services.AdKuake
             //导入数据
             list.Insert(0,new AdKuaKeExcelOutput() { 
                 KuaKeID="夸克ID",
-                Name= "姓名",
+                Name= "推广平台昵称",
                 Industry= "行业",
                 Platfrom= "推广平台",
                 CreatedTime= "申请时间"

+ 5 - 0
src/platform/ZhonTai.Admin/Services/DiTuiAPI/KuaKe/Dto/KuaKeInput.cs

@@ -9,6 +9,11 @@ namespace ZhonTai.Admin.Services.DiTuiAPI.KuaKe.Dto
 {
     public class KuaKeInput
     {
+        /// <summary>
+        /// 项目Id
+        /// </summary>
+        [Required(ErrorMessage = "请输入项目Id")]
+        public long ProjectId { get; set; }
         /// <summary>
         /// 夸克Id
         /// </summary>

+ 6 - 1
src/platform/ZhonTai.Admin/Services/DiTuiAPI/KuaKe/KuaKeService.cs

@@ -84,7 +84,12 @@ namespace ZhonTai.Admin.Services.DiTuiAPI.KuaKe
         /// <exception cref="NotImplementedException"></exception>        
         public async Task<long> AddAsync(KuaKeInput input)
         {
-           var count=await _kuaKeRepository.Select.Where(m => m.KuaKeID == input.KuaKeID).CountAsync();
+            var project = await _projectRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.Id == input.ProjectId&&m.ProjectType==2).ToOneAsync();
+            if (!(project?.Id > 0))
+            {
+                throw ResultOutput.Exception("项目不存在");
+            }            
+            var count=await _kuaKeRepository.Select.Where(m => m.KuaKeID == input.KuaKeID).CountAsync();
             if (count > 0) {
                 throw ResultOutput.Exception("夸克ID已使用");
             }

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

@@ -15,7 +15,7 @@ namespace ZhonTai.Admin.Services.Project.Dto
         /// <summary>
         /// 下次抽成比例
         /// </summary>
-        public decimal NextRatio { get; set; }
+        public decimal? NextRatio { get; set; }
         /// <summary>
         /// 下次抽成比例生效时间
         /// </summary>

+ 6 - 5
src/platform/ZhonTai.Admin/Services/Project/ProjectPriceService.cs

@@ -48,7 +48,9 @@ namespace ZhonTai.Admin.Services.Project
         {
             await ProjectPriceInitAsync();
 
-            var list = await _projectConfigRepository.Select.Where(m => m.ProjectId == 0 && m.ProjectPriceId == 0 && m.Status == 1)
+            var list = await _projectConfigRepository.Select
+                .Where(m => m.ProjectId == 0 && m.ProjectPriceId == 0 && m.Status == 1)
+                .OrderByDescending(m=>m.EffectDate)
             .ToListAsync(a => new
             {
                 a.Id,
@@ -59,16 +61,15 @@ namespace ZhonTai.Admin.Services.Project
             if (list.Count > 1)
             {
                 DateTime dtnow = DateTime.Today;
-                var current = list.FirstOrDefault(m => m.EffectDate <= dtnow);
-                var next = list.FirstOrDefault(m => m.EffectDate > dtnow);
+                var next = list[0];
+                var current = list[1];                
                 output.CurrentRatio = current.DrawRatio;
                 output.NextRatio = next.DrawRatio;
                 output.NextEffectDate = next.EffectDate;
             }
             else
             {
-                output.CurrentRatio = list[0].DrawRatio;
-                output.NextRatio = 0;
+                output.CurrentRatio = list[0].DrawRatio;                
             }
             return output;
         }

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

@@ -242,8 +242,8 @@ namespace ZhonTai.Admin.Services.Project
             {
                 throw ResultOutput.Exception("请做出有效操作");
             }
-            //上架项目需要验证推广码是否大于0
-            if (input.status == 2)
+            //拉新项目:上架项目需要验证推广码是否大于0
+            if (input.status == 2&&project.ProjectType==1)
             {
                 var count = await _projectLinkRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == input.Id && m.IsUse == 0).CountAsync();
                 if (count <= 0)