Forráskód Böngészése

前端接口屏蔽

zmq 1 éve
szülő
commit
172a7b5269

+ 3 - 3
src/hosts/DiTui.Host/Configs/appconfig.json

@@ -35,13 +35,13 @@
     //程序集列表,用于启用SchemaId命名空间
     "assemblyNameList": [],
     //路由前缀,如配置微服务文档地址:doc/module/swagger
-    "routePrefix": "admin/swagger",
+    "routePrefix": "webapi/swagger",
     //地址
     "url": "http://localhost:7000",
     "projects": [
       {
-        "name": "中台Admin",
-        "code": "admin",
+        "name": "地推API",
+        "code": "webapi",
         "version": "v3.6.5",
         "description": ""
       }

+ 20 - 20
src/hosts/DiTui.Host/Program.cs

@@ -57,25 +57,25 @@ new DiTuiHost(new HostAppOptions
             config.UseDashboard();
         }).AddSubscriberAssembly(assemblies);
 
-        //添加任务调度
-        context.Services.AddTaskScheduler(DbKeys.AppDb, options =>
-        {
-            options.ConfigureFreeSql = freeSql =>
-            {
-                freeSql.CodeFirst
-                .ConfigEntity<TaskInfo>(a =>
-                {
-                    a.Name("app_task");
-                })
-                .ConfigEntity<TaskLog>(a =>
-                {
-                    a.Name("app_task_log");
-                });
-            };
-
-            //模块任务处理器
-            options.TaskHandler = new CloudTaskHandler(options.FreeSqlCloud, DbKeys.AppDb);
-        });
+        ////添加任务调度
+        //context.Services.AddTaskScheduler(DbKeys.AppDb, options =>
+        //{
+        //    options.ConfigureFreeSql = freeSql =>
+        //    {
+        //        freeSql.CodeFirst
+        //        .ConfigEntity<TaskInfo>(a =>
+        //        {
+        //            a.Name("app_task");
+        //        })
+        //        .ConfigEntity<TaskLog>(a =>
+        //        {
+        //            a.Name("app_task_log");
+        //        });
+        //    };
+
+        //    //模块任务处理器
+        //    options.TaskHandler = new CloudTaskHandler(options.FreeSqlCloud, DbKeys.AppDb);
+        //});
     },
 
     //配置Autofac容器
@@ -111,7 +111,7 @@ new DiTuiHost(new HostAppOptions
 		}
         #endregion
 
-        app.UseTaskScheduler();
+        //app.UseTaskScheduler();
 	}
 }).Run(args);
 

+ 1 - 1
src/platform/ZhonTai.Admin/Core/Consts/AdminConsts.cs

@@ -24,5 +24,5 @@ public static partial class AdminConsts
     /// <summary>
     /// 地推
     /// </summary>
-    public const string DiTuiName = "DiTui";
+    public const string DiTuiName = "webapi";
 }

+ 3 - 28
src/platform/ZhonTai.Admin/Core/DiTuiHost.cs

@@ -204,10 +204,7 @@ namespace ZhonTai.Admin.Core
             //雪花漂移算法
             var idGeneratorOptions = new IdGeneratorOptions(1) { WorkerIdBitLength = 6 };
             _hostAppOptions?.ConfigureIdGenerator?.Invoke(idGeneratorOptions);
-            YitIdHelper.SetIdGenerator(idGeneratorOptions);
-
-            //权限处理
-            services.AddScoped<IPermissionHandler, PermissionHandler>();
+            YitIdHelper.SetIdGenerator(idGeneratorOptions);            
 
             // ClaimType不被更改
             JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
@@ -218,13 +215,7 @@ namespace ZhonTai.Admin.Core
 
             //数据库配置
             var dbConfig = ConfigHelper.Get<DbConfig>("dbconfig", env.EnvironmentName);
-            services.AddSingleton(dbConfig);
-
-            //添加数据库
-            if (!_hostAppOptions.CustomInitDb)
-            {
-                services.AddDb(env, _hostAppOptions);
-            }
+            services.AddSingleton(dbConfig);                        
 
             //上传配置
             var uploadConfig = ConfigHelper.Load("uploadconfig", env.EnvironmentName, true);
@@ -725,23 +716,7 @@ namespace ZhonTai.Admin.Core
             app.UseAuthentication();
 
             //授权
-            app.UseAuthorization();
-
-            //登录用户初始化数据权限
-            if (appConfig.Validate.DataPermission)
-            {
-                app.Use(async (ctx, next) =>
-                {
-                    var user = ctx.RequestServices.GetRequiredService<IUser>();
-                    if (user?.Id > 0)
-                    {
-                        var userService = ctx.RequestServices.GetRequiredService<IUserService>();
-                        await userService.GetDataPermissionAsync();
-                    }
-
-                    await next();
-                });
-            }
+            app.UseAuthorization();            
 
             //配置端点
             app.MapControllers();

+ 14 - 0
src/platform/ZhonTai.Admin/Domain/Project/IProjectPriceRepository.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZhonTai.Admin.Core.Repositories;
+
+namespace ZhonTai.Admin.Domain.Project
+{    
+    public interface IProjectPriceRepository : IRepositoryBase<ProjectPriceEntity>
+    {
+
+    }
+}

+ 41 - 2
src/platform/ZhonTai.Admin/Domain/Project/ProjectEntity.cs

@@ -6,9 +6,48 @@ namespace ZhonTai.Admin.Domain.Project
     /// <summary>
     /// 拉新项目
     /// </summary>
-    [Table(Name = "ad_project")]
+    [Table(Name = "ditui_project")]
     public class ProjectEntity : EntityTenant
     {
-        public string name { get; set; }
+        /// <summary>
+        /// 项目名称
+        /// </summary>
+        [Column(StringLength = 50)]
+        public string Name { get; set; }
+        /// <summary>
+        /// 项目图标
+        /// </summary>
+        [Column(StringLength = 500)]
+        public string Logo { get; set; }
+        /// <summary>
+        /// 项目简介
+        /// </summary>
+        [Column(StringLength = 200)]
+        public string Tips { get; set; }
+        /// <summary>
+        /// 最高佣金
+        /// </summary>
+        [Column(DbType = " decimal(18,2)")]
+        public decimal MaxPrice { get; set; }
+        /// <summary>
+        /// 结算周期
+        /// </summary>
+        public int SettleDay { get; set; }        
+        /// <summary>
+        /// 视频教程
+        /// </summary>
+        public string VideoUrl { get; set; }
+        /// <summary>
+        /// 状态 0待上架 1上架 2下架 3暂停
+        /// </summary>
+        public int Status { get; set; }
+        /// <summary>
+        /// 详情
+        /// </summary>
+        public string Detail { get; set; }
+        /// <summary>
+        /// 作业要求
+        /// </summary>
+        public string Works { get; set; }
     }
 }

+ 30 - 0
src/platform/ZhonTai.Admin/Domain/Project/ProjectPriceEntity.cs

@@ -0,0 +1,30 @@
+using FreeSql.DataAnnotations;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZhonTai.Admin.Core.Entities;
+
+namespace ZhonTai.Admin.Domain.Project
+{
+    /// <summary>
+    /// 项目价格
+    /// </summary>
+    [Table(Name = "ditui_project_price")]
+    public class ProjectPriceEntity : EntityTenant
+    {
+        /// <summary>
+        /// 项目名称
+        /// </summary>
+        public long ProjectId { get; set; }
+        /// <summary>
+        /// 结算标准
+        /// </summary>
+        public string Name { get; set; }
+        /// <summary>
+        /// 价格
+        /// </summary>
+        public decimal Price { get; set; }        
+    }
+}

+ 18 - 0
src/platform/ZhonTai.Admin/Repositories/Project/ProjectPriceRepository.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZhonTai.Admin.Core.Db.Transaction;
+using ZhonTai.Admin.Domain.Project;
+
+namespace ZhonTai.Admin.Repositories.Project
+{    
+    public class ProjectPriceRepository : AdminRepositoryBase<ProjectPriceEntity>, IProjectPriceRepository
+    {
+        public ProjectPriceRepository(UnitOfWorkManagerCloud muowm) : base(muowm)
+        {
+
+        }
+    }
+}

+ 12 - 0
src/platform/ZhonTai.Admin/Services/Project/Dto/ProjectAddInput.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZhonTai.Admin.Services.Project.Dto
+{
+    internal class ProjectAddInput
+    {
+    }
+}

+ 8 - 0
src/platform/ZhonTai.Admin/Services/Project/Dto/ProjectGetPageInput.cs

@@ -8,5 +8,13 @@ namespace ZhonTai.Admin.Services.Project.Dto
 {
     public class ProjectGetPageInput
     {
+        /// <summary>
+        /// 项目状态   1待上架 2上架 3下架 4暂停
+        /// </summary>
+        public int Status { get; set; }
+        /// <summary>
+        /// 关键字 项目标题
+        /// </summary>
+        public string Keywrods { get; set; }
     }
 }

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

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Data;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -8,6 +9,21 @@ namespace ZhonTai.Admin.Services.Project.Dto
 {
     public class ProjectGetPageOutput
     {
-        public string name { get; set; }
+        /// <summary>
+        /// 项目名称
+        /// </summary>        
+        public string Name { get; set; }
+        /// <summary>
+        /// 项目图标
+        /// </summary>        
+        public string Logo { get; set; }             
+        /// <summary>
+        /// 结算周期
+        /// </summary>
+        public int SettleDay { get; set; }        
+        /// <summary>
+        /// 状态 0待上架 1上架 2下架 3暂停
+        /// </summary>
+        public string Status { get; set; }        
     }
 }

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

@@ -17,7 +17,7 @@ using ZhonTai.Admin.Domain.Project;
 using ZhonTai.Admin.Services.Project.Dto;
 
 namespace ZhonTai.Admin.Services.Project
-{    
+{
     /// <summary>
     /// 项目服务
     /// </summary>
@@ -25,9 +25,13 @@ namespace ZhonTai.Admin.Services.Project
     [DynamicApi(Area = AdminConsts.AreaName)]
     public partial class ProjectService : BaseService, IProjectService, IDynamicApi
     {
-        private IProjectRepository _projectRepository => LazyGetRequiredService<IProjectRepository>();
-        public ProjectService()
+        private readonly IProjectRepository _projectRepository ;
+        private readonly IProjectPriceRepository _projectPriceRepository;
+
+        public ProjectService(IProjectRepository projectRepository, IProjectPriceRepository projectPriceRepository)
         {
+            _projectRepository = projectRepository;
+            _projectPriceRepository = projectPriceRepository;
         }
         /// <summary>
         /// 查询分页
@@ -36,27 +40,16 @@ namespace ZhonTai.Admin.Services.Project
         /// <returns></returns>
         [HttpPost]
         public async Task<PageOutput<ProjectGetPageOutput>> GetPageAsync(PageInput<ProjectGetPageInput> input)
-        {            
-            var list = await _projectRepository.Select                                    
+        {
+            string keywords = input?.Filter.Keywrods;
+            int? status = input?.Filter?.Status;
+            var list = await _projectRepository.Select
+                .WhereIf(keywords.NotNull(), (m) => m.Name.Contains(keywords))
+                .WhereIf(status != null && status > 0, (m) => m.Status == status)
             .Count(out var total)
-            .OrderByDescending(true, a => a.Id)            
+            .OrderByDescending(true, a => a.Id)
             .Page(input.CurrentPage, input.PageSize)
-            .ToListAsync(a => new ProjectGetPageOutput { name = a.name });
-
-            //if (orgId.HasValue && orgId > 0)
-            //{
-            //    var managerUserIds = await _userOrgRepository.Select
-            //        .Where(a => a.OrgId == orgId && a.IsManager == true).ToListAsync(a => a.UserId);
-
-            //    if (managerUserIds.Any())
-            //    {
-            //        var managerUsers = list.Where(a => managerUserIds.Contains(a.Id));
-            //        foreach (var managerUser in managerUsers)
-            //        {
-            //            managerUser.IsManager = true;
-            //        }
-            //    }
-            //}
+            .ToListAsync<ProjectGetPageOutput>();
 
             var data = new PageOutput<ProjectGetPageOutput>()
             {
@@ -66,5 +59,20 @@ namespace ZhonTai.Admin.Services.Project
 
             return data;
         }
+        /// <summary>
+        /// 添加项目
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<long> AddAsync(ProjectGetPageInput input)
+        {
+
+            //添加项目
+
+            //添加项目价格
+
+            return 0;
+        }
     }
 }

+ 102 - 0
src/platform/ZhonTai.Admin/ZhonTai.Admin.xml

@@ -2908,6 +2908,71 @@
             拉新项目
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.Name">
+            <summary>
+            项目名称
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.Logo">
+            <summary>
+            项目图标
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.Tips">
+            <summary>
+            项目简介
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.MaxPrice">
+            <summary>
+            最高佣金
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.SettleDay">
+            <summary>
+            结算周期
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.VideoUrl">
+            <summary>
+            视频教程
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.Status">
+            <summary>
+            状态 0待上架 1上架 2下架 3暂停
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.Detail">
+            <summary>
+            详情
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectEntity.Works">
+            <summary>
+            作业要求
+            </summary>
+        </member>
+        <member name="T:ZhonTai.Admin.Domain.Project.ProjectPriceEntity">
+            <summary>
+            项目价格
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectPriceEntity.ProjectId">
+            <summary>
+            项目名称
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectPriceEntity.Name">
+            <summary>
+            结算标准
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Domain.Project.ProjectPriceEntity.Price">
+            <summary>
+            价格
+            </summary>
+        </member>
         <member name="T:ZhonTai.Admin.Domain.RoleOrgEntity">
             <summary>
             角色部门
@@ -6592,6 +6657,36 @@
             映射配置
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.ProjectGetPageInput.Status">
+            <summary>
+            项目状态   1待上架 2上架 3下架 4暂停
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.ProjectGetPageInput.Keywrods">
+            <summary>
+            关键字 项目标题
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.ProjectGetPageOutput.Name">
+            <summary>
+            项目名称
+            </summary>        
+        </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.ProjectGetPageOutput.Logo">
+            <summary>
+            项目图标
+            </summary>        
+        </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.ProjectGetPageOutput.SettleDay">
+            <summary>
+            结算周期
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.ProjectGetPageOutput.Status">
+            <summary>
+            状态 0待上架 1上架 2下架 3暂停
+            </summary>
+        </member>
         <member name="T:ZhonTai.Admin.Services.Project.ProjectService">
             <summary>
             项目服务
@@ -6604,6 +6699,13 @@
             <param name="input"></param>
             <returns></returns>
         </member>
+        <member name="M:ZhonTai.Admin.Services.Project.ProjectService.AddAsync(ZhonTai.Admin.Services.Project.Dto.ProjectGetPageInput)">
+            <summary>
+            添加项目
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
         <member name="T:ZhonTai.Admin.Services.Role.Dto.RoleAddInput">
             <summary>
             添加

+ 12 - 0
src/platform/ZhonTai.Common/Properties/launchSettings.json

@@ -0,0 +1,12 @@
+{
+  "profiles": {
+    "ZhonTai.Common": {
+      "commandName": "Project",
+      "launchBrowser": true,
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      },
+      "applicationUrl": "https://localhost:12752;http://localhost:12753"
+    }
+  }
+}

+ 12 - 0
src/platform/ZhonTai.DynamicApi/Properties/launchSettings.json

@@ -0,0 +1,12 @@
+{
+  "profiles": {
+    "ZhonTai.DynamicApi": {
+      "commandName": "Project",
+      "launchBrowser": true,
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      },
+      "applicationUrl": "https://localhost:12750;http://localhost:12751"
+    }
+  }
+}

+ 12 - 0
src/tests/ZhonTai.Tests/Properties/launchSettings.json

@@ -0,0 +1,12 @@
+{
+  "profiles": {
+    "ZhonTai.Tests": {
+      "commandName": "Project",
+      "launchBrowser": true,
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      },
+      "applicationUrl": "https://localhost:12754;http://localhost:12755"
+    }
+  }
+}