diff --git a/CC.Yi.Old/CC.Yi.API/CC.Yi.API.csproj b/CC.Yi.Old/CC.Yi.API/CC.Yi.API.csproj deleted file mode 100644 index 6b3e84cf..00000000 --- a/CC.Yi.Old/CC.Yi.API/CC.Yi.API.csproj +++ /dev/null @@ -1,50 +0,0 @@ - - - - net5.0 - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - Always - - - - - - - - - - True - True - T4Startup.tt - - - - - - TextTemplatingFileGenerator - T4Startup.cs - - - - diff --git a/CC.Yi.Old/CC.Yi.API/Controllers/StudentController.cs b/CC.Yi.Old/CC.Yi.API/Controllers/StudentController.cs deleted file mode 100644 index ecbe8d2f..00000000 --- a/CC.Yi.Old/CC.Yi.API/Controllers/StudentController.cs +++ /dev/null @@ -1,175 +0,0 @@ -using CC.Yi.API.Filter; -using CC.Yi.Common; -using CC.Yi.Common.Cache; -using CC.Yi.Common.Jwt; -using CC.Yi.IBLL; -using CC.Yi.Model; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Microsoft.IdentityModel.Tokens; -using System; -using System.Collections.Generic; -using System.IdentityModel.Tokens.Jwt; -using System.Linq; -using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; - -namespace CC.Yi.API.Controllers -{ - [ApiController] - [Route("[controller]/[action]")] - public class StudentController : Controller - { - private readonly ILogger _logger;//处理日志相关文件 - - //private UserManager _userManager;//处理用户相关逻辑:添加密码,修改密码,添加删除角色等等 - //private SignInManager _signInManager;//处理注册登录的相关逻辑 - - private IstudentBll _studentBll; - public StudentController(ILogger logger, IstudentBll studentBll) - { - - _logger = logger; - _logger.LogInformation("现在你进入了StudentController控制器"); - _studentBll = studentBll; - //_userManager = userManager; - //_signInManager = signInManager; - } - #region - //关于身份认证配置使用: - //在需要身份认证的控制器上打上 [Authorize] 特性标签 - #endregion - //[HttpGet] - //public async Task IdentityTest() - //{ - // //用户登入 - // var data = await _signInManager.PasswordSignInAsync("账号", "密码", false, false); //"是否记住密码","是否登入失败锁定用户" - // //用户登出 - // await _signInManager.SignOutAsync(); - // //创建用户 - // var data2 = await _userManager.CreateAsync(new result_user { UserName="账户",Email="邮箱"},"密码"); - // //获取用户 - // var data3 = _userManager.Users;//这里可以使用Linq表达式Select - // return Ok(); - //} - - #region - //下面,这里是操作reids - #endregion - [HttpGet] - public Result GetReids() - { - var data = CacheHelper.CacheWriter.GetCache("key01"); - return Result.Success(data); - } - - #region - //下面,权限验证 - #endregion - - //发送令牌 - [HttpGet] - public Result Login(string role) - { - string userName = "admin"; - var claims = new[] - { - new Claim(JwtRegisteredClaimNames.Nbf,$"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}") , - new Claim (JwtRegisteredClaimNames.Exp,$"{new DateTimeOffset(DateTime.Now.AddMinutes(30)).ToUnixTimeSeconds()}"), - new Claim(ClaimTypes.Name, userName), - new Claim(ClaimTypes.Role,role) - - }; - var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConst.SecurityKey)); - var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - - var token = new JwtSecurityToken( - issuer: JwtConst.Domain, - audience: JwtConst.Domain, - claims: claims, - expires: DateTime.Now.AddMinutes(30), - signingCredentials: creds); - - var tokenData= new JwtSecurityTokenHandler().WriteToken(token); - return Result.Success("欢迎你!管理员!").SetData(new { token= tokenData }); - } - - [HttpGet] - [Authorize(Policy = "myadmin")]//基于策略的验证 - public Result MyAdmin() - { - return Result.Success("欢迎你!管理员!"); - } - - [HttpGet] - [Authorize(Roles ="user")]//基于角色的验证 - public Result MyUser() - { - return Result.Success("欢迎你!游客!"); - } - - - #region - //下面,经典的 增删改查 即为简易--Yi意框架 - //注意:请确保你的数据库中存在合理的数据 - #endregion - [HttpGet] - [DbContextFilter] - public async Task GetTest()//查 - { - _logger.LogInformation("调用查方法"); - var data =await _studentBll.GetAllEntities().ToListAsync(); - return Result.Success("查询成功").SetData(data); - } - [HttpGet] - [DbContextFilter] - public Result AddTest()//增 - { - _logger.LogInformation("调用增方法"); - List students = new List() {new student { name = "学生a" } ,new student { name="学生d"} }; - if (_studentBll.Add(students)) - { - return Result.Success("增加成功"); - } - else - { - return Result.Error("增加失败"); - } - - - } - [HttpGet] - [DbContextFilter] - public Result RemoveTest()//删 - { - _logger.LogInformation("调用删方法"); - if (_studentBll.Delete(u=>u.name=="学生a")) - { - return Result.Success("删除成功"); - } - else - { - return Result.Error("删除失败"); - } - } - [HttpGet] - [DbContextFilter] - public Result UpdateTest()//改 - { - _logger.LogInformation("调用改方法"); - if (_studentBll.Update(new student { id=2, name = "学生a" }, "name")) - { - return Result.Success("修改成功"); - } - else - { - return Result.Error("修改失败"); - } - - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Extension/SwaggerExtension.cs b/CC.Yi.Old/CC.Yi.API/Extension/SwaggerExtension.cs deleted file mode 100644 index 6db50f61..00000000 --- a/CC.Yi.Old/CC.Yi.API/Extension/SwaggerExtension.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; -using System; -using System.IO; - -namespace CC.Yi.API.Extension -{ - /// - /// Swagger文档扩展方法 - /// - public static class SwaggerExtension - { - public static IServiceCollection AddSwaggerService(this IServiceCollection services) - { - var apiInfo = new OpenApiInfo - { - Title = "Yi意框架-API接口", - Version = "v1", - Contact = new OpenApiContact { Name = "橙子", Email = "454313500@qq.com", Url = new System.Uri("https://jiftcc.com") } - }; - #region 注册Swagger服务 - services.AddSwaggerGen(c => - { - c.SwaggerDoc("v1", apiInfo); - - //添加注释服务 - //为 Swagger JSON and UI设置xml文档注释路径 - //获取应用程序所在目录(绝对路径,不受工作目录影响,建议采用此方法获取路径使用windwos&Linux) - var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location); - var apiXmlPath = Path.Combine(basePath, @"ApiDoc.xml");//控制器层注释 - var entityXmlPath = Path.Combine(basePath, @"Model\ModelDoc.xml");//实体注释 - //c.IncludeXmlComments(apiXmlPath, true);//true表示显示控制器注释 - //c.IncludeXmlComments(entityXmlPath); - - //添加控制器注释 - //c.DocumentFilter(); - - //添加header验证信息 - //c.OperationFilter(); - //var security = new Dictionary> { { "Bearer", new string[] { } }, }; - - c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme() - { - Description = "文本框里输入从服务器获取的Token。格式为:Bearer + 空格+token",//JWT授权(数据将在请求头中进行传输) 参数结构: \"Authorization: Bearer {token}\" - Name = "Authorization",////jwt默认的参数名称 - In = ParameterLocation.Header,////jwt默认存放Authorization信息的位置(请求头中) - Type = SecuritySchemeType.ApiKey, - }); - c.AddSecurityRequirement(new OpenApiSecurityRequirement - { - { new OpenApiSecurityScheme - { - Reference = new OpenApiReference() - { - Id = "Bearer", - Type = ReferenceType.SecurityScheme - } - }, Array.Empty() } - }); - }); - #endregion - - return services; - } - - public static void UseSwaggerService(this IApplicationBuilder app) - { - //在 Startup.Configure 方法中,启用中间件为生成的 JSON 文档和 Swagger UI 提供服务: - // Enable middleware to serve generated Swagger as a JSON endpoint. - app.UseSwagger(); - app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "JwtTest v1")); - } - - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Filter/DbContextFilter.cs b/CC.Yi.Old/CC.Yi.API/Filter/DbContextFilter.cs deleted file mode 100644 index 82fd8aac..00000000 --- a/CC.Yi.Old/CC.Yi.API/Filter/DbContextFilter.cs +++ /dev/null @@ -1,22 +0,0 @@ -using CC.Yi.DAL; -using CC.Yi.Model; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.API.Filter -{ - public class DbContextFilter : ActionFilterAttribute - { - public override void OnActionExecuting(ActionExecutingContext filterContext) - { - var cache = filterContext.HttpContext.RequestServices.GetService(typeof(DataContext)) as DataContext; - DbContentFactory.Initialize(cache); - base.OnActionExecuting(filterContext); - - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.Designer.cs deleted file mode 100644 index fa669c28..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.Designer.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.API.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20210319112041_yi1")] - partial class yi1 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.4") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("name") - .HasColumnType("int"); - - b.HasKey("id"); - - b.ToTable("student"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.cs deleted file mode 100644 index 03299091..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210319112041_yi1.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace CC.Yi.API.Migrations -{ - public partial class yi1 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "student", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - name = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_student", x => x.id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "student"); - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.Designer.cs deleted file mode 100644 index c9bbf025..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.Designer.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.API.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20210320082935_yi2")] - partial class yi2 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.4") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("id"); - - b.ToTable("student"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.cs deleted file mode 100644 index 6875efa1..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210320082935_yi2.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace CC.Yi.API.Migrations -{ - public partial class yi2 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "name", - table: "student", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(int), - oldType: "int"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "name", - table: "student", - type: "int", - nullable: false, - defaultValue: 0, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.Designer.cs deleted file mode 100644 index 2803473c..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.Designer.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -using System; -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.API.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20210325123550_yi3")] - partial class yi3 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.4") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("CC.Yi.Model.result_user", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(max)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("result_user"); - }); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("id"); - - b.ToTable("student"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.cs deleted file mode 100644 index ba0128cc..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210325123550_yi3.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace CC.Yi.API.Migrations -{ - public partial class yi3 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "result_user", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - UserName = table.Column(type: "nvarchar(max)", nullable: true), - NormalizedUserName = table.Column(type: "nvarchar(max)", nullable: true), - Email = table.Column(type: "nvarchar(max)", nullable: true), - NormalizedEmail = table.Column(type: "nvarchar(max)", nullable: true), - EmailConfirmed = table.Column(type: "bit", nullable: false), - PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), - SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), - TwoFactorEnabled = table.Column(type: "bit", nullable: false), - LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), - LockoutEnabled = table.Column(type: "bit", nullable: false), - AccessFailedCount = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_result_user", x => x.Id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "result_user"); - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.Designer.cs deleted file mode 100644 index dff90a75..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.Designer.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -using System; -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.API.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20210325124241_yi4")] - partial class yi4 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.4") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("id"); - - b.ToTable("student"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Discriminator") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers"); - - b.HasDiscriminator("Discriminator").HasValue("IdentityUser"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("CC.Yi.Model.result_user", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.HasDiscriminator().HasValue("result_user"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.cs deleted file mode 100644 index 4b105b4d..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210325124241_yi4.cs +++ /dev/null @@ -1,315 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace CC.Yi.API.Migrations -{ - public partial class yi4 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropPrimaryKey( - name: "PK_result_user", - table: "result_user"); - - migrationBuilder.RenameTable( - name: "result_user", - newName: "AspNetUsers"); - - migrationBuilder.AlterColumn( - name: "UserName", - table: "AspNetUsers", - type: "nvarchar(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NormalizedUserName", - table: "AspNetUsers", - type: "nvarchar(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NormalizedEmail", - table: "AspNetUsers", - type: "nvarchar(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Email", - table: "AspNetUsers", - type: "nvarchar(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AddColumn( - name: "Discriminator", - table: "AspNetUsers", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddPrimaryKey( - name: "PK_AspNetUsers", - table: "AspNetUsers", - column: "Id"); - - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UserId = table.Column(type: "nvarchar(450)", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), - ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), - UserId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", nullable: false), - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(450)", nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - RoleId = table.Column(type: "nvarchar(450)", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", nullable: false), - RoleId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true, - filter: "[NormalizedUserName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true, - filter: "[NormalizedName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AspNetUsers", - table: "AspNetUsers"); - - migrationBuilder.DropIndex( - name: "EmailIndex", - table: "AspNetUsers"); - - migrationBuilder.DropIndex( - name: "UserNameIndex", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "Discriminator", - table: "AspNetUsers"); - - migrationBuilder.RenameTable( - name: "AspNetUsers", - newName: "result_user"); - - migrationBuilder.AlterColumn( - name: "UserName", - table: "result_user", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NormalizedUserName", - table: "result_user", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "NormalizedEmail", - table: "result_user", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Email", - table: "result_user", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(256)", - oldMaxLength: 256, - oldNullable: true); - - migrationBuilder.AddPrimaryKey( - name: "PK_result_user", - table: "result_user", - column: "Id"); - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.Designer.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.Designer.cs deleted file mode 100644 index 6038f52c..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.Designer.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.API.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20210410090937_yi5")] - partial class yi5 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.4") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("id"); - - b.ToTable("student"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.cs b/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.cs deleted file mode 100644 index 73cf0845..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/20210410090937_yi5.cs +++ /dev/null @@ -1,220 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace CC.Yi.API.Migrations -{ - public partial class yi5 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", nullable: false), - AccessFailedCount = table.Column(type: "int", nullable: false), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - Discriminator = table.Column(type: "nvarchar(max)", nullable: false), - Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "bit", nullable: false), - LockoutEnabled = table.Column(type: "bit", nullable: false), - LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), - NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), - SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), - TwoFactorEnabled = table.Column(type: "bit", nullable: false), - UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true), - RoleId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true), - UserId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), - ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), - UserId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", nullable: false), - RoleId = table.Column(type: "nvarchar(450)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", nullable: false), - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(450)", nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true, - filter: "[NormalizedName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true, - filter: "[NormalizedUserName] IS NOT NULL"); - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Migrations/DataContextModelSnapshot.cs b/CC.Yi.Old/CC.Yi.API/Migrations/DataContextModelSnapshot.cs deleted file mode 100644 index 1952adda..00000000 --- a/CC.Yi.Old/CC.Yi.API/Migrations/DataContextModelSnapshot.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.API.Migrations -{ - [DbContext(typeof(DataContext))] - partial class DataContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.4") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("name") - .HasColumnType("nvarchar(max)"); - - b.HasKey("id"); - - b.ToTable("student"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Program.cs b/CC.Yi.Old/CC.Yi.API/Program.cs deleted file mode 100644 index 9fe2b1eb..00000000 --- a/CC.Yi.Old/CC.Yi.API/Program.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Autofac.Extensions.DependencyInjection; -using CC.Yi.DAL; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using NLog.Web; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.API -{ - public class Program - { - public static void Main(string[] args) - { - var logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); - try - { - logger.Debug("Yiܡ"); - var host = CreateHostBuilder(args).Build(); - //var scope = host.Services.CreateScope(); - //var services = scope.ServiceProvider; - //var context = services.GetRequiredService();//ȡ - //DbContentFactory.Initialize(context);//þ̬෽ע - host.Run(); - logger.Info("Yiɹ"); - } - catch (Exception exception) - { - //NLog: catch setup errors - logger.Error(exception, "Stopped program because of exception"); - throw; - } - finally - { - // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) - NLog.LogManager.Shutdown(); - } - - - - - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }).UseServiceProviderFactory(new AutofacServiceProviderFactory()) - .ConfigureLogging(logging => - { - // logging.ClearProviders(); // п̨ - logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); - }).UseNLog();//nlog־ - - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Properties/launchSettings.json b/CC.Yi.Old/CC.Yi.API/Properties/launchSettings.json deleted file mode 100644 index 9942be97..00000000 --- a/CC.Yi.Old/CC.Yi.API/Properties/launchSettings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:55197", - "sslPort": 44334 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "CC.Yi.API": { - "commandName": "Project", - "dotnetRunMessages": "true", - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:5001;http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/Startup.cs b/CC.Yi.Old/CC.Yi.API/Startup.cs deleted file mode 100644 index 55003dc4..00000000 --- a/CC.Yi.Old/CC.Yi.API/Startup.cs +++ /dev/null @@ -1,164 +0,0 @@ - -using Autofac; -using Autofac.Extras.DynamicProxy; -using CC.Yi.API.Extension; -using CC.Yi.API.Filter; -using CC.Yi.BLL; -using CC.Yi.Common.Cache; -using CC.Yi.Common.Castle; -using CC.Yi.Common.Jwt; -using CC.Yi.DAL; -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using CC.Yi.Model; -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Microsoft.IdentityModel.Tokens; -using Microsoft.OpenApi.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CC.Yi.API -{ - public partial class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - - public void ConfigureServices(IServiceCollection services) - { - // Jwt - services.AddAuthorization(options => - { - //ûڲԵ֤ - options.AddPolicy("myadmin", policy => - policy.RequireRole("admin")); - }); - - - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => { - options.TokenValidationParameters = new TokenValidationParameters - { - ValidateIssuer = true,//Ƿ֤Issuer - ValidateAudience = true,//Ƿ֤Audience - ValidateLifetime = true,//Ƿ֤ʧЧʱ - ClockSkew = TimeSpan.FromSeconds(30), - ValidateIssuerSigningKey = true,//Ƿ֤SecurityKey - ValidAudience = JwtConst.Domain,//Audience - ValidIssuer = JwtConst.Domain,//Issuerǰǩjwtһ - IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConst.SecurityKey))//õSecurityKey - }; - }); - - - services.AddControllers(); - services.AddSwaggerService(); - services.AddSession(); - - - - //ù - Action filters = new Action(r => { - //r.Filters.Add(typeof(DbContextFilter)); - }); - services.AddMvc(filters); - - //ݿ - string connection1 = Configuration["ConnectionStringBySQL"]; - string connection2 = Configuration["ConnectionStringByMySQL"]; - string connection3 = Configuration["ConnectionStringBySQLite"]; - services.AddDbContext(options => - { - options.UseSqlServer(connection1, b => b.MigrationsAssembly("CC.Yi.API"));//ݿ - }); - - - //עתAutofac - //services.AddScoped(typeof(IBaseDal<>), typeof(BaseDal<>)); - //services.AddScoped(typeof(IstudentBll), typeof(studentBll)); - - //reidsע - //services.AddSingleton(typeof(ICacheWriter), new RedisCacheService(new Microsoft.Extensions.Caching.Redis.RedisCacheOptions() - //{ - // Configuration = Configuration.GetSection("Cache.ConnectionString").Value, - // InstanceName = Configuration.GetSection("Cache.InstanceName").Value - //})); - - - //Identity֤ - //services.AddIdentity(options => - // { - // options.Password.RequiredLength = 6;//̳ - // options.Password.RequireDigit = false;// - // options.Password.RequireLowercase = false;//Сдĸ - // options.Password.RequireNonAlphanumeric = false;//ַ - // options.Password.RequireUppercase = false;//дĸ - // //options.User.RequireUniqueEmail = false;//עǷԲظ - // //options.User.AllowedUserNameCharacters="abcd"//ַֻ - //}).AddEntityFrameworkStores().AddDefaultTokenProviders(); - - // - services.AddCors(options => options.AddPolicy("CorsPolicy", - builder => - { - builder.AllowAnyMethod() - .SetIsOriginAllowed(_ => true) - .AllowAnyHeader() - .AllowCredentials(); - })); - } - - //ʼʹú - private void InitData(IServiceProvider serviceProvider) - { - //var serviceScope = serviceProvider.GetRequiredService().CreateScope(); - - //var context = serviceScope.ServiceProvider.GetService(); - //DbContentFactory.Initialize(context);//þ̬෽ע - } - - - - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - app.UseSwaggerService(); - } - - //app.UseAuthentication(); - app.UseCors("CorsPolicy"); - app.UseHttpsRedirection(); - app.UseSession(); - app.UseRouting(); - app.UseAuthentication(); - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - InitData(app.ApplicationServices); - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/T4Startup.cs b/CC.Yi.Old/CC.Yi.API/T4Startup.cs deleted file mode 100644 index 75e8a6fd..00000000 --- a/CC.Yi.Old/CC.Yi.API/T4Startup.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Autofac; -using Autofac.Extras.DynamicProxy; -using CC.Yi.BLL; -using CC.Yi.Common.Castle; -using CC.Yi.DAL; -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using System; - - -namespace CC.Yi.API -{ - public partial class Startup - { - //动态 面向AOP思想的依赖注入 Autofac - public void ConfigureContainer(ContainerBuilder builder) - { - builder.RegisterType(typeof(CustomAutofacAop)); - builder.RegisterGeneric(typeof(BaseDal<>)).As(typeof(IBaseDal<>)); - builder.RegisterType().As().EnableInterfaceInterceptors();//表示注入前后要执行Castle,AOP - } - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.API/T4Startup.tt b/CC.Yi.Old/CC.Yi.API/T4Startup.tt deleted file mode 100644 index 166ebfc5..00000000 --- a/CC.Yi.Old/CC.Yi.API/T4Startup.tt +++ /dev/null @@ -1,40 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using Autofac; -using Autofac.Extras.DynamicProxy; -using CC.Yi.BLL; -using CC.Yi.Common.Castle; -using CC.Yi.DAL; -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using System; - - -namespace CC.Yi.API -{ - public partial class Startup - { - //动态 面向AOP思想的依赖注入 Autofac - public void ConfigureContainer(ContainerBuilder builder) - { - builder.RegisterType(typeof(CustomAutofacAop)); - builder.RegisterGeneric(typeof(BaseDal<>)).As(typeof(IBaseDal<>)); -<# foreach(string k in ModelData){#> - builder.RegisterType<<#=k #>Bll>().AsBll>().EnableInterfaceInterceptors();//表示注入前后要执行Castle,AOP -<# } #> - } - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.API/appsettings.Development.json b/CC.Yi.Old/CC.Yi.API/appsettings.Development.json deleted file mode 100644 index 8983e0fc..00000000 --- a/CC.Yi.Old/CC.Yi.API/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/CC.Yi.Old/CC.Yi.API/appsettings.json b/CC.Yi.Old/CC.Yi.API/appsettings.json deleted file mode 100644 index 429d06ac..00000000 --- a/CC.Yi.Old/CC.Yi.API/appsettings.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*", - "Cache": { - "InstanceName": "Redis", - "ConnectionString": "127.0.0.1:12345,password=123456" - }, - "ConnectionStringBySQL": "server=.;Database=YIDB;UId=sa;PWD=Qz52013142020.", - "ConnectionStringByMySQL": "Data Source=.;Database=YIDB;User ID=root;Password=Qz52013142020.;pooling=true;port=3306;sslmode=none;CharSet=utf8;", - "ConnectionStringBySQLite": "Filename=YIDB.db" -} diff --git a/CC.Yi.Old/CC.Yi.API/nlog.config b/CC.Yi.Old/CC.Yi.API/nlog.config deleted file mode 100644 index ff359770..00000000 --- a/CC.Yi.Old/CC.Yi.API/nlog.config +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CC.Yi.Old/CC.Yi.BLL/BaseBll.cs b/CC.Yi.Old/CC.Yi.BLL/BaseBll.cs deleted file mode 100644 index 90cd98a0..00000000 --- a/CC.Yi.Old/CC.Yi.BLL/BaseBll.cs +++ /dev/null @@ -1,109 +0,0 @@ -using CC.Yi.DALFactory; -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; - -namespace CC.Yi.BLL -{ - public class BaseBll : IBaseBll where T : class, new() - { - public IBaseDal CurrentDal; - public BaseBll(IBaseDal cd) - { - CurrentDal = cd; - } - - public IQueryable GetAllEntities() - { - return CurrentDal.GetAllEntities(); - } - - public IQueryable GetEntities(Expression> whereLambda) - { - return CurrentDal.GetEntities(whereLambda); - } - - public int GetCount(Expression> whereLambda) //统计数量 - { - return CurrentDal.GetCount(whereLambda); - } - - public IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda) //分组 - { - return CurrentDal.GetGroup(whereLambda, groupByLambda); - - } - - - public IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc) - { - return CurrentDal.GetPageEntities(pageSize, pageIndex, out total, whereLambda, orderByLambda, isAsc); - } - - public T Add(T entity) - { - var myEntity=CurrentDal.Add(entity); - DbSession.SaveChanges(); - return myEntity; - } - - public bool Add(IEnumerable entities) - { - CurrentDal.AddRange(entities); - return DbSession.SaveChanges() > 0; - } - - public bool Update(T entity) - { - CurrentDal.Update(entity); - return DbSession.SaveChanges() > 0; - } - - public bool Update(T entity, params string[] propertyNames) - { - CurrentDal.Update(entity,propertyNames); - return DbSession.SaveChanges() > 0; - } - - public bool Delete(T entity) - { - CurrentDal.Delete(entity); - return DbSession.SaveChanges() > 0; - } - public IDbSession DbSession - { - get - { - return DbSessionFactory.GetCurrentDbSession(); - } - } - public bool Delete(int id) - { - CurrentDal.Detete(id); - return DbSession.SaveChanges() > 0; - } - - public bool Delete(IEnumerable ids) - { - foreach (var id in ids) - { - CurrentDal.Detete(id); - } - return DbSession.SaveChanges()>0; - } - public bool Delete(Expression> where) - { - IQueryable entities = CurrentDal.GetEntities(where); - if (entities != null) - { - CurrentDal.DeteteRange(entities); - - return DbSession.SaveChanges()>0; - } - return false; - } - } -} diff --git a/CC.Yi.Old/CC.Yi.BLL/CC.Yi.BLL.csproj b/CC.Yi.Old/CC.Yi.BLL/CC.Yi.BLL.csproj deleted file mode 100644 index ce6c0299..00000000 --- a/CC.Yi.Old/CC.Yi.BLL/CC.Yi.BLL.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - - TextTemplatingFileGenerator - T4BLL.cs - - - - - - - - - - True - True - T4BLL.tt - - - - diff --git a/CC.Yi.Old/CC.Yi.BLL/T4BLL.cs b/CC.Yi.Old/CC.Yi.BLL/T4BLL.cs deleted file mode 100644 index da68edd2..00000000 --- a/CC.Yi.Old/CC.Yi.BLL/T4BLL.cs +++ /dev/null @@ -1,19 +0,0 @@ - -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.BLL -{ - public partial class studentBll : BaseBll, IstudentBll - { - public studentBll(IBaseDal cd):base(cd) - { - CurrentDal = cd; - } - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.BLL/T4BLL.tt b/CC.Yi.Old/CC.Yi.BLL/T4BLL.tt deleted file mode 100644 index dcda0135..00000000 --- a/CC.Yi.Old/CC.Yi.BLL/T4BLL.tt +++ /dev/null @@ -1,37 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> - -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.BLL -{ -<# foreach(string k in ModelData){ - #> - public partial class <#=k #>Bll : BaseBll<<#=k #>>, I<#=k #>Bll - { - public <#=k #>Bll(IBaseDal<<#=k #>> cd):base(cd) - { - CurrentDal = cd; - } - } -<# } #> -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.Common/CC.Yi.Common.csproj b/CC.Yi.Old/CC.Yi.Common/CC.Yi.Common.csproj deleted file mode 100644 index 2d1ddc8f..00000000 --- a/CC.Yi.Old/CC.Yi.Common/CC.Yi.Common.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - - - - diff --git a/CC.Yi.Old/CC.Yi.Common/Cache/CacheHelper.cs b/CC.Yi.Old/CC.Yi.Common/Cache/CacheHelper.cs deleted file mode 100644 index e77f8fbc..00000000 --- a/CC.Yi.Old/CC.Yi.Common/Cache/CacheHelper.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Autofac; -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.Cache -{ - public class CacheHelper - { - public static ICacheWriter CacheWriter { get; set; } - static CacheHelper() - { - CacheHelper.CacheWriter = new RedisCache(); - } - - - - - public bool AddCache(string key, T value, DateTime expDate) - { - return CacheWriter.AddCache(key,value,expDate); - } - - public bool AddCache(string key, T value) - { - return CacheWriter.AddCache(key, value); - } - - public bool RemoveCache(string key) - { - return CacheWriter.RemoveCache(key); - } - - public T GetCache(string key) - { - return CacheWriter.GetCache(key); - } - - public bool SetCache(string key, T value, DateTime expDate) - { - return CacheWriter.SetCache(key,value,expDate); - } - - public bool SetCache(string key, T value) - { - return CacheWriter.SetCache(key, value); - } - - } -} diff --git a/CC.Yi.Old/CC.Yi.Common/Cache/ICacheWriter.cs b/CC.Yi.Old/CC.Yi.Common/Cache/ICacheWriter.cs deleted file mode 100644 index 712f6857..00000000 --- a/CC.Yi.Old/CC.Yi.Common/Cache/ICacheWriter.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CC.Yi.Common.Cache -{ - public interface ICacheWriter - { - bool AddCache(string key, T value, DateTime expDate); - bool AddCache(string key, T value); - bool RemoveCache(string key); - T GetCache(string key); - bool SetCache(string key, T value, DateTime expDate); - bool SetCache(string key, T value); - } -} diff --git a/CC.Yi.Old/CC.Yi.Common/Cache/RedisCache.cs b/CC.Yi.Old/CC.Yi.Common/Cache/RedisCache.cs deleted file mode 100644 index 3e695f02..00000000 --- a/CC.Yi.Old/CC.Yi.Common/Cache/RedisCache.cs +++ /dev/null @@ -1,48 +0,0 @@ -using ServiceStack.Redis; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.Cache -{ - public class RedisCache : ICacheWriter - { - private RedisClient client; - public string redisIp { get; set; } - - public RedisCache() - { - client = new RedisClient("127.0.0.1", 6379, "52013142020."); - } - - public bool AddCache(string key, T value, DateTime expDate) - { - return client.Add(key, value, expDate); - } - - public bool AddCache(string key, T value) - { - return client.Add(key, value); - } - - public bool RemoveCache(string key) - { - return client.Remove(key); - } - - public T GetCache(string key) - { - return client.Get(key); - } - - public bool SetCache(string key,T value, DateTime expDate) - { - return client.Set(key, value, expDate); - } - - public bool SetCache(string key, T value) - { - return client.Set(key, value); - } - } -} diff --git a/CC.Yi.Old/CC.Yi.Common/Castle/CustomAutofacAop.cs b/CC.Yi.Old/CC.Yi.Common/Castle/CustomAutofacAop.cs deleted file mode 100644 index 526d39ef..00000000 --- a/CC.Yi.Old/CC.Yi.Common/Castle/CustomAutofacAop.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Castle.DynamicProxy; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.Castle -{ - public class CustomAutofacAop : IInterceptor - { - public void Intercept(IInvocation invocation) - { - { - - //这里写执行方法前 - } - invocation.Proceed();//执行具体的实例 - { - - //这里写执行方法后 - } - } - } -} diff --git a/CC.Yi.Old/CC.Yi.Common/HttpHelper.cs b/CC.Yi.Old/CC.Yi.Common/HttpHelper.cs deleted file mode 100644 index 6bfdfb18..00000000 --- a/CC.Yi.Old/CC.Yi.Common/HttpHelper.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace CC.Yi.Common -{ - public static class HttpHelper - { - public static string HttpGet(string Url, string postDataStr="") - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr); - request.Method = "GET"; - request.ContentType = "text/html;charset=UTF-8"; - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream myResponseStream = response.GetResponseStream(); - StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); - string retString = myStreamReader.ReadToEnd(); - myStreamReader.Close(); - myResponseStream.Close(); - - return retString; - } - - public static bool HttpIOGet(string Url, string file, string postDataStr="") - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr); - request.Method = "GET"; - request.ContentType = "text/html;charset=UTF-8"; - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream myResponseStream = response.GetResponseStream(); - FileStream writer = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write); - byte[] buffer = new byte[1024]; - int c; - while ((c = myResponseStream.Read(buffer, 0, buffer.Length)) > 0) - { - writer.Write(buffer, 0, c); - } - writer.Close(); - myResponseStream.Close(); - - return true; - } - - public static string HttpPost(string Url, string postDataStr="") - { - CookieContainer cookie = new CookieContainer(); - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); - request.Method = "POST"; - request.ContentType = "application/x-www-form-urlencoded"; - request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr); - request.CookieContainer = cookie; - Stream myRequestStream = request.GetRequestStream(); - StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312")); - myStreamWriter.Write(postDataStr); - myStreamWriter.Close(); - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - - response.Cookies = cookie.GetCookies(response.ResponseUri); - Stream myResponseStream = response.GetResponseStream(); - StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); - string retString = myStreamReader.ReadToEnd(); - myStreamReader.Close(); - myResponseStream.Close(); - - return retString; - } - } -} diff --git a/CC.Yi.Old/CC.Yi.Common/ImageHelper.cs b/CC.Yi.Old/CC.Yi.Common/ImageHelper.cs deleted file mode 100644 index 170aba9c..00000000 --- a/CC.Yi.Old/CC.Yi.Common/ImageHelper.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.IO; -using System.IO.Compression; -using System.Drawing; - -namespace CC.Yi.Common -{ - public class SimilarPhoto - { - Image SourceImg; - public SimilarPhoto(string filePath) - { - SourceImg = Image.FromFile(filePath); - } - public SimilarPhoto(Stream stream) - { - SourceImg = Image.FromStream(stream); - } - public String GetHash() - { - Image image = ReduceSize(); - Byte[] grayValues = ReduceColor(image); - Byte average = CalcAverage(grayValues); - String reslut = ComputeBits(grayValues, average); - return reslut; - } - // Step 1 : Reduce size to 8*8 - private Image ReduceSize(int width = 8, int height = 8) - { - Image image = SourceImg.GetThumbnailImage(width, height, () => { return false; }, IntPtr.Zero); - return image; - } - // Step 2 : Reduce Color - private Byte[] ReduceColor(Image image) - { - Bitmap bitMap = new Bitmap(image); - Byte[] grayValues = new Byte[image.Width * image.Height]; - for (int x = 0; x < image.Width; x++) - for (int y = 0; y < image.Height; y++) - { - Color color = bitMap.GetPixel(x, y); - byte grayValue = (byte)((color.R * 30 + color.G * 59 + color.B * 11) / 100); - grayValues[x * image.Width + y] = grayValue; - } - return grayValues; - } - // Step 3 : Average the colors - private Byte CalcAverage(byte[] values) - { - int sum = 0; - for (int i = 0; i < values.Length; i++) - sum += (int)values[i]; - return Convert.ToByte(sum / values.Length); - } - // Step 4 : Compute the bits - private String ComputeBits(byte[] values, byte averageValue) - { - char[] result = new char[values.Length]; - for (int i = 0; i < values.Length; i++) - { - if (values[i] < averageValue) - result[i] = '0'; - else - result[i] = '1'; - } - SourceImg.Dispose(); - return new String(result); - } - // Compare hash - public static Int32 CalcSimilarDegree(string a, string b) - { - if (a.Length != b.Length) - throw new ArgumentException(); - int count = 0; - for (int i = 0; i < a.Length; i++) - { - if (a[i] != b[i]) - count++; - } - return count; - } - } - public static class imageHelper - { - public static int Compare(string filePath1, string filePath2) - { - SimilarPhoto photo1 = new SimilarPhoto(filePath1); - SimilarPhoto photo2 = new SimilarPhoto(filePath2); - return SimilarPhoto.CalcSimilarDegree(photo1.GetHash(), photo2.GetHash()); - } - public static bool ByStringToSave(string name, string iss) - { - iss = iss.Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "") - .Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", ""); - byte[] arr = Convert.FromBase64String(iss); - MemoryStream ms = new MemoryStream(arr); - Bitmap bmp = new Bitmap(ms); - string StudentWorkImages = "StudentWorkImages"; - - if (Directory.Exists(@"./wwwroot/" + StudentWorkImages) == false)//如果不存在就创建file文件夹 - { - Directory.CreateDirectory(@"./wwwroot/" + StudentWorkImages); - } - - - - bmp.Save(@"./wwwroot/" + StudentWorkImages + "/" + name + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); - ms.Close(); - return true; - } - public static bool CreateZip() - { - string file_path = @"./wwwroot/StudentWorkImages.zip"; - string file_path2 = @"./wwwroot/StudentWorkImages/"; - if (File.Exists(file_path)) - { - File.Delete(file_path); - } - - ZipFile.CreateFromDirectory(file_path2, file_path); - return true; - } - public static bool DeleteAll() - { - string file_path = @"./wwwroot/StudentWorkImages/"; - if (Directory.Exists(file_path)) - { - DelectDir(file_path); - return true; - } - else - return false; - } - public static bool DeleteByString(string name) - { - File.Delete(@"./wwwroot/StudentWorkImages/" + name + ".jpg"); - return true; - } - public static void DelectDir(string srcPath) - { - try - { - DirectoryInfo dir = new DirectoryInfo(srcPath); - FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录 - foreach (FileSystemInfo i in fileinfo) - { - if (i is DirectoryInfo) //判断是否文件夹 - { - DirectoryInfo subdir = new DirectoryInfo(i.FullName); - subdir.Delete(true); //删除子目录和文件 - } - else - { - File.Delete(i.FullName); //删除指定文件 - } - } - } - catch (Exception e) - { - Console.Write(e.ToString()); - } - } - } -} diff --git a/CC.Yi.Old/CC.Yi.Common/JsonHelper.cs b/CC.Yi.Old/CC.Yi.Common/JsonHelper.cs deleted file mode 100644 index bf4c8dfa..00000000 --- a/CC.Yi.Old/CC.Yi.Common/JsonHelper.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace CC.Yi.Common -{ - public static class JsonHelper - { - public static string JsonToString(object data=null, int code = 200, bool flag = true, string message = "成功") - { - return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = code, flag = flag, message = message, data = data }); - } - public static string JsonToString2(object data = null, int code = 200, bool flag = true, string message = "成功",int count=0) - { - return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = code, flag = flag, message = message, count=count,data = data }); - } - public static string ToString(object data) - { - return Newtonsoft.Json.JsonConvert.SerializeObject(data); - } - public static T ToJson(string data) - { - return Newtonsoft.Json.JsonConvert.DeserializeObject(data); - } - } -} diff --git a/CC.Yi.Old/CC.Yi.Common/Jwt/JwtConst.cs b/CC.Yi.Old/CC.Yi.Common/Jwt/JwtConst.cs deleted file mode 100644 index 1e7713ff..00000000 --- a/CC.Yi.Old/CC.Yi.Common/Jwt/JwtConst.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.Jwt -{ - public class JwtConst - { - public const string SecurityKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB"; - public const string Domain = "http://localhost:5000"; - } -} diff --git a/CC.Yi.Old/CC.Yi.Common/Result.cs b/CC.Yi.Old/CC.Yi.Common/Result.cs deleted file mode 100644 index 6f210764..00000000 --- a/CC.Yi.Old/CC.Yi.Common/Result.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace CC.Yi.Common -{ - /// - /// 结果数据 - /// - public class Result - { - public bool status { get; set; } - public int code { get; set; } - public string msg { get; set; } - public object data { get; set; } - public static Result Instance(bool status, string msg) - { - return new Result() { status = status, code = 500, msg = msg }; - } - public static Result Error(string msg = "fail") - { - return new Result() { status = false, code = 500, msg = msg }; - } - public static Result Success(string msg = "succeed") - { - return new Result() { status = true, code = 200, msg = msg }; - } - public Result SetData(object obj) - { - this.data = obj; - return this; - } - public Result SetCode(int Code) - { - this.code = Code; - return this; - } - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.DAL/BaseDal.cs b/CC.Yi.Old/CC.Yi.DAL/BaseDal.cs deleted file mode 100644 index 4839e885..00000000 --- a/CC.Yi.Old/CC.Yi.DAL/BaseDal.cs +++ /dev/null @@ -1,113 +0,0 @@ -using CC.Yi.IDAL; -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.ChangeTracking; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; - -namespace CC.Yi.DAL -{ - public class BaseDal : IBaseDal where T : class, new() - { - public DbContext Db - { - get { return DbContentFactory.GetCurrentDbContent(); } - } - public IQueryable GetEntities(Expression> whereLambda) - { - return Db.Set().Where(whereLambda).AsQueryable(); - } - - public IQueryable GetAllEntities() - { - return Db.Set().AsQueryable(); - } - - - public int GetCount(Expression> whereLambda) - { - return Db.Set().Where(whereLambda).Count(); - } - - public IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda) //分组 - { - return Db.Set().Where(whereLambda).GroupBy(groupByLambda).AsQueryable(); - - } - - - - public IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc) - { - total = Db.Set().Where(whereLambda).Count(); - if (isAsc) - { - var pageData = Db.Set().Where(whereLambda) - .OrderBy(orderByLambda) - .Skip(pageSize * (pageIndex - 1)) - .Take(pageSize).AsQueryable(); - return pageData; - } - else - { - var pageData = Db.Set().Where(whereLambda) - .OrderByDescending(orderByLambda) - .Skip(pageSize * (pageIndex - 1)) - .Take(pageSize).AsQueryable(); - return pageData; - } - } - - public T Add(T entity) - { - Db.Set().Add(entity); - //Db.SaveChanges(); - return entity; - } - public bool AddRange(IEnumerable entities) - { - Db.Set().AddRange(entities); - return true; - } - - public bool Update(T entity) - { - //所有字段均修改 - Db.Entry(entity).State = EntityState.Modified; - //return Db.SaveChanges() > 0; - return true; - } - public bool Update(T entity, params string[] propertyNames) - { - EntityEntry entry = Db.Entry(entity); - entry.State = EntityState.Unchanged; - foreach (var item in propertyNames) - { - entry.Property(item).IsModified = true; - } - return true; - } - - public bool Delete(T entity) - { - Db.Entry(entity).State = EntityState.Deleted; - //return Db.SaveChanges() > 0; - return true; - } - public bool Detete(int id) - { - var entity = Db.Set().Find(id);//根据id找到实体 - Db.Set().Remove(entity);//由于这里先Find找到了实体,所以这里可以用Remove标记该实体要移除(删除)。如果不是先Find到实体就需要用System.Data.Entity.EntityState.Deleted - return true; - } - public bool DeteteRange(IEnumerable entity) - { - Db.Set().RemoveRange(entity); - return true; - } - - - } -} diff --git a/CC.Yi.Old/CC.Yi.DAL/CC.Yi.DAL.csproj b/CC.Yi.Old/CC.Yi.DAL/CC.Yi.DAL.csproj deleted file mode 100644 index ac766382..00000000 --- a/CC.Yi.Old/CC.Yi.DAL/CC.Yi.DAL.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - TextTemplatingFileGenerator - T4DAL.cs - - - - - - - - - - True - True - T4DAL.tt - - - - diff --git a/CC.Yi.Old/CC.Yi.DAL/DbContentFactory.cs b/CC.Yi.Old/CC.Yi.DAL/DbContentFactory.cs deleted file mode 100644 index 73113740..00000000 --- a/CC.Yi.Old/CC.Yi.DAL/DbContentFactory.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using System.Collections.Concurrent; -using System.Threading; - - -namespace CC.Yi.DAL -{ - public class DbContentFactory - { - private static DataContext Webcontext; - private static object myLock = new object(); - - public static void Initialize(DataContext webContext) - { - - Monitor.Enter(myLock); - { - Webcontext = webContext; - } - } - public static DataContext GetCurrentDbContent() - { - - DataContext db = CallContext.GetData("DbContext") as DataContext; - - if (db == null)//线程在数据槽里面没有此上下文 - { - db = Webcontext; - CallContext.SetData("DbContext", db);//放到数据槽中去,DbContext是key,db是value - } - - try - { - Monitor.Exit(myLock); - } - catch - { - } - - - return db; - - - } - - private static class CallContext - { - static ConcurrentDictionary> state = new ConcurrentDictionary>(); - - public static void SetData(string name, object data) => - state.GetOrAdd(name, _ => new AsyncLocal()).Value = data; - - public static object GetData(string name) => - state.TryGetValue(name, out AsyncLocal data) ? data.Value : null; - } - } -} diff --git a/CC.Yi.Old/CC.Yi.DAL/T4DAL.cs b/CC.Yi.Old/CC.Yi.DAL/T4DAL.cs deleted file mode 100644 index ad7c9133..00000000 --- a/CC.Yi.Old/CC.Yi.DAL/T4DAL.cs +++ /dev/null @@ -1,12 +0,0 @@ -using CC.Yi.IDAL; -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.DAL -{ - public partial class studentDal : BaseDal, IstudentDal - { - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.DAL/T4DAL.tt b/CC.Yi.Old/CC.Yi.DAL/T4DAL.tt deleted file mode 100644 index 618fe8e4..00000000 --- a/CC.Yi.Old/CC.Yi.DAL/T4DAL.tt +++ /dev/null @@ -1,30 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.IDAL; -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.DAL -{ -<# foreach(string k in ModelData){ - #> - public partial class <#=k #>Dal : BaseDal<<#=k #>>, I<#=k #>Dal - { - } -<# } #> -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.DALFactory/CC.Yi.DALFactory.csproj b/CC.Yi.Old/CC.Yi.DALFactory/CC.Yi.DALFactory.csproj deleted file mode 100644 index 7019acb0..00000000 --- a/CC.Yi.Old/CC.Yi.DALFactory/CC.Yi.DALFactory.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - - - - - True - True - T4DbSession.tt - - - True - True - T4StaticDalFactory.tt - - - - - - TextTemplatingFileGenerator - T4DbSession.cs - - - TextTemplatingFileGenerator - T4StaticDalFactory.cs - - - - diff --git a/CC.Yi.Old/CC.Yi.DALFactory/DbSession.cs b/CC.Yi.Old/CC.Yi.DALFactory/DbSession.cs deleted file mode 100644 index b6de042d..00000000 --- a/CC.Yi.Old/CC.Yi.DALFactory/DbSession.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CC.Yi.DAL; -using CC.Yi.IDAL; -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using System; - -namespace CC.Yi.DALFactory -{ - public partial class DbSession : IDbSession - { - public int SaveChanges() - { - var context = DbContentFactory.GetCurrentDbContent(); - - var saved = false; - while (!saved) - { - try - { - // Attempt to save changes to the database - context.SaveChanges(); - saved = true; - } - catch (DbUpdateConcurrencyException ex) - { - foreach (var entry in ex.Entries) - { - var databaseValues = entry.GetDatabaseValues(); - - // Refresh original values to bypass next concurrency check - entry.OriginalValues.SetValues(databaseValues); - - } - } - } - - return 1; - } - public DataContext GetDbContent() - { - return DbContentFactory.GetCurrentDbContent(); - } - - } -} diff --git a/CC.Yi.Old/CC.Yi.DALFactory/DbSessionFactory.cs b/CC.Yi.Old/CC.Yi.DALFactory/DbSessionFactory.cs deleted file mode 100644 index afa24d06..00000000 --- a/CC.Yi.Old/CC.Yi.DALFactory/DbSessionFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CC.Yi.IDAL; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace CC.Yi.DALFactory -{ - public class DbSessionFactory - { - public static IDbSession GetCurrentDbSession() - { - IDbSession db = CallContext.GetData("DbSession") as IDbSession; - if (db == null) - { - db = new DbSession(); - CallContext.SetData("DbSession", db); - } - return db; - } - - private static class CallContext - { - static ConcurrentDictionary> state = new ConcurrentDictionary>(); - - public static void SetData(string name, object data) => - state.GetOrAdd(name, _ => new AsyncLocal()).Value = data; - - public static object GetData(string name) => - state.TryGetValue(name, out AsyncLocal data) ? data.Value : null; - } - } -} diff --git a/CC.Yi.Old/CC.Yi.DALFactory/StaticDalFactory.cs b/CC.Yi.Old/CC.Yi.DALFactory/StaticDalFactory.cs deleted file mode 100644 index a91adf99..00000000 --- a/CC.Yi.Old/CC.Yi.DALFactory/StaticDalFactory.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CC.Yi.DAL; -using CC.Yi.IDAL; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Text; -using System.Threading; - -namespace CC.Yi.DALFactory -{ - public partial class StaticDalFactory - { - private static class CallContext - { - static ConcurrentDictionary> state = new ConcurrentDictionary>(); - - public static void SetData(string name, object data) => - state.GetOrAdd(name, _ => new AsyncLocal()).Value = data; - - public static object GetData(string name) => - state.TryGetValue(name, out AsyncLocal data) ? data.Value : null; - } - } -} diff --git a/CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.cs b/CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.cs deleted file mode 100644 index 6a94b709..00000000 --- a/CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.cs +++ /dev/null @@ -1,18 +0,0 @@ -using CC.Yi.DAL; -using CC.Yi.IDAL; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.DALFactory -{ - public partial class DbSession : IDbSession - { - public IstudentDal studentDal - { - get { return StaticDalFactory.GetstudentDal(); } - } - - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.tt b/CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.tt deleted file mode 100644 index 541800d5..00000000 --- a/CC.Yi.Old/CC.Yi.DALFactory/T4DbSession.tt +++ /dev/null @@ -1,36 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.DAL; -using CC.Yi.IDAL; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.DALFactory -{ - public partial class DbSession : IDbSession - { -<# foreach(string k in ModelData){ - #> - public I<#=k #>Dal <#=k #>Dal - { - get { return StaticDalFactory.Get<#=k #>Dal(); } - } - -<# } #> - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.cs b/CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.cs deleted file mode 100644 index 9b6f14b9..00000000 --- a/CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.cs +++ /dev/null @@ -1,25 +0,0 @@ -using CC.Yi.DAL; -using CC.Yi.IDAL; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Text; -using System.Threading; - -namespace CC.Yi.DALFactory -{ - public partial class StaticDalFactory - { - public static IstudentDal GetstudentDal() - { - IstudentDal Data = CallContext.GetData("studentDal") as IstudentDal; - if (Data == null) - { - Data = new studentDal(); - CallContext.SetData("studentDal", Data); - } - return Data; - } - - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.tt b/CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.tt deleted file mode 100644 index f6194b8f..00000000 --- a/CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.tt +++ /dev/null @@ -1,43 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.DAL; -using CC.Yi.IDAL; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Text; -using System.Threading; - -namespace CC.Yi.DALFactory -{ - public partial class StaticDalFactory - { -<# foreach(string k in ModelData){ - #> - public static I<#=k #>Dal Get<#=k #>Dal() - { - I<#=k #>Dal Data = CallContext.GetData("<#=k #>Dal") as I<#=k #>Dal; - if (Data == null) - { - Data = new <#=k #>Dal(); - CallContext.SetData("<#=k #>Dal", Data); - } - return Data; - } - -<# } #> - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.IBLL/CC.Yi.IBLL.csproj b/CC.Yi.Old/CC.Yi.IBLL/CC.Yi.IBLL.csproj deleted file mode 100644 index 778e1962..00000000 --- a/CC.Yi.Old/CC.Yi.IBLL/CC.Yi.IBLL.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - Library - netcoreapp3.1 - - - - - - - - - - TextTemplatingFileGenerator - T4IBLL.cs - - - - - - - - - - True - True - T4IBLL.tt - - - - diff --git a/CC.Yi.Old/CC.Yi.IBLL/IBaseBll.cs b/CC.Yi.Old/CC.Yi.IBLL/IBaseBll.cs deleted file mode 100644 index ff781ea7..00000000 --- a/CC.Yi.Old/CC.Yi.IBLL/IBaseBll.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Autofac.Extras.DynamicProxy; -using CC.Yi.Common.Castle; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; - -namespace CC.Yi.IBLL -{ - [Intercept(typeof(CustomAutofacAop))] - public interface IBaseBll where T : class, new() - { - #region - //得到全部实体 - #endregion - IQueryable GetAllEntities(); - - #region - //通过表达式得到实体 - #endregion - IQueryable GetEntities(Expression> whereLambda); - - #region - //通过表达式得到实体,分页版本 - #endregion - IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc); - - #region - //通过表达式统计数量 - #endregion - int GetCount(Expression> whereLambda); - - #region - //通过表达式分组 - #endregion - IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda); - - #region - //添加实体 - #endregion - T Add(T entity); - - #region - //添加多个实体 - #endregion - bool Add(IEnumerable entities); - - #region - //更新实体 - #endregion - bool Update(T entity); - - #region - //更新实体部分属性 - #endregion - bool Update(T entity, params string[] propertyNames); - - #region - //删除实体 - #endregion - bool Delete(T entity); - - #region - //通过id删除实体 - #endregion - bool Delete(int id); - - #region - //通过id列表删除多个实体 - #endregion - bool Delete(IEnumerable ids); - - #region - //通过表达式删除实体 - #endregion - bool Delete(Expression> where); - } -} diff --git a/CC.Yi.Old/CC.Yi.IBLL/T4IBLL.cs b/CC.Yi.Old/CC.Yi.IBLL/T4IBLL.cs deleted file mode 100644 index cee3a3ad..00000000 --- a/CC.Yi.Old/CC.Yi.IBLL/T4IBLL.cs +++ /dev/null @@ -1,11 +0,0 @@ -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.IBLL -{ - public partial interface IstudentBll : IBaseBll - { - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.IBLL/T4IBLL.tt b/CC.Yi.Old/CC.Yi.IBLL/T4IBLL.tt deleted file mode 100644 index 9aff10f0..00000000 --- a/CC.Yi.Old/CC.Yi.IBLL/T4IBLL.tt +++ /dev/null @@ -1,29 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.IBLL -{ -<# foreach(string k in ModelData){ - #> - public partial interface I<#=k #>Bll : IBaseBll<<#=k #>> - { - } -<# } #> -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.IDAL/CC.Yi.IDAL.csproj b/CC.Yi.Old/CC.Yi.IDAL/CC.Yi.IDAL.csproj deleted file mode 100644 index 91214ffd..00000000 --- a/CC.Yi.Old/CC.Yi.IDAL/CC.Yi.IDAL.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - - Library - netcoreapp3.1 - - - - - - - - - TextTemplatingFileGenerator - T4IDAL.cs - - - TextTemplatingFileGenerator - T4IDbSession.cs - - - - - - - - - - True - True - T4IDAL.tt - - - True - True - T4IDbSession.tt - - - - diff --git a/CC.Yi.Old/CC.Yi.IDAL/IBaseDal.cs b/CC.Yi.Old/CC.Yi.IDAL/IBaseDal.cs deleted file mode 100644 index f4daf158..00000000 --- a/CC.Yi.Old/CC.Yi.IDAL/IBaseDal.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; - -namespace CC.Yi.IDAL -{ - public interface IBaseDal where T : class, new() - { - #region - //得到全部实体 - #endregion - IQueryable GetAllEntities(); - - #region - //通过表达式得到实体 - #endregion - IQueryable GetEntities(Expression> whereLambda); - - #region - //通过表达式得到实体,分页版本 - #endregion - IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc); - - #region - //通过表达式统计数量 - #endregion - int GetCount(Expression> whereLambda); - - #region - //通过表达式分组 - #endregion - IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda); - - #region - //添加单个实体 - #endregion - T Add(T entity); - - #region - //添加多个实体 - #endregion - bool AddRange(IEnumerable entities); - #region - //更新单个实体 - #endregion - bool Update(T entity); - - #region - //更新单个实体部分属性 - #endregion - bool Update(T entity, params string[] propertyNames); - - #region - //删除单个实体 - #endregion - bool Delete(T entity); - - #region - //通过id删除实体 - #endregion - bool Detete(int id); - - #region - //删除多个实体 - #endregion - bool DeteteRange(IEnumerable entity); - } -} diff --git a/CC.Yi.Old/CC.Yi.IDAL/IDbSession.cs b/CC.Yi.Old/CC.Yi.IDAL/IDbSession.cs deleted file mode 100644 index 633da7f1..00000000 --- a/CC.Yi.Old/CC.Yi.IDAL/IDbSession.cs +++ /dev/null @@ -1,18 +0,0 @@ -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.IDAL -{ - public partial interface IDbSession - { - DataContext GetDbContent(); - int SaveChanges(); - } - - - -} diff --git a/CC.Yi.Old/CC.Yi.IDAL/T4IDAL.cs b/CC.Yi.Old/CC.Yi.IDAL/T4IDAL.cs deleted file mode 100644 index 8b900b8c..00000000 --- a/CC.Yi.Old/CC.Yi.IDAL/T4IDAL.cs +++ /dev/null @@ -1,11 +0,0 @@ -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.IDAL -{ - public partial interface IstudentDal:IBaseDal - { - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.IDAL/T4IDAL.tt b/CC.Yi.Old/CC.Yi.IDAL/T4IDAL.tt deleted file mode 100644 index 7faf648f..00000000 --- a/CC.Yi.Old/CC.Yi.IDAL/T4IDAL.tt +++ /dev/null @@ -1,29 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.IDAL -{ -<# foreach(string k in ModelData){ - #> - public partial interface I<#=k #>Dal:IBaseDal<<#=k #>> - { - } -<# } #> -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.cs b/CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.cs deleted file mode 100644 index aab497df..00000000 --- a/CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.cs +++ /dev/null @@ -1,15 +0,0 @@ -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.IDAL -{ - public partial interface IDbSession - { - IstudentDal studentDal{get;} - - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.tt b/CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.tt deleted file mode 100644 index b0d2226a..00000000 --- a/CC.Yi.Old/CC.Yi.IDAL/T4IDbSession.tt +++ /dev/null @@ -1,33 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.IDAL -{ - public partial interface IDbSession - { -<# foreach(string k in ModelData){ - #> - I<#=k #>Dal <#=k #>Dal{get;} - -<# } #> - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.Model/CC.Yi.Model.csproj b/CC.Yi.Old/CC.Yi.Model/CC.Yi.Model.csproj deleted file mode 100644 index f620b157..00000000 --- a/CC.Yi.Old/CC.Yi.Model/CC.Yi.Model.csproj +++ /dev/null @@ -1,43 +0,0 @@ - - - - netcoreapp3.1 - - - - - True - True - T4DataContext.tt - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - TextTemplatingFileGenerator - T4DataContext.cs - - - - - - - - - - True - True - T4DataContext.tt - - - - diff --git a/CC.Yi.Old/CC.Yi.Model/DataContext.cs b/CC.Yi.Old/CC.Yi.Model/DataContext.cs deleted file mode 100644 index 98a047bd..00000000 --- a/CC.Yi.Old/CC.Yi.Model/DataContext.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; - -namespace CC.Yi.Model -{ - public partial class DataContext : DbContext - { - public DataContext(DbContextOptions options) : base(options) - { - - } - //public DbSet result_user { get; set; } - } -} diff --git a/CC.Yi.Old/CC.Yi.Model/T4DataContext.cs b/CC.Yi.Old/CC.Yi.Model/T4DataContext.cs deleted file mode 100644 index 584f6d63..00000000 --- a/CC.Yi.Old/CC.Yi.Model/T4DataContext.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Text; -namespace CC.Yi.Model -{ - public partial class DataContext :DbContext - { - public DbSet student { get; set; } - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.Model/T4DataContext.tt b/CC.Yi.Old/CC.Yi.Model/T4DataContext.tt deleted file mode 100644 index 2fa74f5b..00000000 --- a/CC.Yi.Old/CC.Yi.Model/T4DataContext.tt +++ /dev/null @@ -1,29 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Text; -namespace CC.Yi.Model -{ - public partial class DataContext :DbContext - { -<# foreach(string k in ModelData){ - #> - public DbSet<<#=k #>> <#=k #> { get; set; } -<# } #> - } -} \ No newline at end of file diff --git a/CC.Yi.Old/CC.Yi.Model/result_user.cs b/CC.Yi.Old/CC.Yi.Model/result_user.cs deleted file mode 100644 index 9c60b1a8..00000000 --- a/CC.Yi.Old/CC.Yi.Model/result_user.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Model -{ - public class result_user : IdentityUser - { - //你可以在这里添加你额外需要的字段例如 - //public int level { get; set; } - } -} diff --git a/CC.Yi.Old/CC.Yi.Model/student.cs b/CC.Yi.Old/CC.Yi.Model/student.cs deleted file mode 100644 index 90ee09b7..00000000 --- a/CC.Yi.Old/CC.Yi.Model/student.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text; - -namespace CC.Yi.Model -{ - public class student - { - [Key] - [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] - public int id { get; set; } - public string name { get; set; } - } -} diff --git a/CC.Yi.Old/CC.Yi.ViewModel/CC.Yi.ViewModel.csproj b/CC.Yi.Old/CC.Yi.ViewModel/CC.Yi.ViewModel.csproj deleted file mode 100644 index cefa80a0..00000000 --- a/CC.Yi.Old/CC.Yi.ViewModel/CC.Yi.ViewModel.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Library - netcoreapp3.1 - - - diff --git a/CC.Yi.Old/CC.Yi.sln b/CC.Yi.Old/CC.Yi.sln deleted file mode 100644 index 6e606c50..00000000 --- a/CC.Yi.Old/CC.Yi.sln +++ /dev/null @@ -1,94 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30907.101 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DAL", "DAL", "{9D0D4A54-057E-46C3-BBFE-CA01F7ECEDAE}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BLL", "BLL", "{CC5F4204-DFB6-4BB5-9E49-BED084063ED8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "API", "API", "{1A509C83-F994-4422-A74F-8FFA4805D849}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.API", "CC.Yi.API\CC.Yi.API.csproj", "{CDB5556F-43FF-44F6-B33D-AC642E5CD30C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.BLL", "CC.Yi.BLL\CC.Yi.BLL.csproj", "{AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.IBLL", "CC.Yi.IBLL\CC.Yi.IBLL.csproj", "{74177F89-72D5-45FE-8A4F-91FAD9E03D36}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.DAL", "CC.Yi.DAL\CC.Yi.DAL.csproj", "{72FD0850-15FA-4A6F-B865-E1B38603307D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.IDAL", "CC.Yi.IDAL\CC.Yi.IDAL.csproj", "{BD77D98A-9F28-4C2D-A260-C3BB919B58E7}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{123D1D39-849C-4220-A973-EB9760421CB3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Model", "Model", "{38B8D898-4BBF-4DDB-8E29-6D6CEB7808C9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.Model", "CC.Yi.Model\CC.Yi.Model.csproj", "{8827547B-E04B-4430-A0DF-E87FCA40E3AB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.ViewModel", "CC.Yi.ViewModel\CC.Yi.ViewModel.csproj", "{32F323F1-E2FA-4186-AC33-263465012D15}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.Common", "CC.Yi.Common\CC.Yi.Common.csproj", "{9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.DALFactory", "CC.Yi.DALFactory\CC.Yi.DALFactory.csproj", "{ACB6D3EE-FADE-4F07-9D12-C9E3A5F72335}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C}.Release|Any CPU.Build.0 = Release|Any CPU - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}.Release|Any CPU.Build.0 = Release|Any CPU - {74177F89-72D5-45FE-8A4F-91FAD9E03D36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {74177F89-72D5-45FE-8A4F-91FAD9E03D36}.Debug|Any CPU.Build.0 = Debug|Any CPU - {74177F89-72D5-45FE-8A4F-91FAD9E03D36}.Release|Any CPU.ActiveCfg = Release|Any CPU - {74177F89-72D5-45FE-8A4F-91FAD9E03D36}.Release|Any CPU.Build.0 = Release|Any CPU - {72FD0850-15FA-4A6F-B865-E1B38603307D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {72FD0850-15FA-4A6F-B865-E1B38603307D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {72FD0850-15FA-4A6F-B865-E1B38603307D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {72FD0850-15FA-4A6F-B865-E1B38603307D}.Release|Any CPU.Build.0 = Release|Any CPU - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7}.Release|Any CPU.Build.0 = Release|Any CPU - {8827547B-E04B-4430-A0DF-E87FCA40E3AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8827547B-E04B-4430-A0DF-E87FCA40E3AB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8827547B-E04B-4430-A0DF-E87FCA40E3AB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8827547B-E04B-4430-A0DF-E87FCA40E3AB}.Release|Any CPU.Build.0 = Release|Any CPU - {32F323F1-E2FA-4186-AC33-263465012D15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32F323F1-E2FA-4186-AC33-263465012D15}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32F323F1-E2FA-4186-AC33-263465012D15}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32F323F1-E2FA-4186-AC33-263465012D15}.Release|Any CPU.Build.0 = Release|Any CPU - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}.Release|Any CPU.Build.0 = Release|Any CPU - {ACB6D3EE-FADE-4F07-9D12-C9E3A5F72335}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ACB6D3EE-FADE-4F07-9D12-C9E3A5F72335}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ACB6D3EE-FADE-4F07-9D12-C9E3A5F72335}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ACB6D3EE-FADE-4F07-9D12-C9E3A5F72335}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C} = {1A509C83-F994-4422-A74F-8FFA4805D849} - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6} = {CC5F4204-DFB6-4BB5-9E49-BED084063ED8} - {74177F89-72D5-45FE-8A4F-91FAD9E03D36} = {CC5F4204-DFB6-4BB5-9E49-BED084063ED8} - {72FD0850-15FA-4A6F-B865-E1B38603307D} = {9D0D4A54-057E-46C3-BBFE-CA01F7ECEDAE} - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7} = {9D0D4A54-057E-46C3-BBFE-CA01F7ECEDAE} - {8827547B-E04B-4430-A0DF-E87FCA40E3AB} = {38B8D898-4BBF-4DDB-8E29-6D6CEB7808C9} - {32F323F1-E2FA-4186-AC33-263465012D15} = {38B8D898-4BBF-4DDB-8E29-6D6CEB7808C9} - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC} = {123D1D39-849C-4220-A973-EB9760421CB3} - {ACB6D3EE-FADE-4F07-9D12-C9E3A5F72335} = {9D0D4A54-057E-46C3-BBFE-CA01F7ECEDAE} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {22DD3529-6AD4-413A-B7B3-D8335E6F47C9} - EndGlobalSection -EndGlobal diff --git a/CC.Yi.Old/T4Model/T4Model.txt b/CC.Yi.Old/T4Model/T4Model.txt deleted file mode 100644 index 36227abb..00000000 --- a/CC.Yi.Old/T4Model/T4Model.txt +++ /dev/null @@ -1 +0,0 @@ -student \ No newline at end of file diff --git a/CC.Yi.Old/T4Model/说明.txt b/CC.Yi.Old/T4Model/说明.txt deleted file mode 100644 index 7abbdd18..00000000 --- a/CC.Yi.Old/T4Model/说明.txt +++ /dev/null @@ -1,5 +0,0 @@ -这里存放T4要生成的模型 -使用英文的 , 分隔 -例如: -student,teacher -点击 生成->转换所有t4模板 即可完成生成 \ No newline at end of file diff --git a/CC.Yi/CC.Yi.API/CC.Yi.API.csproj b/CC.Yi/CC.Yi.API/CC.Yi.API.csproj deleted file mode 100644 index 52797948..00000000 --- a/CC.Yi/CC.Yi.API/CC.Yi.API.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - net5.0 - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - Always - - - - - - - - - - True - True - T4Startup.tt - - - - - - TextTemplatingFileGenerator - T4Startup.cs - - - - diff --git a/CC.Yi/CC.Yi.API/Controllers/StudentController.cs b/CC.Yi/CC.Yi.API/Controllers/StudentController.cs deleted file mode 100644 index 576f6ccc..00000000 --- a/CC.Yi/CC.Yi.API/Controllers/StudentController.cs +++ /dev/null @@ -1,147 +0,0 @@ -using CC.Yi.Common; -using CC.Yi.Common.Cache; -using CC.Yi.Common.Jwt; -using CC.Yi.IBLL; -using CC.Yi.Model; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Logging; -using Microsoft.IdentityModel.Tokens; -using ServiceStack.Redis; -using System; -using System.Collections.Generic; -using System.IdentityModel.Tokens.Jwt; -using System.Linq; -using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; - -namespace CC.Yi.API.Controllers -{ - [ApiController] - [Route("[controller]/[action]")] - public class StudentController : ControllerBase - { - private readonly ILogger _logger;//处理日志相关文件 - - //private UserManager _userManager;//处理用户相关逻辑:添加密码,修改密码,添加删除角色等等 - //private SignInManager _signInManager;//处理注册登录的相关逻辑 - private IstudentBll _studentBll; - public StudentController(ILogger logger, IstudentBll studentBll) - { - _logger = logger; - _logger.LogInformation("现在你进入了StudentController控制器");//nlog日志模块 - _studentBll = studentBll; - } - #region - //关于身份认证配置使用: - //在需要身份认证的控制器上打上 [Authorize] 特性标签 - #endregion - //[HttpGet] - //public async Task IdentityTest() - //{ - // //用户登入 - // var data = await _signInManager.PasswordSignInAsync("账号", "密码", false, false); //"是否记住密码","是否登入失败锁定用户" - // //用户登出 - // await _signInManager.SignOutAsync(); - // //创建用户 - // var data2 = await _userManager.CreateAsync(new result_user { UserName="账户",Email="邮箱"},"密码"); - // //获取用户 - // var data3 = _userManager.Users;//这里可以使用Linq表达式Select - // return Ok(); - //} - - #region - //redis操作 - #endregion - [HttpGet] - public Result GetReids() - { - var data = CacheHelper.CacheWriter.GetCache("key01"); - return Result.Success(data); - } - - - #region - //下面,权限验证 - #endregion - [HttpGet] - public Result Login(string role) - { - string userName = "admin"; - var claims = new[] - { - new Claim(JwtRegisteredClaimNames.Nbf,$"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}") , - new Claim (JwtRegisteredClaimNames.Exp,$"{new DateTimeOffset(DateTime.Now.AddMinutes(30)).ToUnixTimeSeconds()}"), - new Claim(ClaimTypes.Name, userName), - new Claim(ClaimTypes.Role,role) - - }; - var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConst.SecurityKey)); - var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - - var token = new JwtSecurityToken( - issuer: JwtConst.Domain, - audience: JwtConst.Domain, - claims: claims, - expires: DateTime.Now.AddMinutes(30), - signingCredentials: creds); - - var tokenData = new JwtSecurityTokenHandler().WriteToken(token); - return Result.Success("欢迎你!管理员!").SetData(new { token = tokenData }); - }//发送令牌 - - [HttpGet] - [Authorize(Policy = "myadmin")]//基于策略的验证 - public Result MyAdmin() - { - return Result.Success("欢迎你!管理员!"); - } - - [HttpGet] - [Authorize(Roles = "user")]//基于角色的验证 - public Result MyUser() - { - return Result.Success("欢迎你!游客!"); - } - - #region - //下面,经典的 增删改查 即为简易--Yi意框架 - //注意:请确保你的数据库中存在合理的数据 - #endregion - [HttpGet] - public async Task GetTest()//查 - { - _logger.LogInformation("调用查方法"); - var data = await _studentBll.GetAllEntities().ToListAsync(); - return Result.Success().SetData(data); - } - [HttpGet] - public Result AddTest()//增 - { - _logger.LogInformation("调用增方法"); - List students = new List() { new student { name = "学生a" } }; - _studentBll.Add(students); - return Result.Success(); - - } - [HttpGet] - public Result RemoveTest()//删 - { - _logger.LogInformation("调用删方法"); - _studentBll.Delete(u => u.id==1); - return Result.Success(); - - } - [HttpGet] - public Result UpdateTest()//改 - { - _logger.LogInformation("调用改方法"); - _studentBll.Update(new student { id = 1, name = "学生b" }, "name"); - return Result.Success(); - } - } -} diff --git a/CC.Yi/CC.Yi.API/Extension/ErrorHandExtension.cs b/CC.Yi/CC.Yi.API/Extension/ErrorHandExtension.cs deleted file mode 100644 index 41c15943..00000000 --- a/CC.Yi/CC.Yi.API/Extension/ErrorHandExtension.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CC.Yi.Common; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.API.Extension -{ - public class ErrorHandExtension - { - private readonly RequestDelegate next; - - public ErrorHandExtension(RequestDelegate next) - { - this.next = next; - } - - public async Task Invoke(HttpContext context) - { - try - { - await next(context); - } - catch (Exception ex) - { - var statusCode = context.Response.StatusCode; - if (ex is ArgumentException) - { - statusCode = 200; - } - await HandleExceptionAsync(context, statusCode, ex.Message); - } - finally - { - var statusCode = context.Response.StatusCode; - var msg = ""; - - switch (statusCode) - { - - case 401: msg = "未授权";break; - case 403: msg = "未授权"; break; - case 404: msg = "未找到服务"; break; - case 502: msg = "请求错误"; break; - - } - if (!string.IsNullOrWhiteSpace(msg)) - { - await HandleExceptionAsync(context, statusCode, msg); - } - } - } - //异常错误信息捕获,将错误信息用Json方式返回 - private static Task HandleExceptionAsync(HttpContext context, int statusCode, string msg) - { - var result = JsonConvert.SerializeObject( Result.Error(msg).SetCode(statusCode)); - context.Response.ContentType = "application/json;charset=utf-8"; - return context.Response.WriteAsync(result); - } - } - //扩展方法 - public static class ErrorHandlingExtensions - { - public static IApplicationBuilder UseErrorHandling(this IApplicationBuilder builder) - { - return builder.UseMiddleware(); - } - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.API/Extension/SwaggerExtension.cs b/CC.Yi/CC.Yi.API/Extension/SwaggerExtension.cs deleted file mode 100644 index f9a46ab2..00000000 --- a/CC.Yi/CC.Yi.API/Extension/SwaggerExtension.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; -using System; -using System.IO; - -namespace CC.Yi.API.Extension -{ - /// - /// Swagger文档扩展方法 - /// - public static class SwaggerExtension - { - public static IServiceCollection AddSwaggerService(this IServiceCollection services) - { - var apiInfo = new OpenApiInfo - { - Title = "Yi意框架-API接口", - Version = "v1", - Contact = new OpenApiContact { Name = "橙子", Email = "454313500@qq.com", Url = new System.Uri("https://jiftcc.com") } - }; - #region 注册Swagger服务 - services.AddSwaggerGen(c => - { - c.SwaggerDoc("v1", apiInfo); - - //添加注释服务 - //为 Swagger JSON and UI设置xml文档注释路径 - //获取应用程序所在目录(绝对路径,不受工作目录影响,建议采用此方法获取路径使用windwos&Linux) - var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location); - var apiXmlPath = Path.Combine(basePath, @"ApiDoc.xml");//控制器层注释 - var entityXmlPath = Path.Combine(basePath, @"Model\ModelDoc.xml");//实体注释 - //c.IncludeXmlComments(apiXmlPath, true);//true表示显示控制器注释 - //c.IncludeXmlComments(entityXmlPath); - - //添加控制器注释 - //c.DocumentFilter(); - - //添加header验证信息 - //c.OperationFilter(); - //var security = new Dictionary> { { "Bearer", new string[] { } }, }; - - c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme() - { - Description = "文本框里输入从服务器获取的Token。格式为:Bearer + 空格+token",//JWT授权(数据将在请求头中进行传输) 参数结构: \"Authorization: Bearer {token}\" - Name = "Authorization",////jwt默认的参数名称 - In = ParameterLocation.Header,////jwt默认存放Authorization信息的位置(请求头中) - Type = SecuritySchemeType.ApiKey, - }); - c.AddSecurityRequirement(new OpenApiSecurityRequirement - { - { new OpenApiSecurityScheme - { - Reference = new OpenApiReference() - { - Id = "Bearer", - Type = ReferenceType.SecurityScheme - } - }, Array.Empty() } - }); - }); - #endregion - - return services; - } - - public static void UseSwaggerService(this IApplicationBuilder app) - { - //在 Startup.Configure 方法中,启用中间件为生成的 JSON 文档和 Swagger UI 提供服务: - // Enable middleware to serve generated Swagger as a JSON endpoint. - app.UseSwagger(); - app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi")); - } - - } -} diff --git a/CC.Yi/CC.Yi.API/Filter/DbContextFilter.cs b/CC.Yi/CC.Yi.API/Filter/DbContextFilter.cs deleted file mode 100644 index fc1bc2d1..00000000 --- a/CC.Yi/CC.Yi.API/Filter/DbContextFilter.cs +++ /dev/null @@ -1,21 +0,0 @@ -using CC.Yi.DAL; -using CC.Yi.Model; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.API.Filter -{ - public class DbContextFilter : ActionFilterAttribute - { - public override void OnActionExecuting(ActionExecutingContext filterContext) - { - - base.OnActionExecuting(filterContext); - - } - } -} diff --git a/CC.Yi/CC.Yi.API/Init/InitDb.cs b/CC.Yi/CC.Yi.API/Init/InitDb.cs deleted file mode 100644 index 0064690e..00000000 --- a/CC.Yi/CC.Yi.API/Init/InitDb.cs +++ /dev/null @@ -1,71 +0,0 @@ -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.API.Init -{ - public static class InitDb - { - public static bool Init(DataContext Db) - { - //if (!Db.Set().Any()) - //{ - // user initUser = new user - // { - // username = "cc", - // password = "123", - // user_extra = new user_extra(), - // time = DateTime.Now, - // roles = new List{ - // new role{ - // role_name="管理员", - // actions=new List{ - // new action{ action_name="首页",router="/index",icon="mdi-view-dashboard"}, - // new action{action_name="用户管理",router="/user",icon="mdi-account-box"}, - // new action{ action_name="角色管理",router="/role",icon="mdi-gavel"}, - // new action{ action_name="权限管理",router="/action",icon="mdi-lock"} - // } - // }, - // new role{ role_name="l-1"}, - // new role{ role_name="l-2"}, - // new role{ role_name="l-3"}, - // new role{ role_name="l-4"}, - // new role{ role_name="l-5"}, - // new role{ role_name="l-6"}, - // new role{ role_name="l-7"}, - // new role{ role_name="l-8"}, - // new role{ role_name="l-9"}, - // new role{ role_name="l-10"}, - // new role{ role_name="l-11"}, - // new role{ role_name="l-12"}, - // new role{ role_name="普通用户"} - // } - // }; - // Db.Set().Update(initUser); - // //-------------------------------------------------------------------------------------添加管理员账户 - // List levels = new List - // { - // new level{num=0, name="小白0",max_char=50,experience=0}, - // new level{num=1, name="小白1",max_char=100,experience=5}, - // new level{num=2, name="小白2",max_char=200,experience=10}, - // new level{num=3, name="小白3",max_char=300,experience=15}, - // new level{num=4, name="小白4",max_char=400,experience=20}, - // new level{num=5, name="小白5",max_char=500,experience=25}, - // new level{num=6, name="小白6",max_char=600,experience=30}, - // new level{num=7, name="小白7",max_char=700,experience=35}, - // new level{num=8, name="小白8",max_char=800,experience=40}, - // new level{num=9, name="小白9",max_char=900,experience=45}, - // new level{num=10, name="小白10",max_char=1000,experience=50}, - // new level{num=11, name="小白11",max_char=1100,experience=55} - // }; - // Db.Set().AddRange(levels); - // //---------------------------------------------------------------------------------------添加等级表 - - // return Db.SaveChanges()>0; - //} - return false; - } - } -} diff --git a/CC.Yi/CC.Yi.API/Program.cs b/CC.Yi/CC.Yi.API/Program.cs deleted file mode 100644 index b2ac3042..00000000 --- a/CC.Yi/CC.Yi.API/Program.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Autofac.Extensions.DependencyInjection; -using CC.Yi.DAL; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using NLog.Web; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC.Yi.API -{ - public class Program - { - public static void Main(string[] args) - { - //һݿ⣬޸ݿļ - //ģ࣬ģͲУʹAdd-Migration xxxǨƣʹUpdate-Databaseݿ - //T4ModelģһתT4 - //캯עֱʹ - - var logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); - try - { - logger.Debug("Yiܡ"); - var host = CreateHostBuilder(args).Build(); - host.Run(); - logger.Info("Yiɹ"); - } - catch (Exception exception) - { - //NLog: catch setup errors - logger.Error(exception, "Stopped program because of exception"); - throw; - } - finally - { - // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) - NLog.LogManager.Shutdown(); - } - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - - webBuilder.UseUrls("http://*:19000").UseStartup(); - }).UseServiceProviderFactory(new AutofacServiceProviderFactory()) - .ConfigureLogging(logging => - { - // logging.ClearProviders(); // п̨ - logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); - }).UseNLog();//nlog־ - - } -} diff --git a/CC.Yi/CC.Yi.API/Properties/launchSettings.json b/CC.Yi/CC.Yi.API/Properties/launchSettings.json deleted file mode 100644 index 9942be97..00000000 --- a/CC.Yi/CC.Yi.API/Properties/launchSettings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:55197", - "sslPort": 44334 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "CC.Yi.API": { - "commandName": "Project", - "dotnetRunMessages": "true", - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:5001;http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/CC.Yi/CC.Yi.API/Startup.cs b/CC.Yi/CC.Yi.API/Startup.cs deleted file mode 100644 index f4b14aad..00000000 --- a/CC.Yi/CC.Yi.API/Startup.cs +++ /dev/null @@ -1,167 +0,0 @@ -using Autofac; -using Autofac.Extras.DynamicProxy; -using CC.Yi.API.Extension; -using CC.Yi.BLL; -using CC.Yi.Common.Castle; -using CC.Yi.Common.Json; -using CC.Yi.Common.Jwt; -using CC.Yi.DAL; -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using CC.Yi.Model; -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Microsoft.IdentityModel.Tokens; -using Microsoft.OpenApi.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CC.Yi.API -{ - public partial class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddAuthorization(options => - { - //ûڲԵ֤ - options.AddPolicy("myadmin", policy =>policy.RequireRole("admin")); - - }); - - - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.TokenValidationParameters = new TokenValidationParameters - { - ValidateIssuer = true,//Ƿ֤Issuer - ValidateAudience = true,//Ƿ֤Audience - ValidateLifetime = true,//Ƿ֤ʧЧʱ - ClockSkew = TimeSpan.FromDays(1), - - - ValidateIssuerSigningKey = true,//Ƿ֤SecurityKey - ValidAudience = JwtConst.Domain,//Audience - ValidIssuer = JwtConst.Domain,//Issuerǰǩjwtһ - IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConst.SecurityKey))//õSecurityKey - }; - }); - - //עĶ - services.AddSingleton(); - - //ù - Action filters = new Action(r => - { - //r.Filters.Add(typeof(DbContextFilter)); - }); - - services.AddControllers(filters).AddJsonOptions(options => { - - options.JsonSerializerOptions.Converters.Add(new DatetimeJsonConverter()); - options.JsonSerializerOptions.Converters.Add(new TimeSpanJsonConverter()); - - }); - services.AddSwaggerService(); - - - //ݿ - string connection1 = Configuration["ConnectionStringBySQL"]; - string connection2 = Configuration["ConnectionStringByMySQL"]; - string connection3 = Configuration["ConnectionStringBySQLite"]; - string connection4 = Configuration["ConnectionStringByOracle"]; - - //var serverVersion = new MySqlServerVersion(new Version(8, 0, 21));//mysql汾 - - services.AddDbContext(options => - { - //options.UseSqlServer(connection1);//sqlserver - //options.UseMySql(connection2, serverVersion);//mysql - options.UseSqlite(connection3);//sqlite - //options.UseOracle(connection4);//oracle - }); - - - - services.AddCors(options => options.AddPolicy("CorsPolicy",// - builder => - { - builder.AllowAnyMethod() - .SetIsOriginAllowed(_ => true) - .AllowAnyHeader() - .AllowCredentials(); - })); - } - - //ʼʹú - private void InitData(IServiceProvider serviceProvider) - { - using (var serviceScope = serviceProvider.GetRequiredService().CreateScope()) - { - var Db = serviceScope.ServiceProvider.GetService(); - var log = serviceScope.ServiceProvider.GetService>(); - if (Init.InitDb.Init(Db)) - { - log.LogInformation("ݿʼɹ"); - } - } - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - - //ÿӻӿ - app.UseSwaggerService(); - } - //þ̬ļ - app.UseStaticFiles(); - - //쳣׽ - app.UseErrorHandling(); - - //ÿ - app.UseCors("CorsPolicy"); - app.UseHttpsRedirection(); - - app.UseRouting(); - - //֤ - app.UseAuthentication(); - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - - //ʼ - InitData(app.ApplicationServices); - } - } -} diff --git a/CC.Yi/CC.Yi.API/T4Startup.cs b/CC.Yi/CC.Yi.API/T4Startup.cs deleted file mode 100644 index 75e8a6fd..00000000 --- a/CC.Yi/CC.Yi.API/T4Startup.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Autofac; -using Autofac.Extras.DynamicProxy; -using CC.Yi.BLL; -using CC.Yi.Common.Castle; -using CC.Yi.DAL; -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using System; - - -namespace CC.Yi.API -{ - public partial class Startup - { - //动态 面向AOP思想的依赖注入 Autofac - public void ConfigureContainer(ContainerBuilder builder) - { - builder.RegisterType(typeof(CustomAutofacAop)); - builder.RegisterGeneric(typeof(BaseDal<>)).As(typeof(IBaseDal<>)); - builder.RegisterType().As().EnableInterfaceInterceptors();//表示注入前后要执行Castle,AOP - } - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.API/T4Startup.tt b/CC.Yi/CC.Yi.API/T4Startup.tt deleted file mode 100644 index 166ebfc5..00000000 --- a/CC.Yi/CC.Yi.API/T4Startup.tt +++ /dev/null @@ -1,40 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using Autofac; -using Autofac.Extras.DynamicProxy; -using CC.Yi.BLL; -using CC.Yi.Common.Castle; -using CC.Yi.DAL; -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using System; - - -namespace CC.Yi.API -{ - public partial class Startup - { - //动态 面向AOP思想的依赖注入 Autofac - public void ConfigureContainer(ContainerBuilder builder) - { - builder.RegisterType(typeof(CustomAutofacAop)); - builder.RegisterGeneric(typeof(BaseDal<>)).As(typeof(IBaseDal<>)); -<# foreach(string k in ModelData){#> - builder.RegisterType<<#=k #>Bll>().AsBll>().EnableInterfaceInterceptors();//表示注入前后要执行Castle,AOP -<# } #> - } - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.API/YIDB.db b/CC.Yi/CC.Yi.API/YIDB.db deleted file mode 100644 index 2916a446..00000000 Binary files a/CC.Yi/CC.Yi.API/YIDB.db and /dev/null differ diff --git a/CC.Yi/CC.Yi.API/appsettings.Development.json b/CC.Yi/CC.Yi.API/appsettings.Development.json deleted file mode 100644 index 8983e0fc..00000000 --- a/CC.Yi/CC.Yi.API/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/CC.Yi/CC.Yi.API/appsettings.json b/CC.Yi/CC.Yi.API/appsettings.json deleted file mode 100644 index 80690c97..00000000 --- a/CC.Yi/CC.Yi.API/appsettings.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*", - "ConnectionStringBySQL": "server=.;Database=YIDB;UId=sa;PWD=Qz52013142020.", - "ConnectionStringByMySQL": "Data Source=49.235.212.122;Database=YIDB;User ID=root;Password=Qz52013142020.;pooling=true;port=3306;sslmode=none;CharSet=utf8;", - "ConnectionStringBySQLite": "Filename=YIDB.db", - "ConnectionStringByOracle": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=IPַ)(PORT=˿ں))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=)));User Id=¼˺;Password=;" -} diff --git a/CC.Yi/CC.Yi.API/nlog.config b/CC.Yi/CC.Yi.API/nlog.config deleted file mode 100644 index 43da2d66..00000000 --- a/CC.Yi/CC.Yi.API/nlog.config +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CC.Yi/CC.Yi.BLL/BaseBll.cs b/CC.Yi/CC.Yi.BLL/BaseBll.cs deleted file mode 100644 index 10918f6b..00000000 --- a/CC.Yi/CC.Yi.BLL/BaseBll.cs +++ /dev/null @@ -1,112 +0,0 @@ -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Threading.Tasks; - -namespace CC.Yi.BLL -{ - public class BaseBll : IBaseBll where T : class, new() - { - public IBaseDal CurrentDal; - public DbContext Db; - public BaseBll(IBaseDal cd, DataContext _Db) - { - CurrentDal = cd; - Db = _Db; - } - - public async Task GetEntityById(int id) - { - return await CurrentDal.GetEntityById(id); - } - - - public IQueryable GetAllEntities() - { - return CurrentDal.GetAllEntities(); - } - - public IQueryable GetEntities(Expression> whereLambda) - { - return CurrentDal.GetEntities(whereLambda); - } - - public int GetCount(Expression> whereLambda) //统计数量 - { - return CurrentDal.GetCount(whereLambda); - } - - public IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda) //分组 - { - return CurrentDal.GetGroup(whereLambda, groupByLambda); - - } - - public IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc) - { - return CurrentDal.GetPageEntities(pageSize, pageIndex, out total, whereLambda, orderByLambda, isAsc); - } - - public T Add(T entity) - { - T entityData= CurrentDal.Add(entity); - Db.SaveChanges(); - return entityData; - } - - public bool Add(IEnumerable entities) - { - CurrentDal.AddRange(entities); - return Db.SaveChanges() > 0; - } - - public bool Update(T entity) - { - CurrentDal.Update(entity); - return Db.SaveChanges() > 0; - } - - public bool Update(T entity, params string[] propertyNames) - { - CurrentDal.Update(entity,propertyNames); - return Db.SaveChanges() > 0; - } - - public bool Delete(T entity) - { - CurrentDal.Delete(entity); - return Db.SaveChanges() > 0; - } - public bool Delete(int id) - { - CurrentDal.Detete(id); - return Db.SaveChanges() > 0; - } - - public bool Delete(IEnumerable ids) - { - foreach (var id in ids) - { - CurrentDal.Detete(id); - } - return Db.SaveChanges()>0; - } - public bool Delete(Expression> where) - { - IQueryable entities = CurrentDal.GetEntities(where); - if (entities != null) - { - CurrentDal.DeteteRange(entities); - - return Db.SaveChanges()>0; - } - return false; - } - - } -} diff --git a/CC.Yi/CC.Yi.BLL/CC.Yi.BLL.csproj b/CC.Yi/CC.Yi.BLL/CC.Yi.BLL.csproj deleted file mode 100644 index cafa597d..00000000 --- a/CC.Yi/CC.Yi.BLL/CC.Yi.BLL.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - - TextTemplatingFileGenerator - T4BLL.cs - - - - - - - - - - True - True - T4BLL.tt - - - - diff --git a/CC.Yi/CC.Yi.BLL/T4BLL.cs b/CC.Yi/CC.Yi.BLL/T4BLL.cs deleted file mode 100644 index 65c25e89..00000000 --- a/CC.Yi/CC.Yi.BLL/T4BLL.cs +++ /dev/null @@ -1,32 +0,0 @@ - -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore; - -namespace CC.Yi.BLL -{ - public partial class studentBll : BaseBll, IstudentBll - { - public studentBll(IBaseDal cd,DataContext _Db):base(cd,_Db) - { - CurrentDal = cd; - Db = _Db; - } - - public async Task DelListByUpdateList(List Ids) - { - var entitys = await CurrentDal.GetEntities(u => Ids.Contains(u.id)).ToListAsync(); - foreach (var entity in entitys) - { - entity.is_delete = (short)ViewModel.Enum.DelFlagEnum.Deleted; - } - return Db.SaveChanges() > 0; - } - - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.BLL/T4BLL.tt b/CC.Yi/CC.Yi.BLL/T4BLL.tt deleted file mode 100644 index bd101937..00000000 --- a/CC.Yi/CC.Yi.BLL/T4BLL.tt +++ /dev/null @@ -1,50 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> - -using CC.Yi.IBLL; -using CC.Yi.IDAL; -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore; - -namespace CC.Yi.BLL -{ -<# foreach(string k in ModelData){ - #> - public partial class <#=k #>Bll : BaseBll<<#=k #>>, I<#=k #>Bll - { - public <#=k #>Bll(IBaseDal<<#=k #>> cd,DataContext _Db):base(cd,_Db) - { - CurrentDal = cd; - Db = _Db; - } - - public async Task DelListByUpdateList(List Ids) - { - var entitys = await CurrentDal.GetEntities(u => Ids.Contains(u.id)).ToListAsync(); - foreach (var entity in entitys) - { - entity.is_delete = (short)ViewModel.Enum.DelFlagEnum.Deleted; - } - return Db.SaveChanges() > 0; - } - - } -<# } #> -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Common/CC.Yi.Common.csproj b/CC.Yi/CC.Yi.Common/CC.Yi.Common.csproj deleted file mode 100644 index c811cfb7..00000000 --- a/CC.Yi/CC.Yi.Common/CC.Yi.Common.csproj +++ /dev/null @@ -1,42 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - - - - - - TextTemplatingFileGenerator - T4Api.vue - - - True - True - T4Api.tt - - - TextTemplatingFileGenerator - T4Component.vue - - - True - True - T4Component.tt - - - - - - - - diff --git a/CC.Yi/CC.Yi.Common/Cache/CacheHelper.cs b/CC.Yi/CC.Yi.Common/Cache/CacheHelper.cs deleted file mode 100644 index 4a5efec9..00000000 --- a/CC.Yi/CC.Yi.Common/Cache/CacheHelper.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Autofac; -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.Cache -{ - public class CacheHelper - { - public static ICacheWriter CacheWriter { get; set; } - static CacheHelper() - { - CacheHelper.CacheWriter = new RedisCache(); - } - - - - - public static bool AddCache(string key, T value, DateTime expDate) - { - return CacheWriter.AddCache(key,value,expDate); - } - - public static bool AddCache(string key, T value) - { - return CacheWriter.AddCache(key, value); - } - - public static bool RemoveCache(string key) - { - return CacheWriter.RemoveCache(key); - } - - public static T GetCache(string key) - { - return CacheWriter.GetCache(key); - } - - public static bool SetCache(string key, T value, DateTime expDate) - { - return CacheWriter.SetCache(key,value,expDate); - } - - public static bool SetCache(string key, T value) - { - return CacheWriter.SetCache(key, value); - } - - } -} diff --git a/CC.Yi/CC.Yi.Common/Cache/ICacheWriter.cs b/CC.Yi/CC.Yi.Common/Cache/ICacheWriter.cs deleted file mode 100644 index 712f6857..00000000 --- a/CC.Yi/CC.Yi.Common/Cache/ICacheWriter.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CC.Yi.Common.Cache -{ - public interface ICacheWriter - { - bool AddCache(string key, T value, DateTime expDate); - bool AddCache(string key, T value); - bool RemoveCache(string key); - T GetCache(string key); - bool SetCache(string key, T value, DateTime expDate); - bool SetCache(string key, T value); - } -} diff --git a/CC.Yi/CC.Yi.Common/Cache/RedisCache.cs b/CC.Yi/CC.Yi.Common/Cache/RedisCache.cs deleted file mode 100644 index f2d84a52..00000000 --- a/CC.Yi/CC.Yi.Common/Cache/RedisCache.cs +++ /dev/null @@ -1,99 +0,0 @@ -using ServiceStack.Redis; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.Cache -{ - public class RedisCache : ICacheWriter - { - private RedisClient client; - private string ip = "49.235.212.122"; - private int port = 6379; - private string pwd = "Qz52013142020."; - public RedisCache() - { - } - - public void Dispose() - { - client.Dispose(); - } - - public bool AddCache(string key, T value, DateTime expDate) - { - try - { - using (client = new RedisClient(ip, port, pwd)) - { - return client.Add(key, value, expDate); - } - } - catch - { - - return false; - } - } - - public bool AddCache(string key, T value) - { - return client.Add(key, value); - } - - public bool RemoveCache(string key) - { - return client.Remove(key); - } - - public T GetCache(string key) - { - try - { - using (client = new RedisClient(ip, port, pwd)) - { - return client.Get(key); - } - } - catch - { - object p = new object(); - return (T)p; - } - } - - - - public bool SetCache(string key, T value, DateTime expDate) - { - try - { - using (client = new RedisClient(ip, port, pwd)) - { - return client.Set(key, value, expDate); - } - } - catch - { - return false; - } - } - - public bool SetCache(string key, T value) - { - try - { - using (client = new RedisClient(ip, port, pwd)) - { - return client.Set(key, value); - } - } - catch - { - object p = new object(); - return false; - } - - } - } -} diff --git a/CC.Yi/CC.Yi.Common/Castle/CustomAutofacAop.cs b/CC.Yi/CC.Yi.Common/Castle/CustomAutofacAop.cs deleted file mode 100644 index 526d39ef..00000000 --- a/CC.Yi/CC.Yi.Common/Castle/CustomAutofacAop.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Castle.DynamicProxy; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.Castle -{ - public class CustomAutofacAop : IInterceptor - { - public void Intercept(IInvocation invocation) - { - { - - //这里写执行方法前 - } - invocation.Proceed();//执行具体的实例 - { - - //这里写执行方法后 - } - } - } -} diff --git a/CC.Yi/CC.Yi.Common/EmailHelper.cs b/CC.Yi/CC.Yi.Common/EmailHelper.cs deleted file mode 100644 index bb92ef52..00000000 --- a/CC.Yi/CC.Yi.Common/EmailHelper.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Net.Mail; -using System.Net.Sockets; -using System.Text; - -namespace CC.Yi.Common -{ - public class EmailHelper - { - public static bool sendMail(string subject, string body, string toMail) - { - try - { - - string fromMail = "454313500@qq.com"; - string pwdMail = "yvjioburildgbhdf"; - MailMessage message = new MailMessage(); - //设置发件人,发件人需要与设置的邮件发送服务器的邮箱一致 - System.Net.Mail.MailAddress fromAddr = new System.Net.Mail.MailAddress(fromMail, "江西服装学院论坛"); - message.From = fromAddr; - - //设置收件人,可添加多个,添加方法与下面的一样 - message.To.Add(toMail); - - - //设置邮件标题 - message.Subject = subject; - - //设置邮件内容 - message.Body = body; - - //设置邮件发送服务器,服务器根据你使用的邮箱而不同,可以到相应的 邮箱管理后台查看,下面是QQ的 - System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.qq.com", 25) - ; - //设置发送人的邮箱账号和密码,POP3/SMTP服务要开启, 密码要是POP3/SMTP等服务的授权码 - client.Credentials = new System.Net.NetworkCredential(fromMail, pwdMail);//vtirsfsthwuadjfe fhszmpegwoqnecja - - //启用ssl,也就是安全发送 - client.EnableSsl = true; - - //发送邮件 - client.Send(message); - - return true; - } - catch - { - return false; - } - - } - - public static void 接受邮件() - { - using (TcpClient client = new TcpClient("pop.qq.com", 110)) - using (NetworkStream n = client.GetStream()) - { - GetEmail.ReadLine(n); // Read the welcome message. - GetEmail.SendCommand(n, "USER 1040079213@qq.com"); - GetEmail.SendCommand(n, "PASS odfaizoqdiupbfgi"); - GetEmail.SendCommand(n, "LIST"); // Retrieve message IDs - List messageIDs = new List(); - while (true) - { - string line = GetEmail.ReadLine(n); // e.g., "11876" - if (line == ".") break; - messageIDs.Add(int.Parse(line.Split(' ')[0])); // Message ID - } - foreach (int id in messageIDs) // Retrieve each message. - { - GetEmail.SendCommand(n, "RETR " + id); - string randomFile = Guid.NewGuid().ToString() + ".eml"; - using (StreamWriter writer = File.CreateText(randomFile)) - while (true) - { - string line = GetEmail.ReadLine(n); // Read next line of message. - if (line == ".") break; // Single dot = end of message. - if (line == "..") line = "."; // "Escape out" double dot. - writer.WriteLine(line); // Write to output file. - } - GetEmail.SendCommand(n, "DELE " + id); // Delete message off server. - } - GetEmail.SendCommand(n, "QUIT"); - } - } - } - //接受邮件pop - public class GetEmail - { - public static void SendCommand(Stream stream, string line) - { - byte[] data = Encoding.UTF8.GetBytes(line + "\r\n"); - stream.Write(data, 0, data.Length); - string response = ReadLine(stream); - if (!response.StartsWith("+OK")) - throw new Exception("POP Error: " + response); - } - public static string ReadLine(Stream s) - { - List lineBuffer = new List(); - while (true) - { - int b = s.ReadByte(); - if (b == 10 || b < 0) break; - if (b != 13) lineBuffer.Add((byte)b); - } - return Encoding.UTF8.GetString(lineBuffer.ToArray()); - } - } -} - diff --git a/CC.Yi/CC.Yi.Common/HttpHelper.cs b/CC.Yi/CC.Yi.Common/HttpHelper.cs deleted file mode 100644 index 6bfdfb18..00000000 --- a/CC.Yi/CC.Yi.Common/HttpHelper.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace CC.Yi.Common -{ - public static class HttpHelper - { - public static string HttpGet(string Url, string postDataStr="") - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr); - request.Method = "GET"; - request.ContentType = "text/html;charset=UTF-8"; - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream myResponseStream = response.GetResponseStream(); - StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); - string retString = myStreamReader.ReadToEnd(); - myStreamReader.Close(); - myResponseStream.Close(); - - return retString; - } - - public static bool HttpIOGet(string Url, string file, string postDataStr="") - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr); - request.Method = "GET"; - request.ContentType = "text/html;charset=UTF-8"; - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream myResponseStream = response.GetResponseStream(); - FileStream writer = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write); - byte[] buffer = new byte[1024]; - int c; - while ((c = myResponseStream.Read(buffer, 0, buffer.Length)) > 0) - { - writer.Write(buffer, 0, c); - } - writer.Close(); - myResponseStream.Close(); - - return true; - } - - public static string HttpPost(string Url, string postDataStr="") - { - CookieContainer cookie = new CookieContainer(); - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); - request.Method = "POST"; - request.ContentType = "application/x-www-form-urlencoded"; - request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr); - request.CookieContainer = cookie; - Stream myRequestStream = request.GetRequestStream(); - StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312")); - myStreamWriter.Write(postDataStr); - myStreamWriter.Close(); - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - - response.Cookies = cookie.GetCookies(response.ResponseUri); - Stream myResponseStream = response.GetResponseStream(); - StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); - string retString = myStreamReader.ReadToEnd(); - myStreamReader.Close(); - myResponseStream.Close(); - - return retString; - } - } -} diff --git a/CC.Yi/CC.Yi.Common/Json/DatetimeJsonConverter.cs b/CC.Yi/CC.Yi.Common/Json/DatetimeJsonConverter.cs deleted file mode 100644 index 8786801c..00000000 --- a/CC.Yi/CC.Yi.Common/Json/DatetimeJsonConverter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace CC.Yi.Common.Json -{ - public class DatetimeJsonConverter: JsonConverter - { - public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType == JsonTokenType.String) - { - if (DateTime.TryParse(reader.GetString(), out DateTime date)) - return date; - } - return reader.GetDateTime(); - } - - public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) - { - writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss")); - } - } -} diff --git a/CC.Yi/CC.Yi.Common/Json/DefaultJsonOptions.cs b/CC.Yi/CC.Yi.Common/Json/DefaultJsonOptions.cs deleted file mode 100644 index 7b83bea1..00000000 --- a/CC.Yi/CC.Yi.Common/Json/DefaultJsonOptions.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Encodings.Web; -using System.Text.Json; - -namespace CC.Yi.Common.Json -{ - /// - /// https://blog.csdn.net/sD7O95O/article/details/103797885 - /// - public class DefaultJsonOptions - { - public static JsonSerializerOptions Get() - { - var options = new JsonSerializerOptions(); - //options.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping; - options.IgnoreNullValues = true;//排除所有属性值为 null 属性 - //// 自定义名称策略 - //options.PropertyNamingPolicy = new LowerCaseNamingPolicy(); - return options; - } - } -} diff --git a/CC.Yi/CC.Yi.Common/Json/EnumJsonConverter.cs b/CC.Yi/CC.Yi.Common/Json/EnumJsonConverter.cs deleted file mode 100644 index 7a95432e..00000000 --- a/CC.Yi/CC.Yi.Common/Json/EnumJsonConverter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -namespace CC.Yi.Common.Json -{ - public class EnumJsonConverter : JsonConverter - { - public override bool CanConvert(Type typeToConvert) - { - return typeToConvert.IsEnum; - } - //未实现 - public override Enum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - if (reader.TokenType == JsonTokenType.Number) - { - int num; - reader.TryGetInt32(out num); - return (Enum)Enum.Parse(typeToConvert,num.ToString()); - } - if (reader.TokenType == JsonTokenType.String) - { - string str = reader.GetString(); - return (Enum)Enum.Parse(typeToConvert, str); - } - return null; - } - - public override void Write(Utf8JsonWriter writer, Enum value, JsonSerializerOptions options) - { - writer.WriteStringValue(value.ToString()); - } - } -} diff --git a/CC.Yi/CC.Yi.Common/Json/LowerCaseNamingPolicy.cs b/CC.Yi/CC.Yi.Common/Json/LowerCaseNamingPolicy.cs deleted file mode 100644 index 0c429ba3..00000000 --- a/CC.Yi/CC.Yi.Common/Json/LowerCaseNamingPolicy.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace CC.Yi.Common.Json -{ - /// - /// 自定义名称策略 - /// - public class LowerCaseNamingPolicy : JsonNamingPolicy - { - public override string ConvertName(string name) => name.ToLower(); - } - -} diff --git a/CC.Yi/CC.Yi.Common/Json/TimeSpanJsonConverter.cs b/CC.Yi/CC.Yi.Common/Json/TimeSpanJsonConverter.cs deleted file mode 100644 index 9effd629..00000000 --- a/CC.Yi/CC.Yi.Common/Json/TimeSpanJsonConverter.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace CC.Yi.Common.Json -{ - public class TimeSpanJsonConverter : JsonConverter - { - public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - - //if (TimeSpan.TryParse(reader.GetString(), out TimeSpan date)) - // return date; - - TimeSpan.TryParse(reader.GetString(), out TimeSpan date); - return date; - } - - public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) - { - // writer.WriteStringValue(value.ToString("HH:mm:ss")); - writer.WriteStringValue(value.ToString()); - } - } -} diff --git a/CC.Yi/CC.Yi.Common/JsonHelper.cs b/CC.Yi/CC.Yi.Common/JsonHelper.cs deleted file mode 100644 index ea9b4c2d..00000000 --- a/CC.Yi/CC.Yi.Common/JsonHelper.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace CC.Yi.Common -{ - public static class JsonHelper - { - public static string JsonToString(object data = null, int code = 200, bool flag = true, string message = "成功") - { - return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = code, flag = flag, message = message, data = data }); - } - public static string JsonToString2(object data = null, int code = 200, bool flag = true, string message = "成功", int count = 0) - { - return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = code, flag = flag, message = message, count = count, data = data }); - } - public static string ToString(object data) - { - return Newtonsoft.Json.JsonConvert.SerializeObject(data); - } - public static T ToJson(string data) - { - return Newtonsoft.Json.JsonConvert.DeserializeObject(data); - } - } -} diff --git a/CC.Yi/CC.Yi.Common/Jwt/JwtConst.cs b/CC.Yi/CC.Yi.Common/Jwt/JwtConst.cs deleted file mode 100644 index 1e7713ff..00000000 --- a/CC.Yi/CC.Yi.Common/Jwt/JwtConst.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.Jwt -{ - public class JwtConst - { - public const string SecurityKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB"; - public const string Domain = "http://localhost:5000"; - } -} diff --git a/CC.Yi/CC.Yi.Common/LinqHelper.cs b/CC.Yi/CC.Yi.Common/LinqHelper.cs deleted file mode 100644 index 6c9470f5..00000000 --- a/CC.Yi/CC.Yi.Common/LinqHelper.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; - -namespace CC.Yi.Common -{ - public static class LinqHelper - { - //T是列表类型,S是排序的属性 - public static IQueryable GetPageEntities(IQueryable myData, int pageSize, int pageIndex, out int total, Expression> whereLambda=null, Expression> orderByLambda=null, bool isAsc=false) - { - total = myData.Where(whereLambda).Count(); - if (isAsc) - { - var pageData = myData.Where(whereLambda) - .OrderBy(orderByLambda) - .Skip(pageSize * (pageIndex - 1)) - .Take(pageSize).AsQueryable(); - return pageData; - } - else - { - var pageData = myData.Where(whereLambda) - .OrderByDescending(orderByLambda) - .Skip(pageSize * (pageIndex - 1)) - .Take(pageSize).AsQueryable(); - return pageData; - } - } - } -} diff --git a/CC.Yi/CC.Yi.Common/RandomHelper.cs b/CC.Yi/CC.Yi.Common/RandomHelper.cs deleted file mode 100644 index edfa8836..00000000 --- a/CC.Yi/CC.Yi.Common/RandomHelper.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace CC.Yi.Common -{ - public class RandomHelper - { - public static string replaceBianLiang(string content) - { - content = content.Replace("{当前时间}", DateTime.Now.TimeOfDay.ToString()); - string[] bianliang = new string[] { "{随机字母}", "{随机数字}", "{随机汉字}" }; - Regex r; - int count; - string readstr = ""; - foreach (string str in bianliang) - { - count = (content.Length - content.Replace(str, "").Length) / str.Length; - if (str == "{随机汉字}") readstr = RandChina(count); - if (str == "{随机数字}") readstr = GenerateCheckCodeNum(count); - if (str == "{随机字母}") readstr = GenerateRandomLetter(count); - if (count > readstr.Length) count = readstr.Length; - r = new Regex(str.Replace("{", "\\{").Replace("}", "\\}")); - for (int i = 0; i < count; i++) - { - content = r.Replace(content, readstr.Substring(i, 1), 1); - } - } - return content; - } - - - /// - /// 随机生成字母 - /// - /// - /// - public static string GenerateRandomLetter(int Length) - { - char[] Pattern = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; - string result = ""; - int n = Pattern.Length; - Random random = new Random(~unchecked((int)DateTime.Now.Ticks)); - for (int i = 0; i < Length; i++) - { - int rnd = random.Next(0, n); - result += Pattern[rnd]; - } - return result; - } - - /// - /// 随机生成数字 - /// - /// - /// - public static string GenerateCheckCodeNum(int codeCount) - { - int rep = 0; - string str = string.Empty; - long num2 = DateTime.Now.Ticks + rep; - rep++; - Random random = new Random(((int)(((ulong)num2) & 0xffffffffL)) | ((int)(num2 >> rep))); - for (int i = 0; i < codeCount; i++) - { - int num = random.Next(); - str = str + ((char)(0x30 + ((ushort)(num % 10)))).ToString(); - } - return str; - } - - /// - /// 此函数为生成指定数目的汉字 - /// - /// 汉字数目 - /// 所有汉字 - public static string RandChina(int charLen) - { - int area, code;//汉字由区位和码位组成(都为0-94,其中区位16-55为一级汉字区,56-87为二级汉字区,1-9为特殊字符区) - StringBuilder strtem = new StringBuilder(); - Random rand = new Random(); - for (int i = 0; i < charLen; i++) - { - area = rand.Next(16, 88); - if (area == 55)//第55区只有89个字符 - { - code = rand.Next(1, 90); - } - else - { - code = rand.Next(1, 94); - } - strtem.Append(Encoding.GetEncoding("GB2312").GetString(new byte[] { Convert.ToByte(area + 160), Convert.ToByte(code + 160) })); - } - return strtem.ToString(); - } - } -} diff --git a/CC.Yi/CC.Yi.Common/Result.cs b/CC.Yi/CC.Yi.Common/Result.cs deleted file mode 100644 index 400df0f8..00000000 --- a/CC.Yi/CC.Yi.Common/Result.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace CC.Yi.Common -{ - /// - /// 结果数据 - /// - public class Result - { - public bool status { get; set; } - public int code { get; set; } - public string msg { get; set; } - public object data { get; set; } - public static Result Instance(bool status, string msg) - { - return new Result() { status = status,code=500, msg = msg }; - } - public static Result Error(string msg="fail") - { - return new Result() { status = false, code = 500, msg = msg }; - } - public static Result Success(string msg= "succeed") - { - return new Result() { status = true, code = 200, msg = msg }; - } - public Result SetData(object obj) - { - this.data = obj; - return this; - } - public Result SetCode(int Code) - { - this.code = Code; - return this; - } - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Common/T4Vue/T4Api.tt b/CC.Yi/CC.Yi.Common/T4Vue/T4Api.tt deleted file mode 100644 index 0216062f..00000000 --- a/CC.Yi/CC.Yi.Common/T4Vue/T4Api.tt +++ /dev/null @@ -1,58 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".vue" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - List ModelData=new List(); - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Vue.txt"); - string p; - while((p =sr.ReadLine())!=null) - { - ModelData.Add(p); - } - sr.Close(); - string Model= ModelData[0]; - string BModel=Model.Substring(0,1).ToUpper()+Model.Substring(1); - string[] Data=ModelData[1].Split(','); - string[] Name=ModelData[2].Split(','); - string[] Default=ModelData[3].Split(','); - #> - - - -/* -import myaxios from '@/utils/myaxios' -export default { - get<#=BModel#>s() { - return myaxios({ - url: '/<#=BModel#>/get<#=BModel#>s', - method: 'get' - }) - }, - add<#=BModel#>(<#=Model#>) { - return myaxios({ - url: '/<#=BModel#>/add<#=BModel#>', - method: 'post', - data: <#=Model#> - }) - }, - update<#=BModel#>(<#=BModel#>) { - return myaxios({ - url: '/<#=BModel#>/Update<#=BModel#>', - method: 'post', - data: <#=BModel#> - }) - }, - del<#=BModel#>List(Ids) { - return myaxios({ - url: '/<#=BModel#>/Del<#=BModel#>List', - method: 'post', - data: Ids - }) - }, -} -*/ \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Common/T4Vue/T4Api.vue b/CC.Yi/CC.Yi.Common/T4Vue/T4Api.vue deleted file mode 100644 index 1b78e4a1..00000000 --- a/CC.Yi/CC.Yi.Common/T4Vue/T4Api.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - -/* -import myaxios from '@/utils/myaxios' -export default { - getStudents() { - return myaxios({ - url: '/Student/getStudents', - method: 'get' - }) - }, - addStudent(student) { - return myaxios({ - url: '/Student/addStudent', - method: 'post', - data: student - }) - }, - updateStudent(Student) { - return myaxios({ - url: '/Student/UpdateStudent', - method: 'post', - data: Student - }) - }, - delStudentList(Ids) { - return myaxios({ - url: '/Student/DelStudentList', - method: 'post', - data: Ids - }) - }, -} -*/ \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Common/T4Vue/T4Component.tt b/CC.Yi/CC.Yi.Common/T4Vue/T4Component.tt deleted file mode 100644 index 25dafb24..00000000 --- a/CC.Yi/CC.Yi.Common/T4Vue/T4Component.tt +++ /dev/null @@ -1,279 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".vue" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - List ModelData=new List(); - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Vue.txt"); - string p; - while((p =sr.ReadLine())!=null) - { - ModelData.Add(p); - } - sr.Close(); - string Model= ModelData[0]; - string BModel=Model.Substring(0,1).ToUpper()+Model.Substring(1); - string[] Data=ModelData[1].Split(','); - string[] Name=ModelData[2].Split(','); - string[] Default=ModelData[3].Split(','); - #> - - - -/* - - -*/ \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Common/T4Vue/T4Component.vue b/CC.Yi/CC.Yi.Common/T4Vue/T4Component.vue deleted file mode 100644 index 26b98ce6..00000000 --- a/CC.Yi/CC.Yi.Common/T4Vue/T4Component.vue +++ /dev/null @@ -1,237 +0,0 @@ - - - -/* - - -*/ \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Common/T4Vue/T4Controller.cs b/CC.Yi/CC.Yi.Common/T4Vue/T4Controller.cs deleted file mode 100644 index 954ca2a6..00000000 --- a/CC.Yi/CC.Yi.Common/T4Vue/T4Controller.cs +++ /dev/null @@ -1,59 +0,0 @@ -//using CC.Yi.Common; -//using CC.Yi.IBLL; -//using CC.Yi.Model; -//using Microsoft.AspNetCore.Authorization; -//using Microsoft.AspNetCore.Mvc; -//using Microsoft.EntityFrameworkCore; -//using Microsoft.Extensions.Logging; -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Threading.Tasks; - -//namespace CC.Yi.API.Controllers -//{ -// [Route("[controller]/[action]")] -// [ApiController] -// public class PlateController : Controller -// { -// private IplateBll _plateBll; -// private ILogger _logger; -// short delFlagNormal = (short)ViewModel.Enum.DelFlagEnum.Normal; -// public PlateController(IplateBll plateBll, ILogger logger) -// { -// _plateBll = plateBll; -// _logger = logger; -// } - -// [HttpGet] -// public async Task GetPlates() -// { -// var data =await _plateBll.GetEntities(u=>u.is_delete==delFlagNormal).AsNoTracking().ToListAsync(); -// return Result.Success().SetData(data); -// } - -// [Authorize(Policy = "板块管理")] -// [HttpPost] -// public Result AddPlate(plate myPlate) -// { -// _plateBll.Add(myPlate); -// return Result.Success(); -// } - -// [Authorize(Policy = "板块管理")] -// [HttpPost] -// public Result UpdatePlate(plate myPlate) -// { -// _plateBll.Update(myPlate); -// return Result.Success(); -// } - -// [Authorize(Policy = "板块管理")] -// [HttpPost] -// public Result delPlateList(List Ids) -// { -// _plateBll.DelListByUpdateList(Ids); -// return Result.Success(); -// } -// } -//} diff --git a/CC.Yi/CC.Yi.Common/imageHelper.cs b/CC.Yi/CC.Yi.Common/imageHelper.cs deleted file mode 100644 index 170aba9c..00000000 --- a/CC.Yi/CC.Yi.Common/imageHelper.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.IO; -using System.IO.Compression; -using System.Drawing; - -namespace CC.Yi.Common -{ - public class SimilarPhoto - { - Image SourceImg; - public SimilarPhoto(string filePath) - { - SourceImg = Image.FromFile(filePath); - } - public SimilarPhoto(Stream stream) - { - SourceImg = Image.FromStream(stream); - } - public String GetHash() - { - Image image = ReduceSize(); - Byte[] grayValues = ReduceColor(image); - Byte average = CalcAverage(grayValues); - String reslut = ComputeBits(grayValues, average); - return reslut; - } - // Step 1 : Reduce size to 8*8 - private Image ReduceSize(int width = 8, int height = 8) - { - Image image = SourceImg.GetThumbnailImage(width, height, () => { return false; }, IntPtr.Zero); - return image; - } - // Step 2 : Reduce Color - private Byte[] ReduceColor(Image image) - { - Bitmap bitMap = new Bitmap(image); - Byte[] grayValues = new Byte[image.Width * image.Height]; - for (int x = 0; x < image.Width; x++) - for (int y = 0; y < image.Height; y++) - { - Color color = bitMap.GetPixel(x, y); - byte grayValue = (byte)((color.R * 30 + color.G * 59 + color.B * 11) / 100); - grayValues[x * image.Width + y] = grayValue; - } - return grayValues; - } - // Step 3 : Average the colors - private Byte CalcAverage(byte[] values) - { - int sum = 0; - for (int i = 0; i < values.Length; i++) - sum += (int)values[i]; - return Convert.ToByte(sum / values.Length); - } - // Step 4 : Compute the bits - private String ComputeBits(byte[] values, byte averageValue) - { - char[] result = new char[values.Length]; - for (int i = 0; i < values.Length; i++) - { - if (values[i] < averageValue) - result[i] = '0'; - else - result[i] = '1'; - } - SourceImg.Dispose(); - return new String(result); - } - // Compare hash - public static Int32 CalcSimilarDegree(string a, string b) - { - if (a.Length != b.Length) - throw new ArgumentException(); - int count = 0; - for (int i = 0; i < a.Length; i++) - { - if (a[i] != b[i]) - count++; - } - return count; - } - } - public static class imageHelper - { - public static int Compare(string filePath1, string filePath2) - { - SimilarPhoto photo1 = new SimilarPhoto(filePath1); - SimilarPhoto photo2 = new SimilarPhoto(filePath2); - return SimilarPhoto.CalcSimilarDegree(photo1.GetHash(), photo2.GetHash()); - } - public static bool ByStringToSave(string name, string iss) - { - iss = iss.Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "") - .Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", ""); - byte[] arr = Convert.FromBase64String(iss); - MemoryStream ms = new MemoryStream(arr); - Bitmap bmp = new Bitmap(ms); - string StudentWorkImages = "StudentWorkImages"; - - if (Directory.Exists(@"./wwwroot/" + StudentWorkImages) == false)//如果不存在就创建file文件夹 - { - Directory.CreateDirectory(@"./wwwroot/" + StudentWorkImages); - } - - - - bmp.Save(@"./wwwroot/" + StudentWorkImages + "/" + name + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); - ms.Close(); - return true; - } - public static bool CreateZip() - { - string file_path = @"./wwwroot/StudentWorkImages.zip"; - string file_path2 = @"./wwwroot/StudentWorkImages/"; - if (File.Exists(file_path)) - { - File.Delete(file_path); - } - - ZipFile.CreateFromDirectory(file_path2, file_path); - return true; - } - public static bool DeleteAll() - { - string file_path = @"./wwwroot/StudentWorkImages/"; - if (Directory.Exists(file_path)) - { - DelectDir(file_path); - return true; - } - else - return false; - } - public static bool DeleteByString(string name) - { - File.Delete(@"./wwwroot/StudentWorkImages/" + name + ".jpg"); - return true; - } - public static void DelectDir(string srcPath) - { - try - { - DirectoryInfo dir = new DirectoryInfo(srcPath); - FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录 - foreach (FileSystemInfo i in fileinfo) - { - if (i is DirectoryInfo) //判断是否文件夹 - { - DirectoryInfo subdir = new DirectoryInfo(i.FullName); - subdir.Delete(true); //删除子目录和文件 - } - else - { - File.Delete(i.FullName); //删除指定文件 - } - } - } - catch (Exception e) - { - Console.Write(e.ToString()); - } - } - } -} diff --git a/CC.Yi/CC.Yi.Common/mongodb/model/student.cs b/CC.Yi/CC.Yi.Common/mongodb/model/student.cs deleted file mode 100644 index fd86bf5f..00000000 --- a/CC.Yi/CC.Yi.Common/mongodb/model/student.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.mongodb.model -{ - public class student - { - public string sname { get; set; } - - public string sex { get; set; } - } -} diff --git a/CC.Yi/CC.Yi.Common/mongodb/mongodbContext.cs b/CC.Yi/CC.Yi.Common/mongodb/mongodbContext.cs deleted file mode 100644 index c499d740..00000000 --- a/CC.Yi/CC.Yi.Common/mongodb/mongodbContext.cs +++ /dev/null @@ -1,29 +0,0 @@ -using CC.Yi.Common.mongodb.model; -using MongoDB.Driver; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common.mongodb -{ - public class mongodbContext - { - private readonly IMongoDatabase _database = null; - public mongodbContext() - { - //连接服务器名称 mongo的默认端口27017 - var client = new MongoClient("mongodb://.......:27017"); - if (client != null) - //连接数据库 - _database = client.GetDatabase("数据库名"); - } - - public IMongoCollection Province - { - get - { - return _database.GetCollection("Province"); - } - } - } -} diff --git a/CC.Yi/CC.Yi.Common/settingHelper.cs b/CC.Yi/CC.Yi.Common/settingHelper.cs deleted file mode 100644 index 01bfa939..00000000 --- a/CC.Yi/CC.Yi.Common/settingHelper.cs +++ /dev/null @@ -1,48 +0,0 @@ -using CC.Yi.Common.Cache; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.Common -{ - public static class settingHelper - { - public static ICacheWriter CacheWriter { get; set; } - - static settingHelper() - { - settingHelper.CacheWriter = new RedisCache(); - } - - public static int commentPage() - { - return CacheWriter.GetCache("commentPage"); - } - public static int discussPage() - { - return CacheWriter.GetCache("discussPage"); - } - public static int commentExperience() - { - return CacheWriter.GetCache("commentExperience"); - } - public static int discussExperience() - { - return CacheWriter.GetCache("discussExperience"); - } - public static string title() - { - return CacheWriter.GetCache("title"); - } - - //配置设置 - //public static void update(setting data) - //{ - // CacheWriter.SetCache("commentPage", data.commentPage); - // CacheWriter.SetCache("discussPage", data.discussPage); - // CacheWriter.SetCache("commentExperience", data.commentExperience); - // CacheWriter.SetCache("discussExperience", data.discussExperience); - // CacheWriter.SetCache("title", data.title); - //} - } -} diff --git a/CC.Yi/CC.Yi.DAL/BaseDal.cs b/CC.Yi/CC.Yi.DAL/BaseDal.cs deleted file mode 100644 index 43ce2ef8..00000000 --- a/CC.Yi/CC.Yi.DAL/BaseDal.cs +++ /dev/null @@ -1,122 +0,0 @@ -using CC.Yi.IDAL; -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.ChangeTracking; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Threading.Tasks; - -namespace CC.Yi.DAL -{ - public class BaseDal : IBaseDal where T : class, new() - { - public DbContext Db; - public BaseDal(DataContext _Db) - { - Db = _Db; - } - - public async Task GetEntityById(int id) - { - return await Db.Set().FindAsync(id); - } - - public IQueryable GetEntities(Expression> whereLambda) - { - - return Db.Set().Where(whereLambda).AsQueryable(); - } - - public IQueryable GetAllEntities() - { - return Db.Set().AsQueryable(); - } - - - public int GetCount(Expression> whereLambda) - { - return Db.Set().Where(whereLambda).Count(); - } - - public IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda) //分组 - { - return Db.Set().Where(whereLambda).GroupBy(groupByLambda).AsQueryable(); - - } - - - - public IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc) - { - total = Db.Set().Where(whereLambda).Count(); - if (isAsc) - { - var pageData = Db.Set().Where(whereLambda) - .OrderBy(orderByLambda) - .Skip(pageSize * (pageIndex - 1)) - .Take(pageSize).AsQueryable(); - return pageData; - } - else - { - var pageData = Db.Set().Where(whereLambda) - .OrderByDescending(orderByLambda) - .Skip(pageSize * (pageIndex - 1)) - .Take(pageSize).AsQueryable(); - return pageData; - } - } - - public T Add(T entity) - { - Db.Set().Add(entity); - //Db.SaveChanges(); - return entity; - } - public bool AddRange(IEnumerable entities) - { - Db.Set().AddRange(entities); - return true; - } - - public bool Update(T entity) - { - //所有字段均修改 - Db.Entry(entity).State = EntityState.Modified; - //return Db.SaveChanges() > 0; - return true; - } - public bool Update(T entity, params string[] propertyNames) - { - EntityEntry entry = Db.Entry(entity); - entry.State = EntityState.Unchanged; - foreach (var item in propertyNames) - { - entry.Property(item).IsModified = true; - } - return true; - } - - public bool Delete(T entity) - { - Db.Entry(entity).State = EntityState.Deleted; - //return Db.SaveChanges() > 0; - return true; - } - public bool Detete(int id) - { - var entity = Db.Set().Find(id);//根据id找到实体 - Db.Set().Remove(entity);//由于这里先Find找到了实体,所以这里可以用Remove标记该实体要移除(删除)。如果不是先Find到实体就需要用System.Data.Entity.EntityState.Deleted - return true; - } - public bool DeteteRange(IEnumerable entity) - { - Db.Set().RemoveRange(entity); - return true; - } - - - } -} diff --git a/CC.Yi/CC.Yi.DAL/CC.Yi.DAL.csproj b/CC.Yi/CC.Yi.DAL/CC.Yi.DAL.csproj deleted file mode 100644 index ac766382..00000000 --- a/CC.Yi/CC.Yi.DAL/CC.Yi.DAL.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - TextTemplatingFileGenerator - T4DAL.cs - - - - - - - - - - True - True - T4DAL.tt - - - - diff --git a/CC.Yi/CC.Yi.DAL/T4DAL.cs b/CC.Yi/CC.Yi.DAL/T4DAL.cs deleted file mode 100644 index 7f13bb7a..00000000 --- a/CC.Yi/CC.Yi.DAL/T4DAL.cs +++ /dev/null @@ -1,17 +0,0 @@ -using CC.Yi.IDAL; -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.EntityFrameworkCore; - -namespace CC.Yi.DAL -{ - public partial class studentDal : BaseDal, IstudentDal - { - public studentDal(DataContext _Db):base(_Db) - { - Db = _Db; - } - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.DAL/T4DAL.tt b/CC.Yi/CC.Yi.DAL/T4DAL.tt deleted file mode 100644 index c5f32512..00000000 --- a/CC.Yi/CC.Yi.DAL/T4DAL.tt +++ /dev/null @@ -1,35 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.IDAL; -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.EntityFrameworkCore; - -namespace CC.Yi.DAL -{ -<# foreach(string k in ModelData){ - #> - public partial class <#=k #>Dal : BaseDal<<#=k #>>, I<#=k #>Dal - { - public <#=k #>Dal(DataContext _Db):base(_Db) - { - Db = _Db; - } - } -<# } #> -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.IBLL/CC.Yi.IBLL.csproj b/CC.Yi/CC.Yi.IBLL/CC.Yi.IBLL.csproj deleted file mode 100644 index 778e1962..00000000 --- a/CC.Yi/CC.Yi.IBLL/CC.Yi.IBLL.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - Library - netcoreapp3.1 - - - - - - - - - - TextTemplatingFileGenerator - T4IBLL.cs - - - - - - - - - - True - True - T4IBLL.tt - - - - diff --git a/CC.Yi/CC.Yi.IBLL/IBaseBll.cs b/CC.Yi/CC.Yi.IBLL/IBaseBll.cs deleted file mode 100644 index d2551b08..00000000 --- a/CC.Yi/CC.Yi.IBLL/IBaseBll.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Autofac.Extras.DynamicProxy; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Threading.Tasks; - -namespace CC.Yi.IBLL -{ - public interface IBaseBll where T : class, new() - { - #region - //通过id得到实体 - #endregion - Task GetEntityById(int id); - - #region - //得到全部实体 - #endregion - IQueryable GetAllEntities(); - - #region - //通过表达式得到实体 - #endregion - IQueryable GetEntities(Expression> whereLambda); - - #region - //通过表达式得到实体,分页版本 - #endregion - IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc); - - #region - //通过表达式统计数量 - #endregion - int GetCount(Expression> whereLambda); - - #region - //通过表达式分组 - #endregion - IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda); - - #region - //添加实体 - #endregion - T Add(T entity); - - #region - //添加多个实体 - #endregion - bool Add(IEnumerable entities); - - #region - //更新实体 - #endregion - bool Update(T entity); - - #region - //更新实体部分属性 - #endregion - bool Update(T entity, params string[] propertyNames); - - #region - //删除实体 - #endregion - bool Delete(T entity); - - #region - //通过id删除实体 - #endregion - bool Delete(int id); - - #region - //通过id列表删除多个实体 - #endregion - bool Delete(IEnumerable ids); - - #region - //通过表达式删除实体 - #endregion - bool Delete(Expression> where); - } -} diff --git a/CC.Yi/CC.Yi.IBLL/T4IBLL.cs b/CC.Yi/CC.Yi.IBLL/T4IBLL.cs deleted file mode 100644 index 829ba58c..00000000 --- a/CC.Yi/CC.Yi.IBLL/T4IBLL.cs +++ /dev/null @@ -1,13 +0,0 @@ -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - -namespace CC.Yi.IBLL -{ - public partial interface IstudentBll : IBaseBll - { - Task DelListByUpdateList(List Ids); - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.IBLL/T4IBLL.tt b/CC.Yi/CC.Yi.IBLL/T4IBLL.tt deleted file mode 100644 index 6e362ea5..00000000 --- a/CC.Yi/CC.Yi.IBLL/T4IBLL.tt +++ /dev/null @@ -1,31 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - -namespace CC.Yi.IBLL -{ -<# foreach(string k in ModelData){ - #> - public partial interface I<#=k #>Bll : IBaseBll<<#=k #>> - { - Task DelListByUpdateList(List Ids); - } -<# } #> -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.IDAL/CC.Yi.IDAL.csproj b/CC.Yi/CC.Yi.IDAL/CC.Yi.IDAL.csproj deleted file mode 100644 index bfba3015..00000000 --- a/CC.Yi/CC.Yi.IDAL/CC.Yi.IDAL.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - Library - netcoreapp3.1 - - - - - - - - - TextTemplatingFileGenerator - T4IDAL.cs - - - - - - - - - - True - True - T4IDAL.tt - - - - diff --git a/CC.Yi/CC.Yi.IDAL/IBaseDal.cs b/CC.Yi/CC.Yi.IDAL/IBaseDal.cs deleted file mode 100644 index abadabb1..00000000 --- a/CC.Yi/CC.Yi.IDAL/IBaseDal.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Threading.Tasks; - -namespace CC.Yi.IDAL -{ - public interface IBaseDal where T : class, new() - { - #region - //通过Id得到实体 - #endregion - Task GetEntityById(int id); - - #region - //得到全部实体 - #endregion - IQueryable GetAllEntities(); - - #region - //通过表达式得到实体 - #endregion - IQueryable GetEntities(Expression> whereLambda); - - #region - //通过表达式得到实体,分页版本 - #endregion - IQueryable GetPageEntities(int pageSize, int pageIndex, out int total, Expression> whereLambda, Expression> orderByLambda, bool isAsc); - - #region - //通过表达式统计数量 - #endregion - int GetCount(Expression> whereLambda); - - #region - //通过表达式分组 - #endregion - IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda); - - #region - //添加单个实体 - #endregion - T Add(T entity); - - #region - //添加多个实体 - #endregion - bool AddRange(IEnumerable entities); - #region - //更新单个实体 - #endregion - bool Update(T entity); - - #region - //更新单个实体部分属性 - #endregion - bool Update(T entity, params string[] propertyNames); - - #region - //删除单个实体 - #endregion - bool Delete(T entity); - - #region - //通过id删除实体 - #endregion - bool Detete(int id); - - #region - //删除多个实体 - #endregion - bool DeteteRange(IEnumerable entity); - } -} diff --git a/CC.Yi/CC.Yi.IDAL/T4IDAL.cs b/CC.Yi/CC.Yi.IDAL/T4IDAL.cs deleted file mode 100644 index 8b900b8c..00000000 --- a/CC.Yi/CC.Yi.IDAL/T4IDAL.cs +++ /dev/null @@ -1,11 +0,0 @@ -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.IDAL -{ - public partial interface IstudentDal:IBaseDal - { - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.IDAL/T4IDAL.tt b/CC.Yi/CC.Yi.IDAL/T4IDAL.tt deleted file mode 100644 index 7faf648f..00000000 --- a/CC.Yi/CC.Yi.IDAL/T4IDAL.tt +++ /dev/null @@ -1,29 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using CC.Yi.Model; -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.IDAL -{ -<# foreach(string k in ModelData){ - #> - public partial interface I<#=k #>Dal:IBaseDal<<#=k #>> - { - } -<# } #> -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Model/CC.Yi.Model.csproj b/CC.Yi/CC.Yi.Model/CC.Yi.Model.csproj deleted file mode 100644 index 35ed7c71..00000000 --- a/CC.Yi/CC.Yi.Model/CC.Yi.Model.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - netcoreapp3.1 - - - - - - - - - - - - - - - - - True - True - T4DataContext.tt - - - - - - TextTemplatingFileGenerator - T4DataContext.cs - - - - diff --git a/CC.Yi/CC.Yi.Model/DataContext.cs b/CC.Yi/CC.Yi.Model/DataContext.cs deleted file mode 100644 index df55c3b5..00000000 --- a/CC.Yi/CC.Yi.Model/DataContext.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; - -namespace CC.Yi.Model -{ - public partial class DataContext : DbContext - { - public DataContext(DbContextOptions options) : base(options) - { - - } - } -} diff --git a/CC.Yi/CC.Yi.Model/Migrations/20210602114758_yi1.Designer.cs b/CC.Yi/CC.Yi.Model/Migrations/20210602114758_yi1.Designer.cs deleted file mode 100644 index 92f2565c..00000000 --- a/CC.Yi/CC.Yi.Model/Migrations/20210602114758_yi1.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20210602114758_yi1")] - partial class yi1 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.6"); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("name") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("student"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi/CC.Yi.Model/Migrations/20210602114758_yi1.cs b/CC.Yi/CC.Yi.Model/Migrations/20210602114758_yi1.cs deleted file mode 100644 index b5530482..00000000 --- a/CC.Yi/CC.Yi.Model/Migrations/20210602114758_yi1.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace CC.Yi.Model.Migrations -{ - public partial class yi1 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "student", - columns: table => new - { - id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - name = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_student", x => x.id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "student"); - } - } -} diff --git a/CC.Yi/CC.Yi.Model/Migrations/20210602115718_yi2.Designer.cs b/CC.Yi/CC.Yi.Model/Migrations/20210602115718_yi2.Designer.cs deleted file mode 100644 index 31ba04bf..00000000 --- a/CC.Yi/CC.Yi.Model/Migrations/20210602115718_yi2.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20210602115718_yi2")] - partial class yi2 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.6"); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("name") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("student"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi/CC.Yi.Model/Migrations/20210602115718_yi2.cs b/CC.Yi/CC.Yi.Model/Migrations/20210602115718_yi2.cs deleted file mode 100644 index 0c0f1c35..00000000 --- a/CC.Yi/CC.Yi.Model/Migrations/20210602115718_yi2.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace CC.Yi.Model.Migrations -{ - public partial class yi2 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "is_delete", - table: "student", - type: "INTEGER", - nullable: false, - defaultValue: 0); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "is_delete", - table: "student"); - } - } -} diff --git a/CC.Yi/CC.Yi.Model/Migrations/DataContextModelSnapshot.cs b/CC.Yi/CC.Yi.Model/Migrations/DataContextModelSnapshot.cs deleted file mode 100644 index 9021b7f0..00000000 --- a/CC.Yi/CC.Yi.Model/Migrations/DataContextModelSnapshot.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -using CC.Yi.Model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace CC.Yi.Model.Migrations -{ - [DbContext(typeof(DataContext))] - partial class DataContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.6"); - - modelBuilder.Entity("CC.Yi.Model.student", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("is_delete") - .HasColumnType("INTEGER"); - - b.Property("name") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.ToTable("student"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CC.Yi/CC.Yi.Model/T4DataContext.cs b/CC.Yi/CC.Yi.Model/T4DataContext.cs deleted file mode 100644 index 584f6d63..00000000 --- a/CC.Yi/CC.Yi.Model/T4DataContext.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Text; -namespace CC.Yi.Model -{ - public partial class DataContext :DbContext - { - public DbSet student { get; set; } - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Model/T4DataContext.tt b/CC.Yi/CC.Yi.Model/T4DataContext.tt deleted file mode 100644 index 2fa74f5b..00000000 --- a/CC.Yi/CC.Yi.Model/T4DataContext.tt +++ /dev/null @@ -1,29 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string txt; - StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); - txt=sr.ReadToEnd(); - sr.Close(); - string[] ModelData= txt.Split(','); - #> -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Text; -namespace CC.Yi.Model -{ - public partial class DataContext :DbContext - { -<# foreach(string k in ModelData){ - #> - public DbSet<<#=k #>> <#=k #> { get; set; } -<# } #> - } -} \ No newline at end of file diff --git a/CC.Yi/CC.Yi.Model/baseModel.cs b/CC.Yi/CC.Yi.Model/baseModel.cs deleted file mode 100644 index 72aefd7b..00000000 --- a/CC.Yi/CC.Yi.Model/baseModel.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text; - -namespace CC.Yi.Model -{ - public class baseModel - { - [Key] - [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] - public int id { get; set; } - public int is_delete { get; set; } - } -} diff --git a/CC.Yi/CC.Yi.Model/student.cs b/CC.Yi/CC.Yi.Model/student.cs deleted file mode 100644 index 78c9326c..00000000 --- a/CC.Yi/CC.Yi.Model/student.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text; - -namespace CC.Yi.Model -{ - public class student:baseModel - { - public string name { get; set; } - } -} diff --git a/CC.Yi/CC.Yi.ViewModel/CC.Yi.ViewModel.csproj b/CC.Yi/CC.Yi.ViewModel/CC.Yi.ViewModel.csproj deleted file mode 100644 index cefa80a0..00000000 --- a/CC.Yi/CC.Yi.ViewModel/CC.Yi.ViewModel.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Library - netcoreapp3.1 - - - diff --git a/CC.Yi/CC.Yi.ViewModel/Enum/DelFlagEnum.cs b/CC.Yi/CC.Yi.ViewModel/Enum/DelFlagEnum.cs deleted file mode 100644 index 20f26792..00000000 --- a/CC.Yi/CC.Yi.ViewModel/Enum/DelFlagEnum.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.ViewModel.Enum -{ - public enum DelFlagEnum - { - Normal=0, - Deleted=1 - } -} diff --git a/CC.Yi/CC.Yi.ViewModel/setByIds.cs b/CC.Yi/CC.Yi.ViewModel/setByIds.cs deleted file mode 100644 index 5a41de04..00000000 --- a/CC.Yi/CC.Yi.ViewModel/setByIds.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace CC.Yi.ViewModel -{ - public class setByIds - { - public int id { get; set; } - public List ids { get; set; } - } -} diff --git a/CC.Yi/CC.Yi.sln b/CC.Yi/CC.Yi.sln deleted file mode 100644 index 0a085b83..00000000 --- a/CC.Yi/CC.Yi.sln +++ /dev/null @@ -1,87 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30907.101 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DAL", "DAL", "{9D0D4A54-057E-46C3-BBFE-CA01F7ECEDAE}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BLL", "BLL", "{CC5F4204-DFB6-4BB5-9E49-BED084063ED8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "API", "API", "{1A509C83-F994-4422-A74F-8FFA4805D849}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.API", "CC.Yi.API\CC.Yi.API.csproj", "{CDB5556F-43FF-44F6-B33D-AC642E5CD30C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.BLL", "CC.Yi.BLL\CC.Yi.BLL.csproj", "{AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.IBLL", "CC.Yi.IBLL\CC.Yi.IBLL.csproj", "{74177F89-72D5-45FE-8A4F-91FAD9E03D36}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.DAL", "CC.Yi.DAL\CC.Yi.DAL.csproj", "{72FD0850-15FA-4A6F-B865-E1B38603307D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.IDAL", "CC.Yi.IDAL\CC.Yi.IDAL.csproj", "{BD77D98A-9F28-4C2D-A260-C3BB919B58E7}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{123D1D39-849C-4220-A973-EB9760421CB3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Model", "Model", "{38B8D898-4BBF-4DDB-8E29-6D6CEB7808C9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.Model", "CC.Yi.Model\CC.Yi.Model.csproj", "{8827547B-E04B-4430-A0DF-E87FCA40E3AB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.ViewModel", "CC.Yi.ViewModel\CC.Yi.ViewModel.csproj", "{32F323F1-E2FA-4186-AC33-263465012D15}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Yi.Common", "CC.Yi.Common\CC.Yi.Common.csproj", "{9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C}.Release|Any CPU.Build.0 = Release|Any CPU - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6}.Release|Any CPU.Build.0 = Release|Any CPU - {74177F89-72D5-45FE-8A4F-91FAD9E03D36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {74177F89-72D5-45FE-8A4F-91FAD9E03D36}.Debug|Any CPU.Build.0 = Debug|Any CPU - {74177F89-72D5-45FE-8A4F-91FAD9E03D36}.Release|Any CPU.ActiveCfg = Release|Any CPU - {74177F89-72D5-45FE-8A4F-91FAD9E03D36}.Release|Any CPU.Build.0 = Release|Any CPU - {72FD0850-15FA-4A6F-B865-E1B38603307D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {72FD0850-15FA-4A6F-B865-E1B38603307D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {72FD0850-15FA-4A6F-B865-E1B38603307D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {72FD0850-15FA-4A6F-B865-E1B38603307D}.Release|Any CPU.Build.0 = Release|Any CPU - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7}.Release|Any CPU.Build.0 = Release|Any CPU - {8827547B-E04B-4430-A0DF-E87FCA40E3AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8827547B-E04B-4430-A0DF-E87FCA40E3AB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8827547B-E04B-4430-A0DF-E87FCA40E3AB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8827547B-E04B-4430-A0DF-E87FCA40E3AB}.Release|Any CPU.Build.0 = Release|Any CPU - {32F323F1-E2FA-4186-AC33-263465012D15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32F323F1-E2FA-4186-AC33-263465012D15}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32F323F1-E2FA-4186-AC33-263465012D15}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32F323F1-E2FA-4186-AC33-263465012D15}.Release|Any CPU.Build.0 = Release|Any CPU - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {CDB5556F-43FF-44F6-B33D-AC642E5CD30C} = {1A509C83-F994-4422-A74F-8FFA4805D849} - {AE9B4D8A-0CED-49D1-81C7-EBD221E41AB6} = {CC5F4204-DFB6-4BB5-9E49-BED084063ED8} - {74177F89-72D5-45FE-8A4F-91FAD9E03D36} = {CC5F4204-DFB6-4BB5-9E49-BED084063ED8} - {72FD0850-15FA-4A6F-B865-E1B38603307D} = {9D0D4A54-057E-46C3-BBFE-CA01F7ECEDAE} - {BD77D98A-9F28-4C2D-A260-C3BB919B58E7} = {9D0D4A54-057E-46C3-BBFE-CA01F7ECEDAE} - {8827547B-E04B-4430-A0DF-E87FCA40E3AB} = {38B8D898-4BBF-4DDB-8E29-6D6CEB7808C9} - {32F323F1-E2FA-4186-AC33-263465012D15} = {38B8D898-4BBF-4DDB-8E29-6D6CEB7808C9} - {9D6E5DD7-FA02-4532-8BAC-406FB80AFEAC} = {123D1D39-849C-4220-A973-EB9760421CB3} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {22DD3529-6AD4-413A-B7B3-D8335E6F47C9} - EndGlobalSection -EndGlobal diff --git a/CC.Yi/T4Model/T4Model.txt b/CC.Yi/T4Model/T4Model.txt deleted file mode 100644 index 36227abb..00000000 --- a/CC.Yi/T4Model/T4Model.txt +++ /dev/null @@ -1 +0,0 @@ -student \ No newline at end of file diff --git a/CC.Yi/T4Model/T4Vue.txt b/CC.Yi/T4Model/T4Vue.txt deleted file mode 100644 index 9b429e0a..00000000 --- a/CC.Yi/T4Model/T4Vue.txt +++ /dev/null @@ -1,4 +0,0 @@ -student -id,name -id,姓名 -"0","张三" \ No newline at end of file diff --git a/CC.Yi/T4Model/说明.txt b/CC.Yi/T4Model/说明.txt deleted file mode 100644 index 7abbdd18..00000000 --- a/CC.Yi/T4Model/说明.txt +++ /dev/null @@ -1,5 +0,0 @@ -这里存放T4要生成的模型 -使用英文的 , 分隔 -例如: -student,teacher -点击 生成->转换所有t4模板 即可完成生成 \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs deleted file mode 100644 index 32d475a2..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs +++ /dev/null @@ -1,222 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common; -using Yi.Framework.Common.Const; -using Yi.Framework.Common.Helper; -using Yi.Framework.Common.Models; -using Yi.Framework.Common.QueueModel; -using Yi.Framework.Core; -using Yi.Framework.DTOModel; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; -using Yi.Framework.WebCore; - -namespace Yi.Framework.ApiMicroservice.Controllers -{ - [ApiController] - [Route("api/[controller]/[action]")] - public class AccountController : Controller - { - private readonly ILogger _logger; - - private IUserService _userService; - private IMenuService _menuService; - private RabbitMQInvoker _rabbitMQInvoker; - private CacheClientDB _cacheClientDB; - private IRoleService _roleService; - private IHttpContextAccessor _httpContext; - public AccountController(ILogger logger, IUserService userService, IMenuService menuService,RabbitMQInvoker rabbitMQInvoker,CacheClientDB cacheClientDB, IRoleService roleService, IHttpContextAccessor httpContext) - { - _logger = logger; - _userService = userService; - _menuService = menuService; - _rabbitMQInvoker = rabbitMQInvoker; - _cacheClientDB = cacheClientDB; - _roleService = roleService; - _httpContext = httpContext; - } - - - /// - /// 登录方法,要返回data:{user,token} token - /// - /// - /// - [HttpPost] - public async Task Login(user _user) - { - var user_data = await _userService.Login(_user); - if (user_data == null) - { - return Result.Error("该用户不存在"); - } - var menuList = await _menuService.GetTopMenuByUserId(user_data.id); - if ( user_data!=null) - { - var token = MakeJwt.app(new jwtUser() {user=user_data,menuIds= menuList}); - - JobModel.visitNum += 1; - return Result.Success().SetData(new { user = new { user_data.id, user_data.username, user_data.introduction, user_data.icon, user_data.nick }, token }); - } - return Result.Error(); - } - - /// - /// 不用写,单纯制作日志 - /// - /// - [HttpPost] - public Result Logout() - { - return Result.Success(); - } - - /// - /// code为验证码,从redis中判断一下code是否正确 - /// - /// - /// - /// - [HttpPost] - public async Task Register(user _user, string code) - { - _user.username=_user.username.Trim(); - if(string.IsNullOrEmpty(_user.username)) - code = code.Trim(); - - string trueCode= _cacheClientDB.Get(RedisConst.keyCode + _user.phone); - if (code == trueCode) - { - //设置默认头像 - var setting = JsonHelper.StrToObj(_cacheClientDB.Get(RedisConst.key)); - _user.icon = setting.InitIcon; - _user.ip = _httpContext.HttpContext.Request.Headers["X-Real-IP"].FirstOrDefault();//通过上下文获取ip - //设置默认角色 - if (string.IsNullOrEmpty(setting.InitRole)) - { - return Result.Error("无默认角色,请初始化数据库"); - } - _user.roles = new List(); - _user.roles.Add(await _roleService.GetEntity(u => u.role_name == setting.InitRole)); - await _userService.Register(_user); - - return Result.Success("恭喜,你已加入我们!"); - } - return Result.Error("验证码有误,请重新输入!"); - } - - - /// - /// 发送短信,需要将生成的sms+code存入redis - /// - /// - /// - [HttpPost] - public async Task SendSMS(string SMSAddress) - { - if (string.IsNullOrEmpty(SMSAddress)) - { - return Result.Error("请输入电话号码"); - } - SMSAddress = SMSAddress.Trim(); - if (!await _userService.PhoneIsExsit(SMSAddress)) - { - SMSQueueModel sMSQueueModel = new SMSQueueModel(); - sMSQueueModel.phone = SMSAddress; - sMSQueueModel.code =RandomHelper.GenerateCheckCodeNum(6); - - //10分钟过期 - _cacheClientDB.Set(RedisConst.keyCode+sMSQueueModel.phone, sMSQueueModel.code, TimeSpan.FromMinutes(10)); - - _rabbitMQInvoker.Send(new Common.IOCOptions.RabbitMQConsumerModel() { ExchangeName = RabbitConst.SMS_Exchange, QueueName = RabbitConst.SMS_Queue_Send }, JsonHelper.ObjToStr(sMSQueueModel)); - return Result.Success("发送短信成功,10分钟后过期,请留意短信接收"); - } - return Result.Error("该号码已被注册"); - } - - /// - /// 发送邮箱,需要先到数据库判断该邮箱是否被人注册过,到userservice写mail_exist方法,还有接口别忘了。 - /// - /// - /// - [HttpPost]//邮箱验证 - public async Task Email(string emailAddress) - { - emailAddress = emailAddress.Trim().ToLower(); - //先判断邮箱是否被注册使用过,如果被使用过,便不让操作 - if (!await _userService.EmailIsExsit(emailAddress)) - { - string code = RandomHelper.GenerateRandomLetter(6); - code = code.ToUpper();//全部转为大写 - EmailHelper.sendMail(code, emailAddress); - - //我要把邮箱和对应的code加进到数据库,还有申请时间 - //设置10分钟过期 - //set不存在便添加,如果存在便替换 - //CacheHelper.SetCache(emailAddress, code, TimeSpan.FromSeconds(10)); - - return Result.Success("发送邮件成功,请查看邮箱(可能在垃圾箱)"); - } - else - { - return Result.Error("该邮箱已被注册"); - } - // 邮箱和验证码都要被记住,然后注册时候比对邮箱和验证码是不是都和现在生成的一样 - } - /// - /// 修改密码 - /// - /// - /// - [HttpPut] - [Authorize] - public async Task ChangePassword(ChangePwdDto pwdDto) - { - var user_data = await _userService.GetUserById(pwdDto.user.id); - string msg = "修改成功"; - if (! string.IsNullOrEmpty( pwdDto.newPassword)) - { - if (user_data.password == pwdDto.user.password) - { - - user_data.password = pwdDto.newPassword; - user_data.phone = pwdDto.user.phone; - user_data.introduction = pwdDto.user.introduction; - user_data.email = pwdDto.user.email; - user_data.age = pwdDto.user.age; - user_data.address = pwdDto.user.address; - user_data.nick = pwdDto.user.nick; - - - await _userService.UpdateAsync(user_data); - user_data.password = null; - return Result.Success(msg); - } - else - { - msg = "密码错误"; - return Result.Error(msg); - } - } - - user_data.phone = pwdDto.user.phone; - user_data.introduction = pwdDto.user.introduction; - user_data.email = pwdDto.user.email; - user_data.age = pwdDto.user.age; - user_data.address = pwdDto.user.address; - user_data.nick = pwdDto.user.nick; - - await _userService.UpdateAsync(user_data); - - - return Result.Success(msg); - } - - } -} \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/FileController.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/FileController.cs deleted file mode 100644 index 8dcae4c7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/FileController.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Hosting; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; -using Yi.Framework.Interface; -using Yi.Framework.WebCore; - -namespace Yi.Framework.ApiMicroservice.Controllers -{ - [Route("api/[controller]/[action]")] - [ApiController] - public class FileController : ControllerBase - { - private IUserService _userService; - private readonly IHostEnvironment _env; - public FileController(IUserService userService, IHostEnvironment env) - { - _userService = userService; - _env = env; - } - [HttpPost] - [Authorize] - public async Task EditIcon(IFormFile file) - { - try - { - var _user = HttpContext.GetCurrentUserInfo(); - var user_data = await _userService.GetUserById(_user.id); - var type = "image"; - var filename = await Upload(type, file); - user_data.icon = filename; - await _userService.UpdateAsync(user_data); - return Result.Success(); - } - catch - { - return Result.Error(); - } - } - - [Route("/api/{type}/{fileName}")] - [HttpGet] - public IActionResult Get(string type, string fileName) - { - try - { - var path = Path.Combine($"wwwroot/{type}", fileName); - var stream = System.IO.File.OpenRead(path); - var MimeType = Common.Helper.MimeHelper.GetMimeMapping(fileName); - return new FileStreamResult(stream, MimeType); - } - catch - { - return new NotFoundResult(); - } - } - - /// - /// 该方法不对外暴露 - /// - /// - /// - /// - private async Task Upload(string type, IFormFile file) - { - string filename = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName); - using (var stream = new FileStream(Path.Combine($"wwwroot/{type}", filename), FileMode.CreateNew, FileAccess.Write)) - { - await file.CopyToAsync(stream); - } - - return filename; - } - - [HttpGet] - public async Task ExportFile() - { - var userdata = await _userService.GetAllEntitiesTrueAsync(); - var userList = userdata.ToList(); - List header = new() { "用户", "密码", "头像", "昵称", "邮箱", "ip", "年龄", "个人介绍", "地址", "手机", "角色" }; - var filename = Common.Helper.ExcelHelper.CreateExcelFromList(userList, header, _env.ContentRootPath.ToString()); - var MimeType = Common.Helper.MimeHelper.GetMimeMapping(filename); - return new FileStreamResult(new FileStream(Path.Combine(_env.ContentRootPath+@"/wwwroot/Excel", filename), FileMode.Open),MimeType); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/JobController.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/JobController.cs deleted file mode 100644 index 84566713..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/JobController.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common; -using Yi.Framework.Common.Const; -using Yi.Framework.Common.Helper; -using Yi.Framework.Common.Models; -using Yi.Framework.Core; -using Yi.Framework.DTOModel; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.ApiMicroservice.Controllers -{ - [ApiController] - [Route("api/[controller]/[action]")] - public class JobController : Controller - { - private readonly ILogger _logger; - private QuartzInvoker _quartzInvoker; - public JobController(ILogger logger,QuartzInvoker quartzInvoker) - { - _logger = logger; - _quartzInvoker = quartzInvoker; - } - - /// - /// - /// - /// - [HttpPost] - public async Task startJob() - { - //任务1 - //await _quartzInvoker.start("*/1 * * * * ? ", new Quartz.JobKey("test", "my"), "VisitJob"); - - //任务2 - Dictionary data = new Dictionary() - { - {JobConst.method,"get" }, - {JobConst.url,"https://www.baidu.com" } - }; - await _quartzInvoker.start("*/1 * * * * ? ", new Quartz.JobKey("test", "my"), "HttpJob",data: data); - return Result.Success(); - } - - /// - /// - /// - /// - [HttpGet] - public async Task getRunJobList() - { - return Result.Success().SetData(await _quartzInvoker.getRunJobList()); - } - - /// - /// - /// - /// - [HttpGet] - public Result getJobClass() - { - return Result.Success().SetData(_quartzInvoker.getJobClassList()); - } - - /// - /// - /// - /// - [HttpPut] - public async Task stopJob() - { - await _quartzInvoker.Stop(new Quartz.JobKey("test", "my")); - return Result.Success(); - } - - /// - /// - /// - /// - [HttpDelete] - public async Task DeleteJob() - { - await _quartzInvoker.Delete(new Quartz.JobKey("test", "my")); - return Result.Success(); - } - - /// - /// - /// - /// - [HttpPut] - public async Task ResumeJob() - { - await _quartzInvoker.Resume(new Quartz.JobKey("test", "my")); - return Result.Success(); - } - } -} \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs deleted file mode 100644 index ce14e68b..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs +++ /dev/null @@ -1,113 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; -using Yi.Framework.DTOModel; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; -using Yi.Framework.WebCore; - -namespace Yi.Framework.ApiMicroservice.Controllers -{ - [Route("api/[controller]/[action]")] - [ApiController] - [Authorize] - public class MenuController : ControllerBase - { - private IMenuService _menuService; - public MenuController(IMenuService menuService) - { - _menuService = menuService; - } - /// - /// 这个是要递归的,但是要过滤掉删除的,所以,可以写一个通用过滤掉删除的方法 - /// - /// - [HttpGet] - public async Task GetMenuInMould() - { - return Result.Success().SetData(await _menuService.GetMenuInMould()); - } - - /// - /// 更 - /// - /// - /// - [HttpPut] - public async Task UpdateMenu(menu _menu) - { - await _menuService.UpdateAsync(_menu); - return Result.Success(); - - } - - /// - /// 删 - /// - /// - /// - [HttpDelete] - public async Task DelListMenu(List _ids) - { - await _menuService.DelListByUpdateAsync(_ids); - return Result.Success(); - } - - /// - /// 增 - /// 现在,top菜单只允许为一个 - /// - /// - /// - [HttpPost] - public async Task AddTopMenu(menu _menu) - { - await _menuService.AddTopMenu(_menu); - return Result.Success(); - } - - /// - /// 给一个菜单设置一个接口,Id1为菜单id,Id2为接口id - /// 用于给菜单设置接口 - /// - /// - /// - [HttpPost] - public async Task SetMouldByMenu(IdDto idDto) - { - await _menuService.SetMouldByMenu(idDto.id1, idDto.id2); - return Result.Success(); - } - - - /// - /// 给一个菜单添加子节点(注意:添加,不是覆盖) - /// - /// - /// - [HttpPost] - public async Task AddChildrenMenu(ChildrenDto childrenDto) - { - await _menuService.AddChildrenMenu(childrenDto.parentId, childrenDto.data); - return Result.Success(); - } - - /// - /// 获取用户的目录菜单,不包含接口 - /// 用于账户信息页面,显示这个用户有哪些菜单,需要并列 - /// - /// - [HttpGet] - public async Task GetTopMenusByHttpUser() - { - HttpContext.GetCurrentUserInfo(out List menuIds); - - return Result.Success().SetData(await _menuService.GetTopMenusByTopMenuIds(menuIds)); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs deleted file mode 100644 index 7c0ee94a..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.ApiMicroservice.Controllers -{ - [Route("api/[controller]/[action]")] - [ApiController] - [Authorize] - public class MouldController : ControllerBase - { - private IMouldService _mouldService; - public MouldController(IMouldService mouldService) - { - _mouldService = mouldService; - } - [HttpGet] - public async Task GetMould() - { - return Result.Success().SetData(await _mouldService.GetAllEntitiesTrueAsync()); - } - - /// - /// 更 - /// - /// - /// - [HttpPut] - public async Task UpdateMould(mould _mould) - { - await _mouldService.UpdateAsync(_mould); - return Result.Success(); - - } - - /// - /// 删 - /// - /// - /// - [HttpDelete] - public async Task DelListMould(List _ids) - { - await _mouldService.DelListByUpdateAsync(_ids); - return Result.Success(); - } - - /// - /// 增 - /// - /// - /// - [HttpPost] - public async Task AddMould(mould _mould) - { - await _mouldService.AddAsync(_mould); - return Result.Success(); - } - - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs deleted file mode 100644 index 46fe2cc3..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; -using Yi.Framework.DTOModel; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; -using Yi.Framework.WebCore; - -namespace Yi.Framework.ApiMicroservice.Controllers -{ - [Route("api/[controller]/[action]")] - [ApiController] - [Authorize] - public class RoleController : ControllerBase - { - private IRoleService _roleService; - public RoleController(IRoleService roleService) - { - _roleService = roleService; - } - [HttpGet] - public async Task GetRole() - { - return Result.Success().SetData(await _roleService.GetAllEntitiesTrueAsync()); - } - - - /// - /// 更 - /// - /// - /// - [HttpPut] - public async Task UpdateRole(role _role) - { - await _roleService.UpdateAsync(_role); - return Result.Success(); - - } - - /// - /// 删 - /// - /// - /// - [HttpDelete] - public async Task DelListRole(List _ids) - { - await _roleService.DelListByUpdateAsync(_ids); - return Result.Success(); - } - - /// - /// 增 - /// - /// - /// - [HttpPost] - public async Task AddRole(role _role) - { - await _roleService.AddAsync(_role); - return Result.Success(); - } - - /// - /// 根据用户id得到该用户有哪些角色 - /// 用于显示用户详情中的角色说明 - /// - /// - [HttpGet] - public async Task GetRolesByUserId(int userId) - { - - return Result.Success().SetData(await _roleService.GetRolesByUserId(userId)); - } - /// - /// 给角色设置菜单,多个角色与多个菜单,让每一个角色都设置,ids1为角色,ids2为菜单 - /// 用于设置角色 - /// - /// - /// - [HttpPost] - public async Task SetMenuByRole(IdsListDto idsListDto) - { - await _roleService.SetMenusByRolesId(idsListDto.ids2, idsListDto.ids1); - return Result.Success(); - } - /// - /// 用于给角色设置菜单的时候,点击一个角色,显示这个角色拥有的并列的菜单 - /// - /// - /// - [HttpGet] - public async Task GetTopMenusByRoleId(int roleId) - { - - return Result.Success().SetData(await _roleService.GetTopMenusByRoleId(roleId) ); ; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs deleted file mode 100644 index d101bc9d..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/SettingController.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Const; -using Yi.Framework.Common.Models; -using Yi.Framework.Core; -using Yi.Framework.DTOModel; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; -using Yi.Framework.WebCore; - -namespace Yi.Framework.ApiMicroservice.Controllers -{ - [ApiController] - [Route("api/[controller]/[action]")] - [Authorize] - public class SettingController : ControllerBase - { - private readonly ILogger _logger; - private readonly CacheClientDB _cacheClientDB; - - public SettingController(ILogger logger, CacheClientDB cacheClientDB) - { - _logger = logger; - _cacheClientDB = cacheClientDB; - } - - - - /// - /// 查 - /// - /// - [HttpGet] - public Result GetSetting() - { - var setDto = Common.Helper.JsonHelper.StrToObj(_cacheClientDB.Get(RedisConst.key)); - return Result.Success().SetData( setDto); - } - - /// - /// 更 - /// - /// - /// - [HttpPut] - public Result UpdateSetting(SettingDto settingDto) - { - var setDto = Common.Helper.JsonHelper.ObjToStr(settingDto); - - _cacheClientDB.Set(RedisConst.key, setDto); - return Result.Success(); - - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/UserController.cs deleted file mode 100644 index c552a081..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Controllers/UserController.cs +++ /dev/null @@ -1,147 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; -using Yi.Framework.DTOModel; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; -using Yi.Framework.WebCore; - -namespace Yi.Framework.ApiMicroservice.Controllers -{ - [ApiController] - [Route("api/[controller]/[action]")] - [Authorize] - public class UserController : ControllerBase - { - private readonly ILogger _logger; - - private IUserService _userService; - public UserController(ILogger logger, IUserService userService) - { - _logger = logger; - _userService = userService; - } - - /// - /// 查 - /// - /// - [HttpGet] - public async Task GetUser() - { - return Result.Success().SetData(await _userService.GetAllEntitiesTrueAsync()); - } - - /// - /// 更 - /// - /// - /// - [HttpPut] - public async Task UpdateUser(user _user) - { - await _userService.UpdateAsync(_user); - return Result.Success(); - - } - - /// - /// 删 - /// - /// - /// - [HttpDelete] - public async Task DelListUser(List _ids) - { - await _userService.DelListByUpdateAsync(_ids); - return Result.Success(); - } - - /// - /// 增 - /// - /// - /// - [HttpPost] - public async Task AddUser(user _user) - { - await _userService.AddAsync(_user); - return Result.Success(); - } - - - /// - /// SetRoleByUser - /// 给多个用户设置多个角色,ids有用户id与 角色列表ids,多对多,ids1用户,ids2为角色 - /// 用户设置给用户设置角色 - /// - /// - /// - [HttpPost] - public async Task SetRoleByUser(IdsListDto idsListDto) - { - await _userService.SetRoleByUser(idsListDto.ids2, idsListDto.ids1); - return Result.Success(); - } - - /// - /// 根据http上下文的用户得到该用户信息,关联角色 - /// 用于显示账号信息页中的用户信息和角色信息 - /// - /// - [HttpGet] - public async Task GetUserInRolesByHttpUser() - { - var _user = HttpContext.GetCurrentUserInfo(); - return Result.Success().SetData( await _userService.GetUserInRolesByHttpUser(_user.id)); - } - - /// - /// 得到登录用户的递归菜单,放到导航栏 - /// 用户放到导航栏中 - /// - /// - [HttpGet] - public async Task GetMenuByHttpUser() - { - HttpContext.GetCurrentUserInfo(out var allMenuIds); - return Result.Success().SetData(await _userService.GetMenuByHttpUser(allMenuIds)); - } - - /// - /// 得到请求模型 - /// - /// - /// - [HttpGet] - public async Task GetAxiosByRouter(string router) - { - - var _user = HttpContext.GetCurrentUserInfo(out List menuIds); - if (menuIds == null) - { - return Result.Error(); - } - var menuList= await _userService.GetAxiosByRouter(router, _user.id, menuIds); - AxiosUrlsModel urlsModel = new(); - menuList.ForEach(u => - { - switch (u.menu_name) - { - case "get":urlsModel.get = u.mould.url;break; - case "del": urlsModel.del = u.mould.url; break; - case "add": urlsModel.add = u.mould.url; break; - case "update": urlsModel.update = u.mould.url; break; - } - }); - - return Result.Success().SetData(urlsModel); - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Log4net.config b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Log4net.config deleted file mode 100644 index 958c7e78..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Log4net.config +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Program.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Program.cs deleted file mode 100644 index b9a68835..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Program.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Autofac.Extensions.DependencyInjection; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.WebCore.BuilderExtend; - -namespace Yi.Framework.ApiMicroservice -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - - .ConfigureAppConfiguration((hostBuilderContext, configurationBuilder) => - { - configurationBuilder.AddCommandLine(args); - configurationBuilder.AddJsonFileService(); - #region - //Apollo - #endregion - configurationBuilder.AddApolloService("Yi"); - }) - .ConfigureLogging(loggingBuilder => - { - loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddLog4Net(); - }) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }).UseServiceProviderFactory(new AutofacServiceProviderFactory()); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Startup.cs b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Startup.cs deleted file mode 100644 index bde35395..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Startup.cs +++ /dev/null @@ -1,180 +0,0 @@ -using Autofac; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Yi.Framework.Core; -using Yi.Framework.Model.ModelFactory; -using Yi.Framework.WebCore.BuilderExtend; -using Yi.Framework.WebCore.MiddlewareExtend; -using Yi.Framework.WebCore.Utility; - -namespace Yi.Framework.ApiMicroservice -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - #region - //Ioc - #endregion - services.AddIocService(Configuration); - - #region - //Quartz - #endregion - services.AddQuartzService(); - - #region - //+ - #endregion - services.AddControllers(optios=> { - //optios.Filters.Add(typeof(CustomExceptionFilterAttribute)); - }).AddJsonFileService(); - - #region - //Swagger - #endregion - services.AddSwaggerService(); - - #region - // - #endregion - services.AddCorsService(); - - #region - //JwtȨ - #endregion - services.AddJwtService(); - - #region - //ݿ - #endregion - services.AddDbService(); - - #region - //Redis - #endregion - services.AddRedisService(); - - #region - //RabbitMQ - #endregion - services.AddRabbitMQService(); - - #region - //ElasticSeach - #endregion - services.AddElasticSeachService(); - - #region - //ŷ - #endregion - services.AddSMSService(); - - #region - //CAP - #endregion - services.AddCAPService(); - } - - #region Autofacע - public void ConfigureContainer(ContainerBuilder containerBuilder) - { - #region - //Moduleע - #endregion - containerBuilder.RegisterModule(); - } - #endregion - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env,IDbContextFactory _DbFactory, CacheClientDB _cacheClientDB) - { - //if (env.IsDevelopment()) - { - #region - //ҳע - #endregion - app.UseDeveloperExceptionPage(); - - #region - //Swaggerע - #endregion - app.UseSwaggerService(); - } - #region - //ץȡע - #endregion - app.UseErrorHandlingService(); - - #region - //̬ļע - #endregion - //app.UseStaticFiles(); - - #region - //HttpsRedirectionע - #endregion - app.UseHttpsRedirection(); - - #region - //·ע - #endregion - app.UseRouting(); - - #region - //ע - #endregion - app.UseCorsService(); - - #region - //ע - #endregion - app.UseHealthCheckMiddleware(); - - #region - //Ȩע - #endregion - app.UseAuthentication(); - - #region - //Ȩע - #endregion - app.UseAuthorization(); - - #region - //Consulע - #endregion - app.UseConsulService(); - - #region - //ݿע - #endregion - app.UseDbSeedInitService(_DbFactory); - - #region - //redisע - #endregion - app.UseRedisSeedInitService(_cacheClientDB); - - #region - //Endpointsע - #endregion - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - - }); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/SwaggerDoc.xml b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/SwaggerDoc.xml deleted file mode 100644 index 3173de6a..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/SwaggerDoc.xml +++ /dev/null @@ -1,278 +0,0 @@ - - - - Yi.Framework.ApiMicroservice - - - - - 登录方法,要返回data:{user,token} token - - - - - - - 不用写,单纯制作日志 - - - - - - code为验证码,从redis中判断一下code是否正确 - - - - - - - - 发送短信,需要将生成的sms+code存入redis - - - - - - - 发送邮箱,需要先到数据库判断该邮箱是否被人注册过,到userservice写mail_exist方法,还有接口别忘了。 - - - - - - - 修改密码 - - - - - - - 该方法不对外暴露 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 这个是要递归的,但是要过滤掉删除的,所以,可以写一个通用过滤掉删除的方法 - - - - - - 更 - - - - - - - 删 - - - - - - - 增 - 现在,top菜单只允许为一个 - - - - - - - 给一个菜单设置一个接口,Id1为菜单id,Id2为接口id - 用于给菜单设置接口 - - - - - - - 给一个菜单添加子节点(注意:添加,不是覆盖) - - - - - - - 获取用户的目录菜单,不包含接口 - 用于账户信息页面,显示这个用户有哪些菜单,需要并列 - - - - - - 更 - - - - - - - 删 - - - - - - - 增 - - - - - - - 更 - - - - - - - 删 - - - - - - - 增 - - - - - - - 根据用户id得到该用户有哪些角色 - 用于显示用户详情中的角色说明 - - - - - - 给角色设置菜单,多个角色与多个菜单,让每一个角色都设置,ids1为角色,ids2为菜单 - 用于设置角色 - - - - - - - 用于给角色设置菜单的时候,点击一个角色,显示这个角色拥有的并列的菜单 - - - - - - - 查 - - - - - - 更 - - - - - - - 查 - - - - - - 更 - - - - - - - 删 - - - - - - - 增 - - - - - - - SetRoleByUser - 给多个用户设置多个角色,ids有用户id与 角色列表ids,多对多,ids1用户,ids2为角色 - 用户设置给用户设置角色 - - - - - - - 根据http上下文的用户得到该用户信息,关联角色 - 用于显示账号信息页中的用户信息和角色信息 - - - - - - 得到登录用户的递归菜单,放到导航栏 - 用户放到导航栏中 - - - - - - 得到请求模型 - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj deleted file mode 100644 index 2290e099..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/Yi.Framework.ApiMicroservice.csproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - net5.0 - - - - D:\CC.Yi\CC.Yi\Yi.Framework\Yi.Framework.ApiMicroservice\SwaggerDoc.xml - 1701;1702;CS1591 - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/Excel/Excel_20211102231510.xlsx b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/Excel/Excel_20211102231510.xlsx deleted file mode 100644 index f1634a6f..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/Excel/Excel_20211102231510.xlsx and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/Excel/Excel_20211102232113.xlsx b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/Excel/Excel_20211102232113.xlsx deleted file mode 100644 index 428fa119..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/Excel/Excel_20211102232113.xlsx and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/0a5221e4-dca6-4d4e-8486-acf86822f2e4.jpg b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/0a5221e4-dca6-4d4e-8486-acf86822f2e4.jpg deleted file mode 100644 index 0e7512ee..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/0a5221e4-dca6-4d4e-8486-acf86822f2e4.jpg and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/1b0a926d-ddce-4048-9b09-e2b8ec37c161.jpg b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/1b0a926d-ddce-4048-9b09-e2b8ec37c161.jpg deleted file mode 100644 index aa4daf73..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/1b0a926d-ddce-4048-9b09-e2b8ec37c161.jpg and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/3d6ed457-0c20-4ce6-b91c-8c424f2f03bb.jpeg b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/3d6ed457-0c20-4ce6-b91c-8c424f2f03bb.jpeg deleted file mode 100644 index a1070258..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/3d6ed457-0c20-4ce6-b91c-8c424f2f03bb.jpeg and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/6312706b-7013-4aa5-af3c-0bbb6b3f4804.jpg b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/6312706b-7013-4aa5-af3c-0bbb6b3f4804.jpg deleted file mode 100644 index b1bdce5b..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/6312706b-7013-4aa5-af3c-0bbb6b3f4804.jpg and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/7ca98a58-8822-40f5-a766-2a2dd21d2431.jpg b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/7ca98a58-8822-40f5-a766-2a2dd21d2431.jpg deleted file mode 100644 index aa4daf73..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/7ca98a58-8822-40f5-a766-2a2dd21d2431.jpg and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/966200f6-265c-4470-ad20-c91c3d84a1cc.jpg b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/966200f6-265c-4470-ad20-c91c3d84a1cc.jpg deleted file mode 100644 index 0e7512ee..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/966200f6-265c-4470-ad20-c91c3d84a1cc.jpg and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/feae1964-04ce-464b-848b-86f2245f3f63.jpeg b/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/feae1964-04ce-464b-848b-86f2245f3f63.jpeg deleted file mode 100644 index 76a391b4..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.ApiMicroservice/wwwroot/image/feae1964-04ce-464b-848b-86f2245f3f63.jpeg and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Controllers/WeatherForecastController.cs b/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Controllers/WeatherForecastController.cs deleted file mode 100644 index 3eeeea74..00000000 --- a/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.AuthenticationCenter.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Program.cs b/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Program.cs deleted file mode 100644 index e75b3a47..00000000 --- a/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Program.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.AuthenticationCenter -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Startup.cs b/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Startup.cs deleted file mode 100644 index 6c28a88d..00000000 --- a/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Startup.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Microsoft.OpenApi.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.AuthenticationCenter -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - - services.AddControllers(); - services.AddSwaggerGen(c => - { - c.SwaggerDoc("v1", new OpenApiInfo { Title = "Yi.Framework.AuthenticationCenter", Version = "v1" }); - }); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - app.UseSwagger(); - app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework.AuthenticationCenter v1")); - } - - app.UseHttpsRedirection(); - - app.UseRouting(); - - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Yi.Framework.AuthenticationCenter.csproj b/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Yi.Framework.AuthenticationCenter.csproj deleted file mode 100644 index 28847161..00000000 --- a/Yi.Framework.Net5/Yi.Framework.AuthenticationCenter/Yi.Framework.AuthenticationCenter.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - net5.0 - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Const/DbConst.cs b/Yi.Framework.Net5/Yi.Framework.Common/Const/DbConst.cs deleted file mode 100644 index 99950713..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Const/DbConst.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Const -{ - public class DbConst - { - public const string Mysql = "Mysql"; - public const string Sqlite = "Sqlite"; - public const string Sqlserver = "Sqlserver"; - public const string Oracle = "Oracle"; - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Const/FileConst.cs b/Yi.Framework.Net5/Yi.Framework.Common/Const/FileConst.cs deleted file mode 100644 index a7ae7119..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Const/FileConst.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Const -{ - public class FileConst - { - public const string Image = "Image"; - public const string File = "File"; - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Const/JobConst.cs b/Yi.Framework.Net5/Yi.Framework.Common/Const/JobConst.cs deleted file mode 100644 index ce81cb0a..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Const/JobConst.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Const -{ - public class JobConst - { - - public const string url = nameof(url); - - public const string method = nameof(method); - } - -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Const/JwtConst.cs b/Yi.Framework.Net5/Yi.Framework.Common/Const/JwtConst.cs deleted file mode 100644 index 7ea25ea2..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Const/JwtConst.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Yi.Framework.Common.Const -{ - public class JwtConst - { - public const string SecurityKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB"; - public const string Domain = "https://localhost:44329"; - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Const/RabbitConst.cs b/Yi.Framework.Net5/Yi.Framework.Common/Const/RabbitConst.cs deleted file mode 100644 index cb7f294e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Const/RabbitConst.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Const -{ - public class RabbitConst - { - private const string prefix = "Yi.Framework."; - public const string SMS_Exchange = prefix+"SMS.Exchange"; - public const string SMS_Queue_Send = prefix+ "SMS.Queue.Send"; - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Const/RedisConst.cs b/Yi.Framework.Net5/Yi.Framework.Common/Const/RedisConst.cs deleted file mode 100644 index 1c59a4db..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Const/RedisConst.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Const -{ - public class RedisConst - { - /// - /// 前缀 - /// - public const string key = "YiFramework:data"; - - public const string keyCode = "YiFramework:code"; - ///// - ///// 初始化角色名 - ///// - //public const string InitRole_key = nameof(InitRole_key); - - ///// - ///// 标题名 - ///// - //public const string Title_key = nameof(Title_key); - - ///// - ///// 图片列表名 - ///// - //public const string ImageList_key = nameof(ImageList_key); - - //public static Dictionary stringData = new Dictionary() - //{ - // {prefix+nameof(InitRole_key), "普通用户"}, - // {prefix+nameof(Title_key), "YiFramework"}, - //}; - - //public static Dictionary> listData = new Dictionary>() - //{ - // {prefix+nameof(ImageList_key), new List(){"图片地址1", "图片地址2", "图片地址3", "图片地址4" } } - //}; - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/AssemblyHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/AssemblyHelper.cs deleted file mode 100644 index ac95e268..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/AssemblyHelper.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Helper -{ - public class AssemblyHelper - { - public static List GetClass(string assemblyFile, string className = null, string spaceName=null) - { - Assembly assembly = Assembly.Load(assemblyFile); - return assembly.GetTypes().Where(m => m.IsClass - && className == null?true:m.Name==className - && spaceName == null ? true :m.Namespace == spaceName - ).ToList(); - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/Base32Helper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/Base32Helper.cs deleted file mode 100644 index 3d422caa..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/Base32Helper.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Text; - -namespace Yi.Framework.Common.Helper -{ - public sealed class Base32Helper - { - - // the valid chars for the encoding - private static string ValidChars = "QAZ2WSX3" + "EDC4RFV5" + "TGB6YHN7" + "UJM8K9LP"; - - /// - /// Converts an array of bytes to a Base32-k string. - /// - public static string ToString(byte[] bytes) - { - StringBuilder sb = new StringBuilder(); // holds the base32 chars - byte index; - int hi = 5; - int currentByte = 0; - - while (currentByte < bytes.Length) - { - // do we need to use the next byte? - if (hi > 8) - { - // get the last piece from the current byte, shift it to the right - // and increment the byte counter - index = (byte)(bytes[currentByte++] >> (hi - 5)); - if (currentByte != bytes.Length) - { - // if we are not at the end, get the first piece from - // the next byte, clear it and shift it to the left - index = (byte)(((byte)(bytes[currentByte] << (16 - hi)) >> 3) | index); - } - - hi -= 3; - } - else if (hi == 8) - { - index = (byte)(bytes[currentByte++] >> 3); - hi -= 3; - } - else - { - - // simply get the stuff from the current byte - index = (byte)((byte)(bytes[currentByte] << (8 - hi)) >> 3); - hi += 5; - } - - sb.Append(ValidChars[index]); - } - - return sb.ToString(); - } - - - /// - /// Converts a Base32-k string into an array of bytes. - /// - /// - /// Input string s contains invalid Base32-k characters. - /// - public static byte[] FromBase32String(string str) - { - int numBytes = str.Length * 5 / 8; - byte[] bytes = new Byte[numBytes]; - - // all UPPERCASE chars - str = str.ToUpper(); - - int bit_buffer; - int currentCharIndex; - int bits_in_buffer; - - if (str.Length < 3) - { - bytes[0] = (byte)(ValidChars.IndexOf(str[0]) | ValidChars.IndexOf(str[1]) << 5); - return bytes; - } - - bit_buffer = (ValidChars.IndexOf(str[0]) | ValidChars.IndexOf(str[1]) << 5); - bits_in_buffer = 10; - currentCharIndex = 2; - for (int i = 0; i < bytes.Length; i++) - { - bytes[i] = (byte)bit_buffer; - bit_buffer >>= 8; - bits_in_buffer -= 8; - while (bits_in_buffer < 8 && currentCharIndex < str.Length) - { - bit_buffer |= ValidChars.IndexOf(str[currentCharIndex++]) << bits_in_buffer; - bits_in_buffer += 5; - } - } - - return bytes; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/ConsoleHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/ConsoleHelper.cs deleted file mode 100644 index 50a9688f..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/ConsoleHelper.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; - -namespace Yi.Framework.Common.Helper -{ - public static class ConsoleHelper - { - public static void WriteColorLine(string str, ConsoleColor color) - { - ConsoleColor currentForeColor = Console.ForegroundColor; - Console.ForegroundColor = color; - Console.WriteLine(str); - Console.ForegroundColor = currentForeColor; - } - - /// - /// 打印错误信息 - /// - /// 待打印的字符串 - /// 想要打印的颜色 - public static void WriteErrorLine(this string str, ConsoleColor color = ConsoleColor.Red) - { - WriteColorLine(str, color); - } - - /// - /// 打印警告信息 - /// - /// 待打印的字符串 - /// 想要打印的颜色 - public static void WriteWarningLine(this string str, ConsoleColor color = ConsoleColor.Yellow) - { - WriteColorLine(str, color); - } - /// - /// 打印正常信息 - /// - /// 待打印的字符串 - /// 想要打印的颜色 - public static void WriteInfoLine(this string str, ConsoleColor color = ConsoleColor.White) - { - WriteColorLine(str, color); - } - /// - /// 打印成功的信息 - /// - /// 待打印的字符串 - /// 想要打印的颜色 - public static void WriteSuccessLine(this string str, ConsoleColor color = ConsoleColor.Green) - { - WriteColorLine(str, color); - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/DateHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/DateHelper.cs deleted file mode 100644 index 0e31e4c7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/DateHelper.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; - -namespace Yi.Framework.Common.Helper -{ - public class DateHelper - { - public static DateTime StampToDateTime(string time) - { - time = time.Substring(0, 10); - double timestamp = Convert.ToInt64(time); - System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); - dateTime = dateTime.AddSeconds(timestamp).ToLocalTime(); - return dateTime; - } - - public static string TimeSubTract(DateTime time1,DateTime time2) - { - TimeSpan subTract = time1.Subtract(time2); - return $"{subTract.Days} 天 {subTract.Hours} 时 {subTract.Minutes} 分 "; - } - /// - /// 时间戳转本地时间-时间戳精确到秒 - /// - public static DateTime ToLocalTimeDateBySeconds(long unix) - { - var dto = DateTimeOffset.FromUnixTimeSeconds(unix); - return dto.ToLocalTime().DateTime; - } - - /// - /// 时间转时间戳Unix-时间戳精确到秒 - /// - public static long ToUnixTimestampBySeconds(DateTime dt) - { - DateTimeOffset dto = new DateTimeOffset(dt); - return dto.ToUnixTimeSeconds(); - } - - - /// - /// 时间戳转本地时间-时间戳精确到毫秒 - /// - public static DateTime ToLocalTimeDateByMilliseconds(long unix) - { - var dto = DateTimeOffset.FromUnixTimeMilliseconds(unix); - return dto.ToLocalTime().DateTime; - } - - /// - /// 时间转时间戳Unix-时间戳精确到毫秒 - /// - public static long ToUnixTimestampByMilliseconds(DateTime dt) - { - DateTimeOffset dto = new DateTimeOffset(dt); - return dto.ToUnixTimeMilliseconds(); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/EmailHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/EmailHelper.cs deleted file mode 100644 index 5629592d..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/EmailHelper.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Net.Mail; -using System.Net.Sockets; -using System.Text; - -namespace Yi.Framework.Common.Helper -{ - public class EmailHelper - { - public static string fromMail { get; set; } - public static string pwdMail { get; set; } - public static string senderMail { get; set; } - public static string subjectMail { get; set; } - public static void Init(string fromMail,string pwdMail,string senderMail, string subjectMail) - { - EmailHelper.fromMail = fromMail; - EmailHelper.pwdMail = pwdMail; - EmailHelper.senderMail = senderMail; - EmailHelper.subjectMail = subjectMail; - } - - public static bool sendMail(string body, string toMail) - { - try - { - - //string fromMail = "454313500@qq.com"; - //string pwdMail = "yvjioburildgbhdf"; - MailMessage message = new MailMessage(); - //设置发件人,发件人需要与设置的邮件发送服务器的邮箱一致 - System.Net.Mail.MailAddress fromAddr = new System.Net.Mail.MailAddress(fromMail, EmailHelper.senderMail); - message.From = fromAddr; - - //设置收件人,可添加多个,添加方法与下面的一样 - message.To.Add(toMail); - - - //设置邮件标题 - message.Subject = EmailHelper.subjectMail; - - //设置邮件内容 - message.Body = body; - - //设置邮件发送服务器,服务器根据你使用的邮箱而不同,可以到相应的 邮箱管理后台查看,下面是QQ的 - System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.qq.com", 25) - ; - //设置发送人的邮箱账号和密码,POP3/SMTP服务要开启, 密码要是POP3/SMTP等服务的授权码 - client.Credentials = new System.Net.NetworkCredential(fromMail, pwdMail);//vtirsfsthwuadjfe fhszmpegwoqnecja - - //启用ssl,也就是安全发送 - client.EnableSsl = true; - - //发送邮件 - client.Send(message); - - return true; - } - catch - { - return false; - } - - } - - public static void 接受邮件() - { - using (TcpClient client = new TcpClient("pop.qq.com", 110)) - using (NetworkStream n = client.GetStream()) - { - GetEmail.ReadLine(n); // Read the welcome message. - GetEmail.SendCommand(n, "USER 1040079213@qq.com"); - GetEmail.SendCommand(n, "PASS odfaizoqdiupbfgi"); - GetEmail.SendCommand(n, "LIST"); // Retrieve message IDs - List messageIDs = new List(); - while (true) - { - string line = GetEmail.ReadLine(n); // e.g., "11876" - if (line == ".") break; - messageIDs.Add(int.Parse(line.Split(' ')[0])); // Message ID - } - foreach (int id in messageIDs) // Retrieve each message. - { - GetEmail.SendCommand(n, "RETR " + id); - string randomFile = Guid.NewGuid().ToString() + ".eml"; - using (StreamWriter writer = File.CreateText(randomFile)) - while (true) - { - string line = GetEmail.ReadLine(n); // Read next line of message. - if (line == ".") break; // Single dot = end of message. - if (line == "..") line = "."; // "Escape out" double dot. - writer.WriteLine(line); // Write to output file. - } - GetEmail.SendCommand(n, "DELE " + id); // Delete message off server. - } - GetEmail.SendCommand(n, "QUIT"); - } - } - } - //接受邮件pop - public class GetEmail - { - public static void SendCommand(Stream stream, string line) - { - byte[] data = Encoding.UTF8.GetBytes(line + "\r\n"); - stream.Write(data, 0, data.Length); - string response = ReadLine(stream); - if (!response.StartsWith("+OK")) - throw new Exception("POP Error: " + response); - } - public static string ReadLine(Stream s) - { - List lineBuffer = new List(); - while (true) - { - int b = s.ReadByte(); - if (b == 10 || b < 0) break; - if (b != 13) lineBuffer.Add((byte)b); - } - return Encoding.UTF8.GetString(lineBuffer.ToArray()); - } - } -} - diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/ExcelHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/ExcelHelper.cs deleted file mode 100644 index 8d0f808d..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/ExcelHelper.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using OfficeOpenXml; - -namespace Yi.Framework.Common.Helper -{ - public class ExcelHelper - { - /// - /// - /// - /// - /// 数据 - /// 表头 - /// - public static string CreateExcelFromList(List dataList, List headers,string evn) - { - ExcelPackage.LicenseContext = LicenseContext.NonCommercial; - string sWebRootFolder = Path.Combine($"{evn}", "wwwroot/Excel");//如果用浏览器url下载的方式 存放excel的文件夹一定要建在网站首页的同级目录下!!! - if (!Directory.Exists(sWebRootFolder)) - { - Directory.CreateDirectory(sWebRootFolder); - } - string sFileName = $@"Excel_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"; - var path = Path.Combine(sWebRootFolder, sFileName); - FileInfo file = new FileInfo(path); - if (file.Exists) - { - file.Delete(); - file = new FileInfo(path); - } - using (ExcelPackage package = new(file)) - { - //创建sheet - ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("sheet1"); - worksheet.Cells.LoadFromCollection(dataList, true); - //表头字段 - for (int i = 0; i < headers.Count; i++) - { - worksheet.Cells[1, i + 1].Value = headers[i]; - } - for (int i = 0; i < headers.Count + 1; i++) - {//删除不需要的列 - string aa = worksheet.Cells[1, i + 1].Value.ToString(); - if (aa == "总行数") - { - worksheet.DeleteColumn(i + 1); - } - } - package.Save(); - } - //return path;//这是返回文件的方式 - return sFileName; //如果用浏览器url下载的方式 这里直接返回生成的文件名就可以了 - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/FileHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/FileHelper.cs deleted file mode 100644 index 2ffc9ba2..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/FileHelper.cs +++ /dev/null @@ -1,395 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Text; - -namespace Yi.Framework.Common.Helper -{ - public class FileHelper : IDisposable - { - - private bool _alreadyDispose = false; - - #region 构造函数 - public FileHelper() - { - // - // TODO: 在此处添加构造函数逻辑 - // - } - ~FileHelper() - { - Dispose(); ; - } - - protected virtual void Dispose(bool isDisposing) - { - if (_alreadyDispose) return; - _alreadyDispose = true; - } - #endregion - - #region IDisposable 成员 - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - #endregion - - #region 取得文件后缀名 - /**************************************** - * 函数名称:GetPostfixStr - * 功能说明:取得文件后缀名 - * 参 数:filename:文件名称 - * 调用示列: - * string filename = "aaa.aspx"; - * string s = EC.FileObj.GetPostfixStr(filename); - *****************************************/ - /// - /// 取后缀名 - /// - /// 文件名 - /// .gif|.html格式 - public static string GetPostfixStr(string filename) - { - int start = filename.LastIndexOf("."); - int length = filename.Length; - string postfix = filename.Substring(start, length - start); - return postfix; - } - #endregion - - #region 根据文件大小获取指定前缀的可用文件名 - /// - /// 根据文件大小获取指定前缀的可用文件名 - /// - /// 文件夹 - /// 文件前缀 - /// 文件大小(1m) - /// 文件后缀(.log) - /// 可用文件名 - //public static string GetAvailableFileWithPrefixOrderSize(string folderPath, string prefix, int size = 1 * 1024 * 1024, string ext = ".log") - //{ - // var allFiles = new DirectoryInfo(folderPath); - // var selectFiles = allFiles.GetFiles().Where(fi => fi.Name.ToLower().Contains(prefix.ToLower()) && fi.Extension.ToLower() == ext.ToLower() && fi.Length < size).OrderByDescending(d=>d.Name).ToList(); - - // if (selectFiles.Count > 0) - // { - // return selectFiles.FirstOrDefault().FullName; - // } - - // return Path.Combine(folderPath, $@"{prefix}_{DateTime.Now.DateToTimeStamp()}.log"); - //} - //public static string GetAvailableFileNameWithPrefixOrderSize(string _contentRoot, string prefix, int size = 1 * 1024 * 1024, string ext = ".log") - //{ - // var folderPath = Path.Combine(_contentRoot, "Log"); - // if (!Directory.Exists(folderPath)) - // { - // Directory.CreateDirectory(folderPath); - // } - - // var allFiles = new DirectoryInfo(folderPath); - // var selectFiles = allFiles.GetFiles().Where(fi => fi.Name.ToLower().Contains(prefix.ToLower()) && fi.Extension.ToLower() == ext.ToLower() && fi.Length < size).OrderByDescending(d => d.Name).ToList(); - - // if (selectFiles.Count > 0) - // { - // return selectFiles.FirstOrDefault().Name.Replace(".log",""); - // } - - // return $@"{prefix}_{DateTime.Now.DateToTimeStamp()}"; - //} - #endregion - - #region 写文件 - /**************************************** - * 函数名称:WriteFile - * 功能说明:写文件,会覆盖掉以前的内容 - * 参 数:Path:文件路径,Strings:文本内容 - * 调用示列: - * string Path = Server.MapPath("Default2.aspx"); - * string Strings = "这是我写的内容啊"; - * EC.FileObj.WriteFile(Path,Strings); - *****************************************/ - /// - /// 写文件 - /// - /// 文件路径 - /// 文件内容 - public static void WriteFile(string Path, string Strings) - { - if (!File.Exists(Path)) - { - FileStream f = File.Create(Path); - f.Close(); - } - StreamWriter f2 = new StreamWriter(Path, false, System.Text.Encoding.GetEncoding("gb2312")); - f2.Write(Strings); - f2.Close(); - f2.Dispose(); - } - - /// - /// 写文件 - /// - /// 文件路径 - /// 文件内容 - /// 编码格式 - public static void WriteFile(string Path, string Strings, Encoding encode) - { - if (!File.Exists(Path)) - { - FileStream f = File.Create(Path); - f.Close(); - } - StreamWriter f2 = new StreamWriter(Path, false, encode); - f2.Write(Strings); - f2.Close(); - f2.Dispose(); - } - #endregion - - #region 读文件 - /**************************************** - * 函数名称:ReadFile - * 功能说明:读取文本内容 - * 参 数:Path:文件路径 - * 调用示列: - * string Path = Server.MapPath("Default2.aspx"); - * string s = EC.FileObj.ReadFile(Path); - *****************************************/ - /// - /// 读文件 - /// - /// 文件路径 - /// - public static string ReadFile(string Path) - { - string s = ""; - if (!File.Exists(Path)) - s = "不存在相应的目录"; - else - { - StreamReader f2 = new StreamReader(Path, System.Text.Encoding.GetEncoding("gb2312")); - s = f2.ReadToEnd(); - f2.Close(); - f2.Dispose(); - } - - return s; - } - - /// - /// 读文件 - /// - /// 文件路径 - /// 编码格式 - /// - public static string ReadFile(string Path, Encoding encode) - { - string s = ""; - if (!File.Exists(Path)) - s = "不存在相应的目录"; - else - { - StreamReader f2 = new StreamReader(Path, encode); - s = f2.ReadToEnd(); - f2.Close(); - f2.Dispose(); - } - - return s; - } - #endregion - - #region 追加文件 - /**************************************** - * 函数名称:FileAdd - * 功能说明:追加文件内容 - * 参 数:Path:文件路径,strings:内容 - * 调用示列: - * string Path = Server.MapPath("Default2.aspx"); - * string Strings = "新追加内容"; - * EC.FileObj.FileAdd(Path, Strings); - *****************************************/ - /// - /// 追加文件 - /// - /// 文件路径 - /// 内容 - public static void FileAdd(string Path, string strings) - { - StreamWriter sw = File.AppendText(Path); - sw.Write(strings); - sw.Flush(); - sw.Close(); - } - #endregion - - #region 拷贝文件 - /**************************************** - * 函数名称:FileCoppy - * 功能说明:拷贝文件 - * 参 数:OrignFile:原始文件,NewFile:新文件路径 - * 调用示列: - * string orignFile = Server.MapPath("Default2.aspx"); - * string NewFile = Server.MapPath("Default3.aspx"); - * EC.FileObj.FileCoppy(OrignFile, NewFile); - *****************************************/ - /// - /// 拷贝文件 - /// - /// 原始文件 - /// 新文件路径 - public static void FileCoppy(string orignFile, string NewFile) - { - File.Copy(orignFile, NewFile, true); - } - - #endregion - - #region 删除文件 - /**************************************** - * 函数名称:FileDel - * 功能说明:删除文件 - * 参 数:Path:文件路径 - * 调用示列: - * string Path = Server.MapPath("Default3.aspx"); - * EC.FileObj.FileDel(Path); - *****************************************/ - /// - /// 删除文件 - /// - /// 路径 - public static void FileDel(string Path) - { - File.Delete(Path); - } - #endregion - - #region 移动文件 - /**************************************** - * 函数名称:FileMove - * 功能说明:移动文件 - * 参 数:OrignFile:原始路径,NewFile:新文件路径 - * 调用示列: - * string orignFile = Server.MapPath("../说明.txt"); - * string NewFile = Server.MapPath("http://www.cnblogs.com/说明.txt"); - * EC.FileObj.FileMove(OrignFile, NewFile); - *****************************************/ - /// - /// 移动文件 - /// - /// 原始路径 - /// 新路径 - public static void FileMove(string orignFile, string NewFile) - { - File.Move(orignFile, NewFile); - } - #endregion - - #region 在当前目录下创建目录 - /**************************************** - * 函数名称:FolderCreate - * 功能说明:在当前目录下创建目录 - * 参 数:OrignFolder:当前目录,NewFloder:新目录 - * 调用示列: - * string orignFolder = Server.MapPath("test/"); - * string NewFloder = "new"; - * EC.FileObj.FolderCreate(OrignFolder, NewFloder); - *****************************************/ - /// - /// 在当前目录下创建目录 - /// - /// 当前目录 - /// 新目录 - public static void FolderCreate(string orignFolder, string NewFloder) - { - Directory.SetCurrentDirectory(orignFolder); - Directory.CreateDirectory(NewFloder); - } - #endregion - - #region 递归删除文件夹目录及文件 - /**************************************** - * 函数名称:DeleteFolder - * 功能说明:递归删除文件夹目录及文件 - * 参 数:dir:文件夹路径 - * 调用示列: - * string dir = Server.MapPath("test/"); - * EC.FileObj.DeleteFolder(dir); - *****************************************/ - /// - /// 递归删除文件夹目录及文件 - /// - /// - /// - public static void DeleteFolder(string dir) - { - if (Directory.Exists(dir)) //如果存在这个文件夹删除之 - { - foreach (string d in Directory.GetFileSystemEntries(dir)) - { - if (File.Exists(d)) - File.Delete(d); //直接删除其中的文件 - else - DeleteFolder(d); //递归删除子文件夹 - } - Directory.Delete(dir); //删除已空文件夹 - } - - } - #endregion - - #region 将指定文件夹下面的所有内容copy到目标文件夹下面 果目标文件夹为只读属性就会报错。 - /**************************************** - * 函数名称:CopyDir - * 功能说明:将指定文件夹下面的所有内容copy到目标文件夹下面 果目标文件夹为只读属性就会报错。 - * 参 数:srcPath:原始路径,aimPath:目标文件夹 - * 调用示列: - * string srcPath = Server.MapPath("test/"); - * string aimPath = Server.MapPath("test1/"); - * EC.FileObj.CopyDir(srcPath,aimPath); - *****************************************/ - /// - /// 指定文件夹下面的所有内容copy到目标文件夹下面 - /// - /// 原始路径 - /// 目标文件夹 - public static void CopyDir(string srcPath, string aimPath) - { - try - { - // 检查目标目录是否以目录分割字符结束如果不是则添加之 - if (aimPath[aimPath.Length - 1] != Path.DirectorySeparatorChar) - aimPath += Path.DirectorySeparatorChar; - // 判断目标目录是否存在如果不存在则新建之 - if (!Directory.Exists(aimPath)) - Directory.CreateDirectory(aimPath); - // 得到源目录的文件列表,该里面是包含文件以及目录路径的一个数组 - //如果你指向copy目标文件下面的文件而不包含目录请使用下面的方法 - //string[] fileList = Directory.GetFiles(srcPath); - string[] fileList = Directory.GetFileSystemEntries(srcPath); - //遍历所有的文件和目录 - foreach (string file in fileList) - { - //先当作目录处理如果存在这个目录就递归Copy该目录下面的文件 - - if (Directory.Exists(file)) - CopyDir(file, aimPath + Path.GetFileName(file)); - //否则直接Copy文件 - else - File.Copy(file, aimPath + Path.GetFileName(file), true); - } - - } - catch (Exception ee) - { - throw new Exception(ee.ToString()); - } - } - #endregion - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/HtmlHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/HtmlHelper.cs deleted file mode 100644 index 1e1e0086..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/HtmlHelper.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Yi.Framework.Common.Helper -{ - public static class HtmlHelper - { - #region 去除富文本中的HTML标签 - /// - /// 去除富文本中的HTML标签 - /// - /// - /// - /// - public static string ReplaceHtmlTag(string html, int length = 0) - { - string strText = System.Text.RegularExpressions.Regex.Replace(html, "<[^>]+>", ""); - strText = System.Text.RegularExpressions.Regex.Replace(strText, "&[^;]+;", ""); - - if (length > 0 && strText.Length > length) - return strText.Substring(0, length); - - return strText; - } - #endregion - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/HttpHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/HttpHelper.cs deleted file mode 100644 index 96b7c4c0..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/HttpHelper.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Helper -{ - public static class HttpHelper - { - public static string HttpGet(string Url, string postDataStr="") - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr); - request.Method = "GET"; - request.ContentType = "text/html;charset=UTF-8"; - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream myResponseStream = response.GetResponseStream(); - StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); - string retString = myStreamReader.ReadToEnd(); - myStreamReader.Close(); - myResponseStream.Close(); - - return retString; - } - - public static bool HttpIOGet(string Url, string file, string postDataStr="") - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr); - request.Method = "GET"; - request.ContentType = "text/html;charset=UTF-8"; - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream myResponseStream = response.GetResponseStream(); - FileStream writer = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write); - byte[] buffer = new byte[1024]; - int c; - while ((c = myResponseStream.Read(buffer, 0, buffer.Length)) > 0) - { - writer.Write(buffer, 0, c); - } - writer.Close(); - myResponseStream.Close(); - - return true; - } - - public static string HttpPost(string Url, string postDataStr="") - { - CookieContainer cookie = new CookieContainer(); - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); - request.Method = "POST"; - request.ContentType = "application/x-www-form-urlencoded"; - request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr); - request.CookieContainer = cookie; - Stream myRequestStream = request.GetRequestStream(); - StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312")); - myStreamWriter.Write(postDataStr); - myStreamWriter.Close(); - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - - response.Cookies = cookie.GetCookies(response.ResponseUri); - Stream myResponseStream = response.GetResponseStream(); - StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); - string retString = myStreamReader.ReadToEnd(); - myStreamReader.Close(); - myResponseStream.Close(); - - return retString; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/IpHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/IpHelper.cs deleted file mode 100644 index b39d112a..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/IpHelper.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Linq; -using System.Net; -using System.Net.NetworkInformation; -using System.Net.Sockets; - -namespace Yi.Framework.Common.Helper -{ - public class IpHelper - { - /// - /// 获取当前IP地址 - /// - /// - /// - public static string GetCurrentIp(string preferredNetworks) - { - var instanceIp = "127.0.0.1"; - - try - { - // 获取可用网卡 - var nics = NetworkInterface.GetAllNetworkInterfaces()?.Where(network => network.OperationalStatus == OperationalStatus.Up); - - // 获取所有可用网卡IP信息 - var ipCollection = nics?.Select(x => x.GetIPProperties())?.SelectMany(x => x.UnicastAddresses); - - foreach (var ipadd in ipCollection) - { - if (!IPAddress.IsLoopback(ipadd.Address) && ipadd.Address.AddressFamily == AddressFamily.InterNetwork) - { - if (string.IsNullOrEmpty(preferredNetworks)) - { - instanceIp = ipadd.Address.ToString(); - break; - } - - if (!ipadd.Address.ToString().StartsWith(preferredNetworks)) continue; - instanceIp = ipadd.Address.ToString(); - break; - } - } - } - catch - { - // ignored - } - - return instanceIp; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/JsonHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/JsonHelper.cs deleted file mode 100644 index 9b983cbe..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/JsonHelper.cs +++ /dev/null @@ -1,509 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; - -namespace Yi.Framework.Common.Helper -{ - public class JsonHelper - { - - - public static string ObjToStr(T obj) - { - return Newtonsoft.Json.JsonConvert.SerializeObject(obj); - } - - public static T StrToObj(string str) - { - return Newtonsoft.Json.JsonConvert.DeserializeObject(str); - } - /// - /// 转换对象为JSON格式数据 - /// - /// - /// 对象 - /// 字符格式的JSON数据 - public static string GetJSON(object obj) - { - string result = String.Empty; - try - { - JsonSerializer.Serialize(""); - System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = - new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(T)); - using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) - { - serializer.WriteObject(ms, obj); - result = System.Text.Encoding.UTF8.GetString(ms.ToArray()); - } - } - catch (Exception) - { - throw; - } - return result; - } - /// - /// 转换List的数据为JSON格式 - /// - /// - /// 列表值 - /// JSON格式数据 - public string JSON(List vals) - { - System.Text.StringBuilder st = new System.Text.StringBuilder(); - try - { - System.Runtime.Serialization.Json.DataContractJsonSerializer s = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(T)); - - foreach (T city in vals) - { - using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) - { - s.WriteObject(ms, city); - st.Append(System.Text.Encoding.UTF8.GetString(ms.ToArray())); - } - } - } - catch (Exception) - { - } - - return st.ToString(); - } - /// - /// JSON格式字符转换为T类型的对象 - /// - /// - /// - /// - public static T ParseFormByJson(string jsonStr) - { - T obj = Activator.CreateInstance(); - using (System.IO.MemoryStream ms = - new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(jsonStr))) - { - System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = - new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(T)); - return (T)serializer.ReadObject(ms); - } - } - - public string JSON1(List vals) - { - System.Text.StringBuilder st = new System.Text.StringBuilder(); - try - { - System.Runtime.Serialization.Json.DataContractJsonSerializer s = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(SendData)); - - foreach (SendData city in vals) - { - using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) - { - s.WriteObject(ms, city); - st.Append(System.Text.Encoding.UTF8.GetString(ms.ToArray())); - } - } - } - catch (Exception) - { - } - - return st.ToString(); - } - - private static bool IsJsonStart(ref string json) - { - if (!string.IsNullOrEmpty(json)) - { - json = json.Trim('\r', '\n', ' '); - if (json.Length > 1) - { - char s = json[0]; - char e = json[json.Length - 1]; - return (s == '{' && e == '}') || (s == '[' && e == ']'); - } - } - return false; - } - public static bool IsJson(string json) - { - int errIndex; - return IsJson(json, out errIndex); - } - public static bool IsJson(string json, out int errIndex) - { - errIndex = 0; - if (IsJsonStart(ref json)) - { - CharState cs = new CharState(); - char c; - for (int i = 0; i < json.Length; i++) - { - c = json[i]; - if (SetCharState(c, ref cs) && cs.childrenStart)//设置关键符号状态。 - { - string item = json.Substring(i); - int err; - int length = GetValueLength(item, true, out err); - cs.childrenStart = false; - if (err > 0) - { - errIndex = i + err; - return false; - } - i = i + length - 1; - } - if (cs.isError) - { - errIndex = i; - return false; - } - } - - return !cs.arrayStart && !cs.jsonStart; - } - return false; - } - - /// - /// 获取值的长度(当Json值嵌套以"{"或"["开头时) - /// - private static int GetValueLength(string json, bool breakOnErr, out int errIndex) - { - errIndex = 0; - int len = 0; - if (!string.IsNullOrEmpty(json)) - { - CharState cs = new CharState(); - char c; - for (int i = 0; i < json.Length; i++) - { - c = json[i]; - if (!SetCharState(c, ref cs))//设置关键符号状态。 - { - if (!cs.jsonStart && !cs.arrayStart)//json结束,又不是数组,则退出。 - { - break; - } - } - else if (cs.childrenStart)//正常字符,值状态下。 - { - int length = GetValueLength(json.Substring(i), breakOnErr, out errIndex);//递归子值,返回一个长度。。。 - cs.childrenStart = false; - cs.valueStart = 0; - //cs.state = 0; - i = i + length - 1; - } - if (breakOnErr && cs.isError) - { - errIndex = i; - return i; - } - if (!cs.jsonStart && !cs.arrayStart)//记录当前结束位置。 - { - len = i + 1;//长度比索引+1 - break; - } - } - } - return len; - } - - /// - /// 设置字符状态(返回true则为关键词,返回false则当为普通字符处理) - /// - private static bool SetCharState(char c, ref CharState cs) - { - cs.CheckIsError(c); - switch (c) - { - case '{'://[{ "[{A}]":[{"[{B}]":3,"m":"C"}]}] - #region 大括号 - if (cs.keyStart <= 0 && cs.valueStart <= 0) - { - cs.keyStart = 0; - cs.valueStart = 0; - if (cs.jsonStart && cs.state == 1) - { - cs.childrenStart = true; - } - else - { - cs.state = 0; - } - cs.jsonStart = true;//开始。 - return true; - } - #endregion - break; - case '}': - #region 大括号结束 - if (cs.keyStart <= 0 && cs.valueStart < 2 && cs.jsonStart) - { - cs.jsonStart = false;//正常结束。 - cs.state = 0; - cs.keyStart = 0; - cs.valueStart = 0; - cs.setDicValue = true; - return true; - } - // cs.isError = !cs.jsonStart && cs.state == 0; - #endregion - break; - case '[': - #region 中括号开始 - if (!cs.jsonStart) - { - cs.arrayStart = true; - return true; - } - else if (cs.jsonStart && cs.state == 1) - { - cs.childrenStart = true; - return true; - } - #endregion - break; - case ']': - #region 中括号结束 - if (cs.arrayStart && !cs.jsonStart && cs.keyStart <= 2 && cs.valueStart <= 0)//[{},333]//这样结束。 - { - cs.keyStart = 0; - cs.valueStart = 0; - cs.arrayStart = false; - return true; - } - #endregion - break; - case '"': - case '\'': - #region 引号 - if (cs.jsonStart || cs.arrayStart) - { - if (cs.state == 0)//key阶段,有可能是数组["aa",{}] - { - if (cs.keyStart <= 0) - { - cs.keyStart = (c == '"' ? 3 : 2); - return true; - } - else if ((cs.keyStart == 2 && c == '\'') || (cs.keyStart == 3 && c == '"')) - { - if (!cs.escapeChar) - { - cs.keyStart = -1; - return true; - } - else - { - cs.escapeChar = false; - } - } - } - else if (cs.state == 1 && cs.jsonStart)//值阶段必须是Json开始了。 - { - if (cs.valueStart <= 0) - { - cs.valueStart = (c == '"' ? 3 : 2); - return true; - } - else if ((cs.valueStart == 2 && c == '\'') || (cs.valueStart == 3 && c == '"')) - { - if (!cs.escapeChar) - { - cs.valueStart = -1; - return true; - } - else - { - cs.escapeChar = false; - } - } - - } - } - #endregion - break; - case ':': - #region 冒号 - if (cs.jsonStart && cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 0) - { - if (cs.keyStart == 1) - { - cs.keyStart = -1; - } - cs.state = 1; - return true; - } - // cs.isError = !cs.jsonStart || (cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 1); - #endregion - break; - case ',': - #region 逗号 //["aa",{aa:12,}] - - if (cs.jsonStart) - { - if (cs.keyStart < 2 && cs.valueStart < 2 && cs.state == 1) - { - cs.state = 0; - cs.keyStart = 0; - cs.valueStart = 0; - //if (cs.valueStart == 1) - //{ - // cs.valueStart = 0; - //} - cs.setDicValue = true; - return true; - } - } - else if (cs.arrayStart && cs.keyStart <= 2) - { - cs.keyStart = 0; - //if (cs.keyStart == 1) - //{ - // cs.keyStart = -1; - //} - return true; - } - #endregion - break; - case ' ': - case '\r': - case '\n'://[ "a",\r\n{} ] - case '\0': - case '\t': - if (cs.keyStart <= 0 && cs.valueStart <= 0) //cs.jsonStart && - { - return true;//跳过空格。 - } - break; - default: //值开头。。 - if (c == '\\') //转义符号 - { - if (cs.escapeChar) - { - cs.escapeChar = false; - } - else - { - cs.escapeChar = true; - return true; - } - } - else - { - cs.escapeChar = false; - } - if (cs.jsonStart || cs.arrayStart) // Json 或数组开始了。 - { - if (cs.keyStart <= 0 && cs.state == 0) - { - cs.keyStart = 1;//无引号的 - } - else if (cs.valueStart <= 0 && cs.state == 1 && cs.jsonStart)//只有Json开始才有值。 - { - cs.valueStart = 1;//无引号的 - } - } - break; - } - return false; - } - } - /// - /// 字符状态 - /// - public class CharState - { - internal bool jsonStart = false;//以 "{"开始了... - internal bool setDicValue = false;// 可以设置字典值了。 - internal bool escapeChar = false;//以"\"转义符号开始了 - /// - /// 数组开始【仅第一开头才算】,值嵌套的以【childrenStart】来标识。 - /// - internal bool arrayStart = false;//以"[" 符号开始了 - internal bool childrenStart = false;//子级嵌套开始了。 - /// - /// 【0 初始状态,或 遇到“,”逗号】;【1 遇到“:”冒号】 - /// - internal int state = 0; - - /// - /// 【-1 取值结束】【0 未开始】【1 无引号开始】【2 单引号开始】【3 双引号开始】 - /// - internal int keyStart = 0; - /// - /// 【-1 取值结束】【0 未开始】【1 无引号开始】【2 单引号开始】【3 双引号开始】 - /// - internal int valueStart = 0; - internal bool isError = false;//是否语法错误。 - - internal void CheckIsError(char c)//只当成一级处理(因为GetLength会递归到每一个子项处理) - { - if (keyStart > 1 || valueStart > 1) - { - return; - } - //示例 ["aa",{"bbbb":123,"fff","ddd"}] - switch (c) - { - case '{'://[{ "[{A}]":[{"[{B}]":3,"m":"C"}]}] - isError = jsonStart && state == 0;//重复开始错误 同时不是值处理。 - break; - case '}': - isError = !jsonStart || (keyStart != 0 && state == 0);//重复结束错误 或者 提前结束{"aa"}。正常的有{} - break; - case '[': - isError = arrayStart && state == 0;//重复开始错误 - break; - case ']': - isError = !arrayStart || jsonStart;//重复开始错误 或者 Json 未结束 - break; - case '"': - case '\'': - isError = !(jsonStart || arrayStart); //json 或数组开始。 - if (!isError) - { - //重复开始 [""",{"" "}] - isError = (state == 0 && keyStart == -1) || (state == 1 && valueStart == -1); - } - if (!isError && arrayStart && !jsonStart && c == '\'')//['aa',{}] - { - isError = true; - } - break; - case ':': - isError = !jsonStart || state == 1;//重复出现。 - break; - case ',': - isError = !(jsonStart || arrayStart); //json 或数组开始。 - if (!isError) - { - if (jsonStart) - { - isError = state == 0 || (state == 1 && valueStart > 1);//重复出现。 - } - else if (arrayStart)//["aa,] [,] [{},{}] - { - isError = keyStart == 0 && !setDicValue; - } - } - break; - case ' ': - case '\r': - case '\n'://[ "a",\r\n{} ] - case '\0': - case '\t': - break; - default: //值开头。。 - isError = (!jsonStart && !arrayStart) || (state == 0 && keyStart == -1) || (valueStart == -1 && state == 1);// - break; - } - //if (isError) - //{ - - //} - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/MD5Hepler.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/MD5Hepler.cs deleted file mode 100644 index 6eb53422..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/MD5Hepler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Security.Cryptography; -using System.Text; - -namespace Yi.Framework.Common.Helper -{ - public class MD5Helper - { - /// - /// 16位MD5加密 - /// - /// - /// - public static string MD5Encrypt16(string password) - { - var md5 = new MD5CryptoServiceProvider(); - string t2 = BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(password)), 4, 8); - t2 = t2.Replace("-", string.Empty); - return t2; - } - - /// - /// 32位MD5加密 - /// - /// - /// - public static string MD5Encrypt32(string password = "") - { - string pwd = string.Empty; - try - { - if (!string.IsNullOrEmpty(password) && !string.IsNullOrWhiteSpace(password)) - { - MD5 md5 = MD5.Create(); //实例化一个md5对像 - // 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择  - byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(password)); - // 通过使用循环,将字节类型的数组转换为字符串,此字符串是常规字符格式化所得 - foreach (var item in s) - { - // 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符 - pwd = string.Concat(pwd, item.ToString("X2")); - } - } - } - catch - { - throw new Exception($"错误的 password 字符串:【{password}】"); - } - return pwd; - } - - /// - /// 64位MD5加密 - /// - /// - /// - public static string MD5Encrypt64(string password) - { - // 实例化一个md5对像 - // 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择  - MD5 md5 = MD5.Create(); - byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(password)); - return Convert.ToBase64String(s); - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/MimeHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/MimeHelper.cs deleted file mode 100644 index bd783d48..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/MimeHelper.cs +++ /dev/null @@ -1,244 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Helper -{ - public static class MimeHelper - { - // 通过自己定义一个静态类 - // 将所有的Content Type都扔进去吧 - // 调用的时候直接调用静态方法即可。 - - private static Hashtable _mimeMappingTable; - - private static void AddMimeMapping(string extension, string MimeType) - { - MimeHelper._mimeMappingTable.Add(extension, MimeType); - } - - public static string GetMimeMapping(string FileName) - { - string text = null; - int num = FileName.LastIndexOf('.'); - if (0 < num && num > FileName.LastIndexOf('\\')) - { - text = (string)MimeHelper._mimeMappingTable[FileName.Substring(num)]; - } - if (text == null) - { - text = (string)MimeHelper._mimeMappingTable[".*"]; - } - return text; - } - - static MimeHelper() - { - MimeHelper._mimeMappingTable = new Hashtable(190, StringComparer.CurrentCultureIgnoreCase); - MimeHelper.AddMimeMapping(".323", "text/h323"); - MimeHelper.AddMimeMapping(".asx", "video/x-ms-asf"); - MimeHelper.AddMimeMapping(".acx", "application/internet-property-stream"); - MimeHelper.AddMimeMapping(".ai", "application/postscript"); - MimeHelper.AddMimeMapping(".aif", "audio/x-aiff"); - MimeHelper.AddMimeMapping(".aiff", "audio/aiff"); - MimeHelper.AddMimeMapping(".axs", "application/olescript"); - MimeHelper.AddMimeMapping(".aifc", "audio/aiff"); - MimeHelper.AddMimeMapping(".asr", "video/x-ms-asf"); - MimeHelper.AddMimeMapping(".avi", "video/x-msvideo"); - MimeHelper.AddMimeMapping(".asf", "video/x-ms-asf"); - MimeHelper.AddMimeMapping(".au", "audio/basic"); - MimeHelper.AddMimeMapping(".application", "application/x-ms-application"); - MimeHelper.AddMimeMapping(".bin", "application/octet-stream"); - MimeHelper.AddMimeMapping(".bas", "text/plain"); - MimeHelper.AddMimeMapping(".bcpio", "application/x-bcpio"); - MimeHelper.AddMimeMapping(".bmp", "image/bmp"); - MimeHelper.AddMimeMapping(".cdf", "application/x-cdf"); - MimeHelper.AddMimeMapping(".cat", "application/vndms-pkiseccat"); - MimeHelper.AddMimeMapping(".crt", "application/x-x509-ca-cert"); - MimeHelper.AddMimeMapping(".c", "text/plain"); - MimeHelper.AddMimeMapping(".css", "text/css"); - MimeHelper.AddMimeMapping(".cer", "application/x-x509-ca-cert"); - MimeHelper.AddMimeMapping(".crl", "application/pkix-crl"); - MimeHelper.AddMimeMapping(".cmx", "image/x-cmx"); - MimeHelper.AddMimeMapping(".csh", "application/x-csh"); - MimeHelper.AddMimeMapping(".cod", "image/cis-cod"); - MimeHelper.AddMimeMapping(".cpio", "application/x-cpio"); - MimeHelper.AddMimeMapping(".clp", "application/x-msclip"); - MimeHelper.AddMimeMapping(".crd", "application/x-mscardfile"); - MimeHelper.AddMimeMapping(".deploy", "application/octet-stream"); - MimeHelper.AddMimeMapping(".dll", "application/x-msdownload"); - MimeHelper.AddMimeMapping(".dot", "application/msword"); - MimeHelper.AddMimeMapping(".doc", "application/msword"); - MimeHelper.AddMimeMapping(".dvi", "application/x-dvi"); - MimeHelper.AddMimeMapping(".dir", "application/x-director"); - MimeHelper.AddMimeMapping(".dxr", "application/x-director"); - MimeHelper.AddMimeMapping(".der", "application/x-x509-ca-cert"); - MimeHelper.AddMimeMapping(".dib", "image/bmp"); - MimeHelper.AddMimeMapping(".dcr", "application/x-director"); - MimeHelper.AddMimeMapping(".disco", "text/xml"); - MimeHelper.AddMimeMapping(".exe", "application/octet-stream"); - MimeHelper.AddMimeMapping(".etx", "text/x-setext"); - MimeHelper.AddMimeMapping(".evy", "application/envoy"); - MimeHelper.AddMimeMapping(".eml", "message/rfc822"); - MimeHelper.AddMimeMapping(".eps", "application/postscript"); - MimeHelper.AddMimeMapping(".flr", "x-world/x-vrml"); - MimeHelper.AddMimeMapping(".fif", "application/fractals"); - MimeHelper.AddMimeMapping(".gtar", "application/x-gtar"); - MimeHelper.AddMimeMapping(".gif", "image/gif"); - MimeHelper.AddMimeMapping(".gz", "application/x-gzip"); - MimeHelper.AddMimeMapping(".hta", "application/hta"); - MimeHelper.AddMimeMapping(".htc", "text/x-component"); - MimeHelper.AddMimeMapping(".htt", "text/webviewhtml"); - MimeHelper.AddMimeMapping(".h", "text/plain"); - MimeHelper.AddMimeMapping(".hdf", "application/x-hdf"); - MimeHelper.AddMimeMapping(".hlp", "application/winhlp"); - MimeHelper.AddMimeMapping(".html", "text/html"); - MimeHelper.AddMimeMapping(".htm", "text/html"); - MimeHelper.AddMimeMapping(".hqx", "application/mac-binhex40"); - MimeHelper.AddMimeMapping(".isp", "application/x-internet-signup"); - MimeHelper.AddMimeMapping(".iii", "application/x-iphone"); - MimeHelper.AddMimeMapping(".ief", "image/ief"); - MimeHelper.AddMimeMapping(".ivf", "video/x-ivf"); - MimeHelper.AddMimeMapping(".ins", "application/x-internet-signup"); - MimeHelper.AddMimeMapping(".ico", "image/x-icon"); - MimeHelper.AddMimeMapping(".jpg", "image/jpeg"); - MimeHelper.AddMimeMapping(".jfif", "image/pjpeg"); - MimeHelper.AddMimeMapping(".jpe", "image/jpeg"); - MimeHelper.AddMimeMapping(".jpeg", "image/jpeg"); - MimeHelper.AddMimeMapping(".js", "application/x-javascript"); - MimeHelper.AddMimeMapping(".lsx", "video/x-la-asf"); - MimeHelper.AddMimeMapping(".latex", "application/x-latex"); - MimeHelper.AddMimeMapping(".lsf", "video/x-la-asf"); - MimeHelper.AddMimeMapping(".manifest", "application/x-ms-manifest"); - MimeHelper.AddMimeMapping(".mhtml", "message/rfc822"); - MimeHelper.AddMimeMapping(".mny", "application/x-msmoney"); - MimeHelper.AddMimeMapping(".mht", "message/rfc822"); - MimeHelper.AddMimeMapping(".mid", "audio/mid"); - MimeHelper.AddMimeMapping(".mpv2", "video/mpeg"); - MimeHelper.AddMimeMapping(".man", "application/x-troff-man"); - MimeHelper.AddMimeMapping(".mvb", "application/x-msmediaview"); - MimeHelper.AddMimeMapping(".mpeg", "video/mpeg"); - MimeHelper.AddMimeMapping(".m3u", "audio/x-mpegurl"); - MimeHelper.AddMimeMapping(".mdb", "application/x-msaccess"); - MimeHelper.AddMimeMapping(".mpp", "application/vnd.ms-project"); - MimeHelper.AddMimeMapping(".m1v", "video/mpeg"); - MimeHelper.AddMimeMapping(".mpa", "video/mpeg"); - MimeHelper.AddMimeMapping(".me", "application/x-troff-me"); - MimeHelper.AddMimeMapping(".m13", "application/x-msmediaview"); - MimeHelper.AddMimeMapping(".movie", "video/x-sgi-movie"); - MimeHelper.AddMimeMapping(".m14", "application/x-msmediaview"); - MimeHelper.AddMimeMapping(".mpe", "video/mpeg"); - MimeHelper.AddMimeMapping(".mp2", "video/mpeg"); - MimeHelper.AddMimeMapping(".mov", "video/quicktime"); - MimeHelper.AddMimeMapping(".mp3", "audio/mpeg"); - MimeHelper.AddMimeMapping(".mpg", "video/mpeg"); - MimeHelper.AddMimeMapping(".ms", "application/x-troff-ms"); - MimeHelper.AddMimeMapping(".nc", "application/x-netcdf"); - MimeHelper.AddMimeMapping(".nws", "message/rfc822"); - MimeHelper.AddMimeMapping(".oda", "application/oda"); - MimeHelper.AddMimeMapping(".ods", "application/oleobject"); - MimeHelper.AddMimeMapping(".pmc", "application/x-perfmon"); - MimeHelper.AddMimeMapping(".p7r", "application/x-pkcs7-certreqresp"); - MimeHelper.AddMimeMapping(".p7b", "application/x-pkcs7-certificates"); - MimeHelper.AddMimeMapping(".p7s", "application/pkcs7-signature"); - MimeHelper.AddMimeMapping(".pmw", "application/x-perfmon"); - MimeHelper.AddMimeMapping(".ps", "application/postscript"); - MimeHelper.AddMimeMapping(".p7c", "application/pkcs7-mime"); - MimeHelper.AddMimeMapping(".pbm", "image/x-portable-bitmap"); - MimeHelper.AddMimeMapping(".ppm", "image/x-portable-pixmap"); - MimeHelper.AddMimeMapping(".pub", "application/x-mspublisher"); - MimeHelper.AddMimeMapping(".pnm", "image/x-portable-anymap"); - MimeHelper.AddMimeMapping(".png", "image/png"); - MimeHelper.AddMimeMapping(".pml", "application/x-perfmon"); - MimeHelper.AddMimeMapping(".p10", "application/pkcs10"); - MimeHelper.AddMimeMapping(".pfx", "application/x-pkcs12"); - MimeHelper.AddMimeMapping(".p12", "application/x-pkcs12"); - MimeHelper.AddMimeMapping(".pdf", "application/pdf"); - MimeHelper.AddMimeMapping(".pps", "application/vnd.ms-powerpoint"); - MimeHelper.AddMimeMapping(".p7m", "application/pkcs7-mime"); - MimeHelper.AddMimeMapping(".pko", "application/vndms-pkipko"); - MimeHelper.AddMimeMapping(".ppt", "application/vnd.ms-powerpoint"); - MimeHelper.AddMimeMapping(".pmr", "application/x-perfmon"); - MimeHelper.AddMimeMapping(".pma", "application/x-perfmon"); - MimeHelper.AddMimeMapping(".pot", "application/vnd.ms-powerpoint"); - MimeHelper.AddMimeMapping(".prf", "application/pics-rules"); - MimeHelper.AddMimeMapping(".pgm", "image/x-portable-graymap"); - MimeHelper.AddMimeMapping(".qt", "video/quicktime"); - MimeHelper.AddMimeMapping(".ra", "audio/x-pn-realaudio"); - MimeHelper.AddMimeMapping(".rgb", "image/x-rgb"); - MimeHelper.AddMimeMapping(".ram", "audio/x-pn-realaudio"); - MimeHelper.AddMimeMapping(".rmi", "audio/mid"); - MimeHelper.AddMimeMapping(".ras", "image/x-cmu-raster"); - MimeHelper.AddMimeMapping(".roff", "application/x-troff"); - MimeHelper.AddMimeMapping(".rtf", "application/rtf"); - MimeHelper.AddMimeMapping(".rtx", "text/richtext"); - MimeHelper.AddMimeMapping(".sv4crc", "application/x-sv4crc"); - MimeHelper.AddMimeMapping(".spc", "application/x-pkcs7-certificates"); - MimeHelper.AddMimeMapping(".setreg", "application/set-registration-initiation"); - MimeHelper.AddMimeMapping(".snd", "audio/basic"); - MimeHelper.AddMimeMapping(".stl", "application/vndms-pkistl"); - MimeHelper.AddMimeMapping(".setpay", "application/set-payment-initiation"); - MimeHelper.AddMimeMapping(".stm", "text/html"); - MimeHelper.AddMimeMapping(".shar", "application/x-shar"); - MimeHelper.AddMimeMapping(".sh", "application/x-sh"); - MimeHelper.AddMimeMapping(".sit", "application/x-stuffit"); - MimeHelper.AddMimeMapping(".spl", "application/futuresplash"); - MimeHelper.AddMimeMapping(".sct", "text/scriptlet"); - MimeHelper.AddMimeMapping(".scd", "application/x-msschedule"); - MimeHelper.AddMimeMapping(".sst", "application/vndms-pkicertstore"); - MimeHelper.AddMimeMapping(".src", "application/x-wais-source"); - MimeHelper.AddMimeMapping(".sv4cpio", "application/x-sv4cpio"); - MimeHelper.AddMimeMapping(".tex", "application/x-tex"); - MimeHelper.AddMimeMapping(".tgz", "application/x-compressed"); - MimeHelper.AddMimeMapping(".t", "application/x-troff"); - MimeHelper.AddMimeMapping(".tar", "application/x-tar"); - MimeHelper.AddMimeMapping(".tr", "application/x-troff"); - MimeHelper.AddMimeMapping(".tif", "image/tiff"); - MimeHelper.AddMimeMapping(".txt", "text/plain"); - MimeHelper.AddMimeMapping(".texinfo", "application/x-texinfo"); - MimeHelper.AddMimeMapping(".trm", "application/x-msterminal"); - MimeHelper.AddMimeMapping(".tiff", "image/tiff"); - MimeHelper.AddMimeMapping(".tcl", "application/x-tcl"); - MimeHelper.AddMimeMapping(".texi", "application/x-texinfo"); - MimeHelper.AddMimeMapping(".tsv", "text/tab-separated-values"); - MimeHelper.AddMimeMapping(".ustar", "application/x-ustar"); - MimeHelper.AddMimeMapping(".uls", "text/iuls"); - MimeHelper.AddMimeMapping(".vcf", "text/x-vcard"); - MimeHelper.AddMimeMapping(".wps", "application/vnd.ms-works"); - MimeHelper.AddMimeMapping(".wav", "audio/wav"); - MimeHelper.AddMimeMapping(".wrz", "x-world/x-vrml"); - MimeHelper.AddMimeMapping(".wri", "application/x-mswrite"); - MimeHelper.AddMimeMapping(".wks", "application/vnd.ms-works"); - MimeHelper.AddMimeMapping(".wmf", "application/x-msmetafile"); - MimeHelper.AddMimeMapping(".wcm", "application/vnd.ms-works"); - MimeHelper.AddMimeMapping(".wrl", "x-world/x-vrml"); - MimeHelper.AddMimeMapping(".wdb", "application/vnd.ms-works"); - MimeHelper.AddMimeMapping(".wsdl", "text/xml"); - MimeHelper.AddMimeMapping(".xap", "application/x-silverlight-app"); - MimeHelper.AddMimeMapping(".xml", "text/xml"); - MimeHelper.AddMimeMapping(".xlm", "application/vnd.ms-excel"); - MimeHelper.AddMimeMapping(".xaf", "x-world/x-vrml"); - MimeHelper.AddMimeMapping(".xla", "application/vnd.ms-excel"); - MimeHelper.AddMimeMapping(".xls", "application/vnd.ms-excel"); - MimeHelper.AddMimeMapping(".xlsx", "application/vnd.ms-excel"); - MimeHelper.AddMimeMapping(".xof", "x-world/x-vrml"); - MimeHelper.AddMimeMapping(".xlt", "application/vnd.ms-excel"); - MimeHelper.AddMimeMapping(".xlc", "application/vnd.ms-excel"); - MimeHelper.AddMimeMapping(".xsl", "text/xml"); - MimeHelper.AddMimeMapping(".xbm", "image/x-xbitmap"); - MimeHelper.AddMimeMapping(".xlw", "application/vnd.ms-excel"); - MimeHelper.AddMimeMapping(".xpm", "image/x-xpixmap"); - MimeHelper.AddMimeMapping(".xwd", "image/x-xwindowdump"); - MimeHelper.AddMimeMapping(".xsd", "text/xml"); - MimeHelper.AddMimeMapping(".z", "application/x-compress"); - MimeHelper.AddMimeMapping(".zip", "application/x-zip-compressed"); - MimeHelper.AddMimeMapping(".*", "application/octet-stream"); - } - } - - - -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/RSAHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/RSAHelper.cs deleted file mode 100644 index f439b544..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/RSAHelper.cs +++ /dev/null @@ -1,390 +0,0 @@ -using System; -using System.IO; -using System.Security.Cryptography; -using System.Text; - -namespace Yi.Framework.Common.Helper -{ - /// - /// RSA加解密 使用OpenSSL的公钥加密/私钥解密 - /// 公私钥请使用openssl生成 - /// - public class RSAHelper - { - public readonly RSA _privateKeyRsaProvider; - public readonly RSA _publicKeyRsaProvider; - private readonly HashAlgorithmName _hashAlgorithmName; - private readonly Encoding _encoding; - - /// - /// 实例化RSAHelper - /// - /// 加密算法类型 RSA SHA1;RSA2 SHA256 密钥长度至少为2048 - /// 编码类型 - /// 私钥 - /// 公钥 - public RSAHelper(RSAType rsaType, Encoding encoding, string privateKey, string publicKey = null) - { - _encoding = encoding; - if (!string.IsNullOrEmpty(privateKey)) - { - _privateKeyRsaProvider = CreateRsaProviderFromPrivateKey(privateKey); - } - - if (!string.IsNullOrEmpty(publicKey)) - { - _publicKeyRsaProvider = CreateRsaProviderFromPublicKey(publicKey); - } - - _hashAlgorithmName = rsaType == RSAType.RSA ? HashAlgorithmName.SHA1 : HashAlgorithmName.SHA256; - } - - #region 使用私钥签名 - - /// - /// 使用私钥签名 - /// - /// 原始数据 - /// - public string Sign(string data) - { - byte[] dataBytes = _encoding.GetBytes(data); - - var signatureBytes = _privateKeyRsaProvider.SignData(dataBytes, _hashAlgorithmName, RSASignaturePadding.Pkcs1); - - return Convert.ToBase64String(signatureBytes); - } - - #endregion - - #region 使用公钥验签 - - /// - /// 使用公钥验签 - /// - /// 原始数据 - /// 签名 - /// - public bool Verify(string data, string sign) - { - byte[] dataBytes = _encoding.GetBytes(data); - byte[] signBytes = Convert.FromBase64String(sign); - - var verify = _publicKeyRsaProvider.VerifyData(dataBytes, signBytes, _hashAlgorithmName, RSASignaturePadding.Pkcs1); - - return verify; - } - - #endregion - - #region 解密 - /// - /// 私钥解密(原) - /// - /// 解密字符串(base64) - /// - - //public string Decrypt(string cipherText) - //{ - // if (_privateKeyRsaProvider == null) - // { - // throw new Exception("_privateKeyRsaProvider is null"); - // } - // return _encoding.GetString(_privateKeyRsaProvider.Decrypt(Convert.FromBase64String(cipherText), RSAEncryptionPadding.Pkcs1)); - //} - /// - /// 私钥解密(支持大量数据) - /// - /// - /// - public string Decrypt(string cipherText) - { - if (_privateKeyRsaProvider == null) - { - throw new Exception("_privateKeyRsaProvider is null"); - } - var bufferSize = (_privateKeyRsaProvider.KeySize / 8); - byte[] buffer = new byte[bufferSize];//待解密块 - using (MemoryStream msInput = new MemoryStream(Convert.FromBase64String(cipherText))) - { - using (MemoryStream msOutput = new MemoryStream()) - { - int readLen; while ((readLen = msInput.Read(buffer, 0, bufferSize)) > 0) - { - byte[] dataToEnc = new byte[readLen]; - Array.Copy(buffer, 0, dataToEnc, 0, readLen); byte[] encData = _privateKeyRsaProvider.Decrypt(dataToEnc, RSAEncryptionPadding.Pkcs1); - msOutput.Write(encData, 0, encData.Length); - } - byte[] result = msOutput.ToArray(); - return _encoding.GetString(result); - } - } - } - - #endregion - - #region 加密 - - /// - /// 公钥加密(原) - /// - /// - /// - //public string Encrypt(string text) - //{ - // if (_publicKeyRsaProvider == null) - // { - // throw new Exception("_publicKeyRsaProvider is null"); - // } - // return Convert.ToBase64String(_publicKeyRsaProvider.Encrypt(Encoding.UTF8.GetBytes(text), RSAEncryptionPadding.Pkcs1)); - //} - /// - /// 公钥加密(支持大量数据) - /// - /// - /// - public string Encrypt(string text) - { - if (_publicKeyRsaProvider == null) - { - throw new Exception("_publicKeyRsaProvider is null"); - } - var bufferSize = (_publicKeyRsaProvider.KeySize / 8 - 11); - byte[] buffer = new byte[bufferSize];//待加密块 - - using (MemoryStream msInput = new MemoryStream(_encoding.GetBytes(text))) - { - using (MemoryStream msOutput = new MemoryStream()) - { - int readLen; while ((readLen = msInput.Read(buffer, 0, bufferSize)) > 0) - { - byte[] dataToEnc = new byte[readLen]; - Array.Copy(buffer, 0, dataToEnc, 0, readLen); byte[] encData = _publicKeyRsaProvider.Encrypt(dataToEnc, RSAEncryptionPadding.Pkcs1); - msOutput.Write(encData, 0, encData.Length); - } - byte[] result = msOutput.ToArray(); - return Convert.ToBase64String(result); - } - } - } - - #endregion - - #region 使用私钥创建RSA实例 - /// - /// 使用私钥创建RSA实例 - /// - /// - /// - private RSA CreateRsaProviderFromPrivateKey(string privateKey) - { - var privateKeyBits = Convert.FromBase64String(privateKey); - - var rsa = RSA.Create(); - var rsaParameters = new RSAParameters(); - - using (BinaryReader binr = new BinaryReader(new MemoryStream(privateKeyBits))) - { - byte bt = 0; - ushort twobytes = 0; - twobytes = binr.ReadUInt16(); - if (twobytes == 0x8130) - binr.ReadByte(); - else if (twobytes == 0x8230) - binr.ReadInt16(); - else - throw new Exception("Unexpected value read binr.ReadUInt16()"); - - twobytes = binr.ReadUInt16(); - if (twobytes != 0x0102) - throw new Exception("Unexpected version"); - - bt = binr.ReadByte(); - if (bt != 0x00) - throw new Exception("Unexpected value read binr.ReadByte()"); - - rsaParameters.Modulus = binr.ReadBytes(GetIntegerSize(binr)); - rsaParameters.Exponent = binr.ReadBytes(GetIntegerSize(binr)); - rsaParameters.D = binr.ReadBytes(GetIntegerSize(binr)); - rsaParameters.P = binr.ReadBytes(GetIntegerSize(binr)); - rsaParameters.Q = binr.ReadBytes(GetIntegerSize(binr)); - rsaParameters.DP = binr.ReadBytes(GetIntegerSize(binr)); - rsaParameters.DQ = binr.ReadBytes(GetIntegerSize(binr)); - rsaParameters.InverseQ = binr.ReadBytes(GetIntegerSize(binr)); - } - - rsa.ImportParameters(rsaParameters); - return rsa; - } - - #endregion - - #region 使用公钥创建RSA实例 - /// - /// 使用公钥创建RSA实例 - /// - /// - /// - public RSA CreateRsaProviderFromPublicKey(string publicKeyString) - { - // encoded OID sequence for PKCS #1 rsaEncryption szOID_RSA_RSA = "1.2.840.113549.1.1.1" - byte[] seqOid = { 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 }; - byte[] seq = new byte[15]; - - var x509Key = Convert.FromBase64String(publicKeyString); - - // --------- Set up stream to read the asn.1 encoded SubjectPublicKeyInfo blob ------ - using (MemoryStream mem = new MemoryStream(x509Key)) - { - using (BinaryReader binr = new BinaryReader(mem)) //wrap Memory Stream with BinaryReader for easy reading - { - byte bt = 0; - ushort twobytes = 0; - - twobytes = binr.ReadUInt16(); - if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) - binr.ReadByte(); //advance 1 byte - else if (twobytes == 0x8230) - binr.ReadInt16(); //advance 2 bytes - else - return null; - - seq = binr.ReadBytes(15); //read the Sequence OID - if (!CompareBytearrays(seq, seqOid)) //make sure Sequence for OID is correct - return null; - - twobytes = binr.ReadUInt16(); - if (twobytes == 0x8103) //data read as little endian order (actual data order for Bit String is 03 81) - binr.ReadByte(); //advance 1 byte - else if (twobytes == 0x8203) - binr.ReadInt16(); //advance 2 bytes - else - return null; - - bt = binr.ReadByte(); - if (bt != 0x00) //expect null byte next - return null; - - twobytes = binr.ReadUInt16(); - if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) - binr.ReadByte(); //advance 1 byte - else if (twobytes == 0x8230) - binr.ReadInt16(); //advance 2 bytes - else - return null; - - twobytes = binr.ReadUInt16(); - byte lowbyte = 0x00; - byte highbyte = 0x00; - - if (twobytes == 0x8102) //data read as little endian order (actual data order for Integer is 02 81) - lowbyte = binr.ReadByte(); // read next bytes which is bytes in modulus - else if (twobytes == 0x8202) - { - highbyte = binr.ReadByte(); //advance 2 bytes - lowbyte = binr.ReadByte(); - } - else - return null; - byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; //reverse byte order since asn.1 key uses big endian order - int modsize = BitConverter.ToInt32(modint, 0); - - int firstbyte = binr.PeekChar(); - if (firstbyte == 0x00) - { //if first byte (highest order) of modulus is zero, don't include it - binr.ReadByte(); //skip this null byte - modsize -= 1; //reduce modulus buffer size by 1 - } - - byte[] modulus = binr.ReadBytes(modsize); //read the modulus bytes - - if (binr.ReadByte() != 0x02) //expect an Integer for the exponent data - return null; - int expbytes = (int)binr.ReadByte(); // should only need one byte for actual exponent data (for all useful values) - byte[] exponent = binr.ReadBytes(expbytes); - - // ------- create RSACryptoServiceProvider instance and initialize with public key ----- - var rsa = RSA.Create(); - RSAParameters rsaKeyInfo = new RSAParameters - { - Modulus = modulus, - Exponent = exponent - }; - rsa.ImportParameters(rsaKeyInfo); - - return rsa; - } - - } - } - - #endregion - - #region 导入密钥算法 - - private int GetIntegerSize(BinaryReader binr) - { - byte bt = 0; - int count = 0; - bt = binr.ReadByte(); - if (bt != 0x02) - return 0; - bt = binr.ReadByte(); - - if (bt == 0x81) - count = binr.ReadByte(); - else - if (bt == 0x82) - { - var highbyte = binr.ReadByte(); - var lowbyte = binr.ReadByte(); - byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; - count = BitConverter.ToInt32(modint, 0); - } - else - { - count = bt; - } - - while (binr.ReadByte() == 0x00) - { - count -= 1; - } - binr.BaseStream.Seek(-1, SeekOrigin.Current); - return count; - } - - private bool CompareBytearrays(byte[] a, byte[] b) - { - if (a.Length != b.Length) - return false; - int i = 0; - foreach (byte c in a) - { - if (c != b[i]) - return false; - i++; - } - return true; - } - - #endregion - - } - - /// - /// RSA算法类型 - /// - public enum RSAType - { - /// - /// SHA1 - /// - RSA = 0, - /// - /// RSA2 密钥长度至少为2048 - /// SHA256 - /// - RSA2 - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/RandomHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/RandomHelper.cs deleted file mode 100644 index 8c5cd40f..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/RandomHelper.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace Yi.Framework.Common.Helper -{ - public class RandomHelper - { - public static string replaceBianLiang(string content) - { - content = content.Replace("{当前时间}", DateTime.Now.TimeOfDay.ToString()); - string[] bianliang = new string[] { "{随机字母}", "{随机数字}", "{随机汉字}" }; - Regex r; - int count; - string readstr = ""; - foreach (string str in bianliang) - { - count = (content.Length - content.Replace(str, "").Length) / str.Length; - if (str == "{随机汉字}") readstr = RandChina(count); - if (str == "{随机数字}") readstr = GenerateCheckCodeNum(count); - if (str == "{随机字母}") readstr = GenerateRandomLetter(count); - if (count > readstr.Length) count = readstr.Length; - r = new Regex(str.Replace("{", "\\{").Replace("}", "\\}")); - for (int i = 0; i < count; i++) - { - content = r.Replace(content, readstr.Substring(i, 1), 1); - } - } - return content; - } - - - /// - /// 随机生成字母 - /// - /// - /// - public static string GenerateRandomLetter(int Length) - { - char[] Pattern = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; - string result = ""; - int n = Pattern.Length; - Random random = new Random(~unchecked((int)DateTime.Now.Ticks)); - for (int i = 0; i < Length; i++) - { - int rnd = random.Next(0, n); - result += Pattern[rnd]; - } - return result; - } - - /// - /// 随机生成数字 - /// - /// - /// - public static string GenerateCheckCodeNum(int codeCount) - { - int rep = 0; - string str = string.Empty; - long num2 = DateTime.Now.Ticks + rep; - rep++; - Random random = new Random(((int)(((ulong)num2) & 0xffffffffL)) | ((int)(num2 >> rep))); - for (int i = 0; i < codeCount; i++) - { - int num = random.Next(); - str = str + ((char)(0x30 + ((ushort)(num % 10)))).ToString(); - } - return str; - } - - /// - /// 此函数为生成指定数目的汉字 - /// - /// 汉字数目 - /// 所有汉字 - public static string RandChina(int charLen) - { - int area, code;//汉字由区位和码位组成(都为0-94,其中区位16-55为一级汉字区,56-87为二级汉字区,1-9为特殊字符区) - StringBuilder strtem = new StringBuilder(); - Random rand = new Random(); - for (int i = 0; i < charLen; i++) - { - area = rand.Next(16, 88); - if (area == 55)//第55区只有89个字符 - { - code = rand.Next(1, 90); - } - else - { - code = rand.Next(1, 94); - } - strtem.Append(Encoding.GetEncoding("GB2312").GetString(new byte[] { Convert.ToByte(area + 160), Convert.ToByte(code + 160) })); - } - return strtem.ToString(); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/SerializeHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/SerializeHelper.cs deleted file mode 100644 index 9a5aee9b..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/SerializeHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Newtonsoft.Json; -using System.Text; - -namespace Yi.Framework.Common.Helper -{ - public class SerializeHelper - { - /// - /// 序列化 - /// - /// - /// - public static byte[] Serialize(object item) - { - var jsonString = JsonConvert.SerializeObject(item); - - return Encoding.UTF8.GetBytes(jsonString); - } - /// - /// 反序列化 - /// - /// - /// - /// - public static TEntity Deserialize(byte[] value) - { - if (value == null) - { - return default(TEntity); - } - var jsonString = Encoding.UTF8.GetString(value); - return JsonConvert.DeserializeObject(jsonString); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/SnowflakeHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/SnowflakeHelper.cs deleted file mode 100644 index 603acb75..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/SnowflakeHelper.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Helper -{ - public static class SnowflakeHelper - { - public static long Next() - { - SnowflakeTool snowflakeTool = new SnowflakeTool(1); - return snowflakeTool.NextId(); - } - - private class SnowflakeTool - { - //机器ID - private static long nodeId; - private static long twepoch = 687888001020L; //唯一时间,这是一个避免重复的随机量,自行设定不要大于当前时间戳 - private static long sequence = 0L; - private static int workerIdBits = 4; //机器码字节数。4个字节用来保存机器码(定义为Long类型会出现,最大偏移64位,所以左移64位没有意义) - public static long maxWorkerId = -1L ^ -1L << workerIdBits; //最大机器ID - private static int sequenceBits = 10; //计数器字节数,10个字节用来保存计数码 - private static int workerIdShift = sequenceBits; //机器码数据左移位数,就是后面计数器占用的位数 - private static int timestampLeftShift = sequenceBits + workerIdBits; //时间戳左移动位数就是机器码和计数器总字节数 - public static long sequenceMask = -1L ^ -1L << sequenceBits; //一微秒内可以产生计数,如果达到该值则等到下一微妙在进行生成 - private long lastTimestamp = -1L; - - /// - /// 机器码 - /// - /// - public SnowflakeTool(long workerId) - { - if (workerId > maxWorkerId || workerId < 0) - throw new Exception(string.Format("节点id 不能大于 {0} 或者 小于 0 ", workerId)); - SnowflakeTool.nodeId = workerId; - - } - - public long NextId() - { - lock (this) - { - long timestamp = TimeGen(); - if (this.lastTimestamp == timestamp) - { //同一微妙中生成ID - SnowflakeTool.sequence = (SnowflakeTool.sequence + 1) & SnowflakeTool.sequenceMask; //用&运算计算该微秒内产生的计数是否已经到达上限 - if (SnowflakeTool.sequence == 0) - { - //一微妙内产生的ID计数已达上限,等待下一微妙 - timestamp = TillNextMillis(this.lastTimestamp); - } - } - else - { //不同微秒生成ID - SnowflakeTool.sequence = 0; //计数清0 - } - if (timestamp < lastTimestamp) - { //如果当前时间戳比上一次生成ID时时间戳还小,抛出异常,因为不能保证现在生成的ID之前没有生成过 - throw new Exception(string.Format("Clock moved backwards. Refusing to generate id for {0} milliseconds", - this.lastTimestamp - timestamp)); - } - this.lastTimestamp = timestamp; //把当前时间戳保存为最后生成ID的时间戳 - long nextId = (timestamp - twepoch << timestampLeftShift) | SnowflakeTool.nodeId << SnowflakeTool.workerIdShift | SnowflakeTool.sequence; - return nextId; - } - } - - /// - /// 获取下一微秒时间戳 - /// - /// - /// - private long TillNextMillis(long lastTimestamp) - { - long timestamp = TimeGen(); - while (timestamp <= lastTimestamp) - { - timestamp = TimeGen(); - } - return timestamp; - } - - /// - /// 生成当前时间戳 - /// - /// - private long TimeGen() - { - return (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; - } - } - } - - -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/StringHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/StringHelper.cs deleted file mode 100644 index b4287ed5..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/StringHelper.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; - -namespace Yi.Framework.Common.Helper -{ - public class StringHelper - { - /// - /// 根据分隔符返回前n条数据 - /// - /// 数据内容 - /// 分隔符 - /// 前n条 - /// 是否倒序(默认false) - /// - public static List GetTopDataBySeparator(string content, string separator, int top, bool isDesc = false) - { - if (string.IsNullOrEmpty(content)) - { - return new List() { }; - } - - if (string.IsNullOrEmpty(separator)) - { - throw new ArgumentException("message", nameof(separator)); - } - - var dataArray = content.Split(separator).Where(d => !string.IsNullOrEmpty(d)).ToArray(); - if (isDesc) - { - Array.Reverse(dataArray); - } - - if (top > 0) - { - dataArray = dataArray.Take(top).ToArray(); - } - - return dataArray.ToList(); - } - /// - /// 根据字段拼接get参数 - /// - /// - /// - public static string GetPars(Dictionary dic) - { - - StringBuilder sb = new StringBuilder(); - string urlPars = null; - bool isEnter = false; - foreach (var item in dic) - { - sb.Append($"{(isEnter ? "&" : "")}{item.Key}={item.Value}"); - isEnter = true; - } - urlPars = sb.ToString(); - return urlPars; - } - /// - /// 根据字段拼接get参数 - /// - /// - /// - public static string GetPars(Dictionary dic) - { - - StringBuilder sb = new StringBuilder(); - string urlPars = null; - bool isEnter = false; - foreach (var item in dic) - { - sb.Append($"{(isEnter ? "&" : "")}{item.Key}={item.Value}"); - isEnter = true; - } - urlPars = sb.ToString(); - return urlPars; - } - /// - /// 获取一个GUID - /// - /// 格式-默认为N - /// - public static string GetGUID(string format="N") { - return Guid.NewGuid().ToString(format); - } - /// - /// 根据GUID获取19位的唯一数字序列 - /// - /// - public static long GetGuidToLongID() - { - byte[] buffer = Guid.NewGuid().ToByteArray(); - return BitConverter.ToInt64(buffer, 0); - } - /// - /// 获取字符串最后X行 - /// - /// - /// - /// - public static string GetCusLine(string resourceStr, int length) { - string[] arrStr = resourceStr.Split("\r\n"); - return string.Join("", (from q in arrStr select q).Skip(arrStr.Length - length + 1).Take(length).ToArray()); - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/UnicodeHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/UnicodeHelper.cs deleted file mode 100644 index d6d96f75..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/UnicodeHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Text; -using System.Text.RegularExpressions; - -namespace Yi.Framework.Common.Helper -{ - public static class UnicodeHelper - { - /// - /// 字符串转Unicode码 - /// - /// The to unicode. - /// Value. - public static string StringToUnicode(string value) - { - byte[] bytes = Encoding.Unicode.GetBytes(value); - StringBuilder stringBuilder = new StringBuilder(); - for (int i = 0; i < bytes.Length; i += 2) - { - // 取两个字符,每个字符都是右对齐。 - stringBuilder.AppendFormat("u{0}{1}", bytes[i + 1].ToString("x").PadLeft(2, '0'), bytes[i].ToString("x").PadLeft(2, '0')); - } - return stringBuilder.ToString(); - } - - /// - /// Unicode转字符串 - /// - /// The to string. - /// Unicode. - public static string UnicodeToString(string unicode) - { - unicode = unicode.Replace("%", "\\"); - - return new Regex(@"\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace( - unicode, x => string.Empty + Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16))); - - //string resultStr = ""; - //string[] strList = unicode.Split('u'); - //for (int i = 1; i < strList.Length; i++) - //{ - // resultStr += (char)int.Parse(strList[i], System.Globalization.NumberStyles.HexNumber); - //} - //return resultStr; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/UrlHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/UrlHelper.cs deleted file mode 100644 index 6ebd30c0..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/UrlHelper.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace Yi.Framework.Common.Helper -{ - public class UrlHelper - { - /// - /// UrlEncode编码 - /// - /// url - /// - public static string UrlEncode(string url) { - return System.Web.HttpUtility.UrlEncode(url, System.Text.Encoding.UTF8); - } - /// - /// UrlEncode解码 - /// - /// 数据 - /// - public static string UrlDecode(string data) - { - return System.Web.HttpUtility.UrlDecode(data, System.Text.Encoding.UTF8); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Helper/XmlHelper.cs b/Yi.Framework.Net5/Yi.Framework.Common/Helper/XmlHelper.cs deleted file mode 100644 index 44133350..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Helper/XmlHelper.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml.Serialization; - -namespace Yi.Framework.Common.Helper -{ - public class XmlHelper - { - /// - /// 转换对象为JSON格式数据 - /// - /// - /// 对象 - /// 字符格式的JSON数据 - public static string GetXML(object obj) - { - try - { - XmlSerializer xs = new XmlSerializer(typeof(T)); - - using (TextWriter tw = new StringWriter()) - { - xs.Serialize(tw, obj); - return tw.ToString(); - } - } - catch (Exception) - { - return string.Empty; - } - } - - /// - /// Xml格式字符转换为T类型的对象 - /// - /// - /// - /// - public static T ParseFormByXml(string xml,string rootName="root") - { - XmlSerializer serializer = new XmlSerializer(typeof(T), new XmlRootAttribute(rootName)); - StringReader reader = new StringReader(xml); - - T res = (T)serializer.Deserialize(reader); - reader.Close(); - reader.Dispose(); - return res; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ConsulClientOption.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ConsulClientOption.cs deleted file mode 100644 index a9cc27a3..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ConsulClientOption.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Yi.Framework.Common.IOCOptions -{ - /// - /// 使用Consul时需要配置 - /// - public class ConsulClientOption - { - public string IP { get; set; } - public int Port { get; set; } - public string Datacenter { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ConsulRegisterOption.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ConsulRegisterOption.cs deleted file mode 100644 index a5c4fa6a..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ConsulRegisterOption.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.IOCOptions -{ - public class ConsulRegisterOption - { - /// - /// 服务自身IP - /// - public string IP { get; set; } - /// - /// 服务自身Port - /// - public int Port { get; set; } - /// - /// 组名称 - /// - public string GroupName { get; set; } - /// - /// 心跳检查地址 - /// - public string HealthCheckUrl { get; set; } - /// - /// 心跳频率 - /// - public int Interval { get; set; } - /// - /// 心跳超时 - /// - public int Timeout { get; set; } - /// - /// 移除延迟时间 - /// - public int DeregisterCriticalServiceAfter { get; set; } - /// - /// 标签,额外信息,用于权重 - /// - public string Tag { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ElasticSearchOptions.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ElasticSearchOptions.cs deleted file mode 100644 index 1080aaa6..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/ElasticSearchOptions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.IOCOptions -{ - public class ElasticSearchOptions - { - public string Url { get; set; } - public string IndexName { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/JWTTokenOptions.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/JWTTokenOptions.cs deleted file mode 100644 index 89fd0993..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/JWTTokenOptions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.IOCOptions -{ - public class JWTTokenOptions - { - public string Audience - { - get; - set; - } - public string SecurityKey - { - get; - set; - } - //public SigningCredentials Credentials - //{ - // get; - // set; - //} - public string Issuer - { - get; - set; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/KafkaOptions.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/KafkaOptions.cs deleted file mode 100644 index cfc6955e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/KafkaOptions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.IOCOptions -{ - public class KafkaOptions - { - public string BrokerList { get; set; } - public string TopicName { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/MySqlConnOptions.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/MySqlConnOptions.cs deleted file mode 100644 index c5ae46b1..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/MySqlConnOptions.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Yi.Framework.Common.IOCOptions -{ - public class DbConnOptions - { - public string WriteUrl { get; set; } - public List ReadUrl { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/RabbitMQOptions.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/RabbitMQOptions.cs deleted file mode 100644 index bdcb0f13..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/RabbitMQOptions.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.IOCOptions -{ - public class RabbitMQOptions - { - ///// - ///// exchange---queue - ///// - //private static Dictionary RabbitMQ_Mapping = new Dictionary(); - //private static readonly object RabbitMQOptions_Lock = new object(); - //public void Init(string exchangeName, string queueName) - //{ - // lock (RabbitMQOptions_Lock) - // { - // RabbitMQ_Mapping[exchangeName] = queueName; - // } - //} - - public string HostName { get; set; } - public string UserName { get; set; } - public string Password { get; set; } - - public int Port { get; set; } - - } - - public class RabbitMQConsumerModel - { - /// - /// 生产者指定,交换机 - /// - public string ExchangeName { get; set; } - /// - /// 自己起的名字 - /// - public string QueueName { get; set; } - } - - public class RabbitMQExchangeQueueName - { - public static readonly string SKUCQRS_Exchange = "Zhaoxi.MSACormmerce.SKUCQRS.Exchange"; - public static readonly string SKUCQRS_Queue_StaticPage = "Zhaoxi.MSACormmerce.SKUCQRS.Queue.StaticPage"; - public static readonly string SKUCQRS_Queue_ESIndex = "Zhaoxi.MSACormmerce.SKUCQRS.Queue.ESIndex"; - - - public static readonly string SKUWarmup_Exchange = "Zhaoxi.MSACormmerce.Warmup.Exchange"; - public static readonly string SKUWarmup_Queue_StaticPage = "Zhaoxi.MSACormmerce.Warmup.Queue.StaticPage"; - public static readonly string SKUWarmup_Queue_ESIndex = "Zhaoxi.MSACormmerce.Warmup.Queue.ESIndex"; - - /// - /// 订单创建后的交换机 - /// - public static readonly string OrderCreate_Exchange = "Zhaoxi.MSACormmerce.OrderCreate.Exchange"; - public static readonly string OrderCreate_Queue_CleanCart = "Zhaoxi.MSACormmerce.OrderCreate.Queue.CleanCart"; - - /// - /// 订单创建后的交换机,支付状态的 - /// - public static readonly string OrderPay_Exchange = "Zhaoxi.MSACormmerce.OrderPay.Exchange"; - public static readonly string OrderPay_Queue_RefreshPay = "Zhaoxi.MSACormmerce.OrderPay.Queue.RefreshPay"; - - /// - /// 创建订单后的延时队列配置 - /// - public static readonly string OrderCreate_Delay_Exchange = "Zhaoxi.MSACormmerce.OrderCreate.DelayExchange"; - public static readonly string OrderCreate_Delay_Queue_CancelOrder = "Zhaoxi.MSACormmerce.OrderCreate.DelayQueue.CancelOrder"; - - /// - /// 秒杀异步的 - /// - public static readonly string Seckill_Exchange = "Zhaoxi.MSACormmerce.Seckill.Exchange"; - public static readonly string Seckill_Order_Queue = "Zhaoxi.MSACormmerce.Seckill.Order.Queue"; - - - /// - /// CAP队列名称 - /// - public const string Order_Stock_Decrease = "RabbitMQ.MySQL.Order-Stock.Decrease"; - public const string Order_Stock_Resume = "RabbitMQ.MySQL.Order-Stock.Resume"; - public const string Stock_Logistics = "RabbitMQ.MySQL.Stock-Logistics"; - - public const string Pay_Order_UpdateStatus = "RabbitMQ.MySQL.Pay_Order.UpdateStatus"; - } - -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/RedisConnOptions.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/RedisConnOptions.cs deleted file mode 100644 index 031509a3..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/RedisConnOptions.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.IOCOptions -{ - public class RedisConnOptions - { - public string Host { get; set; } - public int DB { get; set; } = 0; - public int Prot { get; set; } - public string Password { get; set; } - } - - -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/SMSOptions.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/SMSOptions.cs deleted file mode 100644 index c9f36347..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/SMSOptions.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.IOCOptions -{ - public class SMSOptions - { - - public string ID { get; set; } - public string Secret { get; set; } - public string Sign { get; set; } - public string Template { get; set; } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/SqliteOptions.cs b/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/SqliteOptions.cs deleted file mode 100644 index bd2caf1e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/IOCOptions/SqliteOptions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.IOCOptions -{ - public class SqliteOptions - { - public string WriteUrl { get; set; } - public List ReadUrl { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/AxiosUrlsModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/AxiosUrlsModel.cs deleted file mode 100644 index f5cdacb8..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/AxiosUrlsModel.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Models -{ - public class AxiosUrlsModel - { - public string get { get; set; } - public string update { get; set; } - public string del { get; set; } - public string add { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/AgrFlagEnum.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/AgrFlagEnum.cs deleted file mode 100644 index 1a22bf81..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/AgrFlagEnum.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Yi.Framework.Common.Enum -{ - public enum AgrFlagEnum - { - wait = 0, - Agree = 1 - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/DelFlagEnum.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/DelFlagEnum.cs deleted file mode 100644 index 7433fec5..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/DelFlagEnum.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Yi.Framework.Common.Enum -{ - public enum DelFlagEnum - { - Normal=0, - Deleted=1 - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/ShowFlagEnum.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/ShowFlagEnum.cs deleted file mode 100644 index cbd8ea1b..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/ShowFlagEnum.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Enum -{ - public enum ShowFlagEnum - { - NoShow=0, - Show=1 - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/TopFlagEnum.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/TopFlagEnum.cs deleted file mode 100644 index a9e05013..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/TopFlagEnum.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Enum -{ - public enum TopFlagEnum - { - Children=0, - Top=1 - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/WriteAndReadEnum.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/WriteAndReadEnum.cs deleted file mode 100644 index c67de196..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/Enum/WriteAndReadEnum.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Yi.Framework.Common.Enum -{ - public enum WriteAndReadEnum - { - Write, //主库操作 - Read //从库操作 - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/JobModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/JobModel.cs deleted file mode 100644 index f831ee46..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/JobModel.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Models -{ - public class JobModel - { - public static int visitNum { get; set; } = 0; - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/LogModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/LogModel.cs deleted file mode 100644 index 1c7b779f..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/LogModel.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Models -{ - /// - /// 写入分布式日志需要的字段 - /// - public class LogModel - { - public string OriginalClassName { get; set; } - public string OriginalMethodName { get; set; } - public string Remark { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/PageModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/PageModel.cs deleted file mode 100644 index 491f1c7e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/PageModel.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Models -{ - public class PageModel - { - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/Result.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/Result.cs deleted file mode 100644 index 890b01f7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/Result.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace Yi.Framework.Common.Models -{ - /// - /// 结果数据 - /// - public class Result - { - public bool status { get; set; } - public int code { get; set; } - public string msg { get; set; } - public object data { get; set; } - public static Result Instance(bool status, string msg) - { - return new Result() { status = status, code = 500, msg = msg }; - } - public static Result Error(string msg = "fail") - { - return new Result() { status = false, code = 500, msg = msg }; - } - public static Result Success(string msg = "succeed") - { - return new Result() { status = true, code = 200, msg = msg }; - } - public static Result UnAuthorize(string msg = "unAuthorize") - { - return new Result() { status = false, code = 401, msg = msg }; - } - - public Result SetData(object obj) - { - this.data = obj; - return this; - } - public Result SetCode(int Code) - { - this.code = Code; - return this; - } - } - public class Result - { - public bool status { get; set; } - public int code { get; set; } - public string msg { get; set; } - public T data { get; set; } - - public static Result Instance(bool status, string msg) - { - return new Result() { status = status, code = 500, msg = msg }; - } - public static Result Error(string msg = "fail") - { - return new Result { status = false, code = 500, msg = msg }; - } - public static Result Success(string msg = "succeed") - { - return new Result { status = true, code = 200, msg = msg }; - } - - public static Result UnAuthorize(string msg = "unAuthorize") - { - return new Result{ status = false, code = 401, msg = msg }; - } - - public Result SetData(T TValue) - { - this.data = TValue; - return this; - } - } - -} \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Models/SwaggerModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/Models/SwaggerModel.cs deleted file mode 100644 index 43d8f300..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Models/SwaggerModel.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.Models -{ - public class SwaggerModel - { - public SwaggerModel(string url, string name) - { - this.url = url; - this.name = name; - } - public string url { get; set; } - public string name { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/OrderCreateQueueModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/OrderCreateQueueModel.cs deleted file mode 100644 index fd20b344..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/OrderCreateQueueModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.QueueModel -{ - /// - /// 下单成功后的实体 - /// - public class OrderCreateQueueModel - { - /// - /// 用户Id - /// - public long UserId { get; set; } - /// - /// 订单Id - /// - public long OrderId { get; set; } - /// - /// sku ID 集合 - /// - public List SkuIdList { get; set; } - - /// - /// 尝试次数 - /// - public int TryTime { get; set; } - - public OrderTypeEnum OrderType { get; set; } - - public enum OrderTypeEnum - { - Normal, - Seckill - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SKUWarmupQueueModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SKUWarmupQueueModel.cs deleted file mode 100644 index 80c926cf..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SKUWarmupQueueModel.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.QueueModel -{ - public class SKUWarmupQueueModel - { - public bool Warmup { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SMSQueueModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SMSQueueModel.cs deleted file mode 100644 index 242a75c9..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SMSQueueModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.QueueModel -{ - public class SMSQueueModel - { - public string code { get; set; } - public string phone { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SPUCQRSQueueModel.cs b/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SPUCQRSQueueModel.cs deleted file mode 100644 index a9a2efba..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/QueueModel/SPUCQRSQueueModel.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Common.QueueModel -{ - /// - /// 以SPU为单位 - /// - public class SPUCQRSQueueModel - { - public long SpuId { get; set; } - - /// - /// enum SPUCQRSQueueModelType - /// - public int CQRSType { get; set; } - } - - /// - /// 操作类型 - /// - public enum SPUCQRSQueueModelType - { - Insert = 0, - Update = 1, - Delete = 2, - Search = 3 - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Common/Yi.Framework.Common.csproj b/Yi.Framework.Net5/Yi.Framework.Common/Yi.Framework.Common.csproj deleted file mode 100644 index 74a4b17a..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Common/Yi.Framework.Common.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net5.0 - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Core/CacheClientDB.cs b/Yi.Framework.Net5/Yi.Framework.Core/CacheClientDB.cs deleted file mode 100644 index 32187406..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/CacheClientDB.cs +++ /dev/null @@ -1,1074 +0,0 @@ -using Microsoft.Extensions.Options; -using ServiceStack; -using ServiceStack.Redis; -using ServiceStack.Redis.Pipeline; -using ServiceStack.Text; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.IO; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Core -{ - public class CacheClientDB : IDisposable - { - private readonly RedisConnOptions _RedisOptions; - - #region TestRedisCrack - //static CacheClientDB() - //{ - // try - // { - // Parallel.For(0, 10000, (i) => - // { - // using (RedisClient client = new RedisClient("192.168.3.254")) - // { - // client.Set("name" + i, i); - // client.Incr("name" + i); - // Console.WriteLine(i); - // } - - // }); - // Console.WriteLine("ok"); - - // Console.WriteLine("Hello World!"); - // } - // catch (Exception ex) - // { - // Console.WriteLine(ex.Message); - // } - //} - #endregion - public CacheClientDB(IOptionsMonitor redisConnOptions) - { - this._RedisOptions = redisConnOptions.CurrentValue; - client = new RedisClient(_RedisOptions.Host, _RedisOptions.Prot, _RedisOptions.Password, _RedisOptions.DB); - } - // 管道模式 三种模式 - public IRedisClient GetClient() - { - return client; - } - private IRedisClient client; - - public void Dispose() - { - - this.TryCatchException(delegate - { - this.client.Dispose(); - }, string.Empty); - } - // 为了以后全链路做准备 - private void TryCatchException(Action action, string key) - { - try - { - action(); - } - catch (Exception e) - { - - Console.WriteLine(e.Message); - } - } - - private T TryCatch(Func action, string key) - { - Stopwatch sw = Stopwatch.StartNew(); - //Exception ex = null; - //bool isError = false; - T result; - try - { - result = action(); - } - catch (Exception exinfo) - { - object p=null; - result =(T)p; - //isError = true; - Console.WriteLine(exinfo); - - } - finally - { - - sw.Stop(); - - } - - return result; - } - - private void TryCatch(Action action, string key) - { - - Stopwatch sw = Stopwatch.StartNew(); - //bool isError = false; - //Exception ex = null; - try - { - action(); - } - catch (Exception exinfo) - { - - //isError = true; - Console.WriteLine(exinfo); - } - finally - { - sw.Stop(); - - } - } - public bool Add(string key, T value) - { - - return this.TryCatch(() => this.client.Add(key, value), key); - } - /// - /// 简单模式 事务模式 - /// - /// - /// - /// - /// - /// - public bool Add(string key, T value, DateTime expiresAt) - { - - return this.TryCatch(() => this.client.Add(key, value, expiresAt), key); - } - - public bool Add(string key, T value, TimeSpan expiresIn) - { - return this.TryCatch(() => this.client.Add(key, value, expiresIn), key); - } - - public long Decrement(string key, uint amount) - { - return this.TryCatch(() => this.client.Decrement(key, amount), key); - } - - public void FlushAll() - { - this.TryCatch(delegate - { - this.client.FlushAll(); - }, string.Empty); - } - - public T Get(string key) - { - return this.TryCatch(() => this.client.Get(key), key); - } - - public IDictionary GetAll(IEnumerable keys) - { - return this.TryCatch>(() => this.client.GetAll(keys), keys.FirstOrDefault()); - } - - public long Increment(string key, uint amount) - { - return this.TryCatch(() => this.client.Increment(key, amount), key); - } - - public bool Remove(string key) - { - return this.TryCatch(() => this.client.Remove(key), key); - } - - public void RemoveAll(IEnumerable keys) - { - this.TryCatch(delegate - { - this.client.RemoveAll(keys); - }, keys.FirstOrDefault()); - } - - public bool Replace(string key, T value) - { - return this.TryCatch(() => this.client.Replace(key, value), key); - } - - public bool Replace(string key, T value, DateTime expiresAt) - { - return this.TryCatch(() => this.client.Replace(key, value, expiresAt), key); - } - - public bool Replace(string key, T value, TimeSpan expiresIn) - { - return this.TryCatch(() => this.client.Replace(key, value, expiresIn), key); - } - - public bool Set(string key, T value) - { - return this.TryCatch(() => this.client.Set(key, value), key); - } - - public bool Set(string key, T value, DateTime expiresAt) - { - return this.TryCatch(() => this.client.Set(key, value, expiresAt), key); - } - - public bool Set(string key, T value, TimeSpan expiresIn) - { - return this.TryCatch(() => this.client.Set(key, value, expiresIn), key); - } - - public void SetAll(IDictionary values) - { - this.TryCatch(delegate - { - this.client.SetAll(values); - }, values.Keys.FirstOrDefault()); - } - - - public void Delete(T entity) where T : class, new() - { - this.TryCatch(delegate - { - this.client.Delete(entity); - }, string.Empty); - } - - public void DeleteAll() where TEntity : class, new() - { - this.TryCatch(delegate - { - this.client.DeleteAll(); - }, string.Empty); - } - - public void DeleteById(object id) where T : class, new() - { - this.TryCatch(delegate - { - this.client.DeleteById(id); - }, string.Empty); - } - - public void DeleteByIds(ICollection ids) where T : class, new() - { - this.TryCatch(delegate - { - this.client.DeleteById(ids); - }, string.Empty); - } - - public T GetById(object id) where T : class, new() - { - return this.TryCatch(() => this.client.GetById(id), string.Empty); - } - - public IList GetByIds(ICollection ids) where T : class, new() - { - return this.TryCatch>(() => this.client.GetByIds(ids), string.Empty); - } - - public T Store(T entity) where T : class, new() - { - return this.TryCatch(() => this.client.Store(entity), string.Empty); - } - - public void StoreAll(IEnumerable entities) where TEntity : class, new() - { - this.TryCatch(delegate - { - this.client.StoreAll(entities); - }, string.Empty); - } - - public void AddItemToList(string listId, string value) - { - this.TryCatch(delegate - { - this.client.AddItemToList(listId, value); - }, listId); - } - - public void AddItemToSet(string setId, string item) - { - this.TryCatch(delegate - { - this.client.AddItemToSet(setId, item); - }, setId); - } - - public bool AddItemToSortedSet(string setId, string value) - { - return this.TryCatch(() => this.client.AddItemToSortedSet(setId, value), setId); - } - - public bool AddItemToSortedSet(string setId, string value, double score) - { - return this.TryCatch(() => this.client.AddItemToSortedSet(setId, value, score), setId); - } - - public void AddRangeToList(string listId, List values) - { - this.TryCatch(delegate - { - this.client.AddRangeToList(listId, values); - }, listId); - } - - public void AddRangeToSet(string setId, List items) - { - this.TryCatch(delegate - { - this.client.AddRangeToSet(setId, items); - }, setId); - } - - public bool AddRangeToSortedSet(string setId, List values, double score) - { - return this.TryCatch(() => this.client.AddRangeToSortedSet(setId, values, score), setId); - } - - public bool AddRangeToSortedSet(string setId, List values, long score) - { - return this.TryCatch(() => this.client.AddRangeToSortedSet(setId, values, score), setId); - } - - public long AppendToValue(string key, string value) - { - return this.TryCatch(() => this.client.AppendToValue(key, value), key); - } - - public string BlockingDequeueItemFromList(string listId, TimeSpan? timeOut) - { - return this.TryCatch(() => this.client.BlockingDequeueItemFromList(listId, timeOut), listId); - } - - public KeyValuePair BlockingDequeueItemFromLists(string[] listIds, TimeSpan? timeOut) - { - return this.TryCatch>(delegate - { - ItemRef item = this.client.BlockingDequeueItemFromLists(listIds, timeOut); - return new KeyValuePair(item.Id, item.Item); - }, listIds[0]); - } - - public string BlockingPopAndPushItemBetweenLists(string fromListId, string toListId, TimeSpan? timeOut) - { - return this.TryCatch(() => this.client.BlockingPopAndPushItemBetweenLists(fromListId, toListId, timeOut), fromListId); - } - - public string BlockingPopItemFromList(string listId, TimeSpan? timeOut) - { - return this.TryCatch(() => this.client.BlockingPopItemFromList(listId, timeOut), listId); - } - - public KeyValuePair BlockingPopItemFromLists(string[] listIds, TimeSpan? timeOut) - { - return this.TryCatch>(delegate - { - ItemRef item = this.client.BlockingPopItemFromLists(listIds, timeOut); - return new KeyValuePair(item.Id, item.Item); - }, listIds[0]); - } - - public string BlockingRemoveStartFromList(string listId, TimeSpan? timeOut) - { - return this.TryCatch(() => this.client.BlockingRemoveStartFromList(listId, timeOut), listId); - } - - public KeyValuePair BlockingRemoveStartFromLists(string[] listIds, TimeSpan? timeOut) - { - return this.TryCatch>(delegate - { - ItemRef item = this.client.BlockingRemoveStartFromLists(listIds, timeOut); - return new KeyValuePair(item.Id, item.Item); - }, listIds[0]); - } - - public bool ContainsKey(string key) - { - return this.TryCatch(() => this.client.ContainsKey(key), key); - } - - public long DecrementValue(string key) - { - return this.TryCatch(() => this.client.DecrementValue(key), key); - } - - public long DecrementValueBy(string key, int count) - { - return this.TryCatch(() => this.client.DecrementValueBy(key, count), key); - } - - public string DequeueItemFromList(string listId) - { - return this.TryCatch(() => this.client.DequeueItemFromList(listId), listId); - } - - public void EnqueueItemOnList(string listId, string value) - { - this.TryCatch(delegate - { - this.client.EnqueueItemOnList(listId, value); - }, listId); - } - - public bool ExpireEntryAt(string key, DateTime expireAt) - { - return this.TryCatch(() => this.client.ExpireEntryAt(key, expireAt), key); - } - - public bool ExpireEntryIn(string key, TimeSpan expireIn) - { - return this.TryCatch(() => this.client.ExpireEntryIn(key, expireIn), key); - } - - public Dictionary GetAllEntriesFromHash(string hashId) - { - return this.TryCatch>(() => this.client.GetAllEntriesFromHash(hashId), hashId); - } - - public List GetAllItemsFromList(string listId) - { - return this.TryCatch>(() => this.client.GetAllItemsFromList(listId), listId); - } - - public HashSet GetAllItemsFromSet(string setId) - { - return this.TryCatch>(() => this.client.GetAllItemsFromSet(setId), setId); - } - - public List GetAllItemsFromSortedSet(string setId) - { - return this.TryCatch>(() => this.client.GetAllItemsFromSortedSet(setId), setId); - } - - public List GetAllItemsFromSortedSetDesc(string setId) - { - return this.TryCatch>(() => this.client.GetAllItemsFromSortedSetDesc(setId), setId); - } - - public List GetAllKeys() - { - return this.TryCatch>(() => this.client.GetAllKeys(), string.Empty); - } - - public IDictionary GetAllWithScoresFromSortedSet(string setId) - { - return this.TryCatch>(() => this.client.GetAllWithScoresFromSortedSet(setId), setId); - } - - public string GetAndSetEntry(string key, string value) - { - return this.TryCatch(() => this.client.GetAndSetValue(key, value), key); - } - - public HashSet GetDifferencesFromSet(string fromSetId, params string[] withSetIds) - { - return this.TryCatch>(() => this.client.GetDifferencesFromSet(fromSetId, withSetIds), fromSetId); - } - - public T GetFromHash(object id) - { - return this.TryCatch(() => this.client.GetFromHash(id), string.Empty); - } - - public long GetHashCount(string hashId) - { - return this.TryCatch(() => this.client.GetHashCount(hashId), hashId); - } - - public List GetHashKeys(string hashId) - { - return this.TryCatch>(() => this.client.GetHashKeys(hashId), hashId); - } - - public List GetHashValues(string hashId) - { - return this.TryCatch>(() => this.client.GetHashValues(hashId), hashId); - } - - public HashSet GetIntersectFromSets(params string[] setIds) - { - return this.TryCatch>(() => this.client.GetIntersectFromSets(setIds), setIds[0]); - } - - public string GetItemFromList(string listId, int listIndex) - { - return this.TryCatch(() => this.client.GetItemFromList(listId, listIndex), listId); - } - - public long GetItemIndexInSortedSet(string setId, string value) - { - return this.TryCatch(() => this.client.GetItemIndexInSortedSet(setId, value), setId); - } - - public long GetItemIndexInSortedSetDesc(string setId, string value) - { - return this.TryCatch(() => this.client.GetItemIndexInSortedSetDesc(setId, value), setId); - } - - public double GetItemScoreInSortedSet(string setId, string value) - { - return this.TryCatch(() => this.client.GetItemScoreInSortedSet(setId, value), setId); - } - - public long GetListCount(string listId) - { - return this.TryCatch(() => this.client.GetListCount(listId), listId); - } - - public string GetRandomItemFromSet(string setId) - { - return this.TryCatch(() => this.client.GetRandomItemFromSet(setId), setId); - } - - public List GetRangeFromList(string listId, int startingFrom, int endingAt) - { - return this.TryCatch>(() => this.client.GetRangeFromList(listId, startingFrom, endingAt), listId); - } - - public List GetRangeFromSortedList(string listId, int startingFrom, int endingAt) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedList(listId, startingFrom, endingAt), listId); - } - - public List GetRangeFromSortedSet(string setId, int fromRank, int toRank) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSet(setId, fromRank, toRank), setId); - } - - public List GetRangeFromSortedSetByHighestScore(string setId, double fromScore, double toScore) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByHighestScore(setId, fromScore, toScore), setId); - } - - public List GetRangeFromSortedSetByHighestScore(string setId, long fromScore, long toScore) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByHighestScore(setId, fromScore, toScore), setId); - } - - public List GetRangeFromSortedSetByHighestScore(string setId, string fromStringScore, string toStringScore) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByHighestScore(setId, fromStringScore, toStringScore), setId); - } - - public List GetRangeFromSortedSetByHighestScore(string setId, double fromScore, double toScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByHighestScore(setId, fromScore, toScore, skip, take), setId); - } - - public List GetRangeFromSortedSetByHighestScore(string setId, long fromScore, long toScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByHighestScore(setId, fromScore, toScore, skip, take), setId); - } - - public List GetRangeFromSortedSetByHighestScore(string setId, string fromStringScore, string toStringScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByHighestScore(setId, fromStringScore, toStringScore, skip, take), setId); - } - - public List GetRangeFromSortedSetByLowestScore(string setId, double fromScore, double toScore) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByLowestScore(setId, fromScore, toScore), setId); - } - - public List GetRangeFromSortedSetByLowestScore(string setId, long fromScore, long toScore) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByLowestScore(setId, fromScore, toScore), setId); - } - - public List GetRangeFromSortedSetByLowestScore(string setId, string fromStringScore, string toStringScore) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByLowestScore(setId, fromStringScore, toStringScore), setId); - } - - public List GetRangeFromSortedSetByLowestScore(string setId, double fromScore, double toScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByLowestScore(setId, fromScore, toScore, skip, take), setId); - } - - public List GetRangeFromSortedSetByLowestScore(string setId, long fromScore, long toScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByLowestScore(setId, fromScore, toScore, skip, take), setId); - } - - public List GetRangeFromSortedSetByLowestScore(string setId, string fromStringScore, string toStringScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetByLowestScore(setId, fromStringScore, toStringScore, skip, take), setId); - } - - public List GetRangeFromSortedSetDesc(string setId, int fromRank, int toRank) - { - return this.TryCatch>(() => this.client.GetRangeFromSortedSetDesc(setId, fromRank, toRank), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSet(string setId, int fromRank, int toRank) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSet(setId, fromRank, toRank), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByHighestScore(string setId, double fromScore, double toScore) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByHighestScore(setId, fromScore, toScore), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByHighestScore(string setId, long fromScore, long toScore) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByHighestScore(setId, fromScore, toScore), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByHighestScore(string setId, string fromStringScore, string toStringScore) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByHighestScore(setId, fromStringScore, toStringScore), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByHighestScore(string setId, double fromScore, double toScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByHighestScore(setId, fromScore, toScore, skip, take), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByHighestScore(string setId, long fromScore, long toScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByHighestScore(setId, fromScore, toScore, skip, take), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByHighestScore(string setId, string fromStringScore, string toStringScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByHighestScore(setId, fromStringScore, toStringScore, skip, take), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByLowestScore(string setId, double fromScore, double toScore) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByHighestScore(setId, fromScore, toScore), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByLowestScore(string setId, long fromScore, long toScore) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByLowestScore(setId, fromScore, toScore), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByLowestScore(string setId, string fromStringScore, string toStringScore) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByLowestScore(setId, fromStringScore, toStringScore), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByLowestScore(string setId, double fromScore, double toScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByLowestScore(setId, fromScore, toScore, skip, take), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByLowestScore(string setId, long fromScore, long toScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByLowestScore(setId, fromScore, toScore, skip, take), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetByLowestScore(string setId, string fromStringScore, string toStringScore, int? skip, int? take) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetByLowestScore(setId, fromStringScore, toStringScore, skip, take), setId); - } - - public IDictionary GetRangeWithScoresFromSortedSetDesc(string setId, int fromRank, int toRank) - { - return this.TryCatch>(() => this.client.GetRangeWithScoresFromSortedSetDesc(setId, fromRank, toRank), setId); - } - - public long GetSetCount(string setId) - { - return this.TryCatch(() => this.client.GetSetCount(setId), setId); - } - - public List GetSortedEntryValues(string key, int startingFrom, int endingAt) - { - return this.TryCatch>(() => this.client.GetSortedEntryValues(key, startingFrom, endingAt), key); - } - - public long GetSortedSetCount(string setId) - { - return this.TryCatch(() => this.client.GetSortedSetCount(setId), setId); - } - - public long GetSortedSetCount(string setId, double fromScore, double toScore) - { - return this.TryCatch(() => this.client.GetSortedSetCount(setId, fromScore, toScore), setId); - } - - public long GetSortedSetCount(string setId, long fromScore, long toScore) - { - return this.TryCatch(() => this.client.GetSortedSetCount(setId, fromScore, toScore), setId); - } - - public long GetSortedSetCount(string setId, string fromStringScore, string toStringScore) - { - return this.TryCatch(() => this.client.GetSortedSetCount(setId, fromStringScore, toStringScore), setId); - } - - public string GetSubstring(string key, int fromIndex, int toIndex) - { - return this.TryCatch(delegate - { - byte[] bytes = ((RedisClient)this.client).GetRange(key, fromIndex, toIndex); - if (bytes != null) - { - return StringExtensions.FromUtf8Bytes(bytes); - } - return null; - }, key); - } - - public TimeSpan GetTimeToLive(string key) - { - return this.TryCatch(delegate - { - TimeSpan? t = this.client.GetTimeToLive(key); - if (!t.HasValue) - { - return TimeSpan.Zero; - } - return t.Value; - }, key); - } - - public HashSet GetUnionFromSets(params string[] setIds) - { - return this.TryCatch>(() => this.client.GetUnionFromSets(setIds), setIds[0]); - } - - public string GetValue(string key) - { - return this.TryCatch(() => this.client.GetValue(key), key); - } - - public string GetValueFromHash(string hashId, string key) - { - return this.TryCatch(() => this.client.GetValueFromHash(hashId, key), hashId); - } - - public List GetValues(List keys) - { - return this.TryCatch>(() => this.client.GetValues(keys), keys[0]); - } - - public List GetValues(List keys) - { - return this.TryCatch>(() => this.client.GetValues(keys), keys[0]); - } - - public List GetValuesFromHash(string hashId, params string[] keys) - { - return this.TryCatch>(() => this.client.GetValuesFromHash(hashId, keys), hashId); - } - - public Dictionary GetValuesMap(List keys) - { - return this.TryCatch>(() => this.client.GetValuesMap(keys), keys[0]); - } - - public Dictionary GetValuesMap(List keys) - { - return this.TryCatch>(() => this.client.GetValuesMap(keys), keys[0]); - } - - public bool HashContainsEntry(string hashId, string key) - { - return this.TryCatch(() => this.client.HashContainsEntry(hashId, key), hashId); - } - - public double IncrementItemInSortedSet(string setId, string value, double incrementBy) - { - return this.TryCatch(() => this.client.IncrementItemInSortedSet(setId, value, incrementBy), setId); - } - - public double IncrementItemInSortedSet(string setId, string value, long incrementBy) - { - return this.TryCatch(() => this.client.IncrementItemInSortedSet(setId, value, incrementBy), setId); - } - - public long IncrementValue(string key) - { - return this.TryCatch(() => this.client.IncrementValue(key), key); - } - - public long IncrementValueBy(string key, int count) - { - return this.TryCatch(() => this.client.IncrementValueBy(key, count), key); - } - - public long IncrementValueInHash(string hashId, string key, int incrementBy) - { - return this.TryCatch(() => this.client.IncrementValueInHash(hashId, key, incrementBy), hashId); - } - - public void MoveBetweenSets(string fromSetId, string toSetId, string item) - { - this.TryCatch(delegate - { - this.client.MoveBetweenSets(fromSetId, toSetId, item); - }, fromSetId); - } - - public string PopAndPushItemBetweenLists(string fromListId, string toListId) - { - return this.TryCatch(() => this.client.PopAndPushItemBetweenLists(fromListId, toListId), fromListId); - } - - public string PopItemFromList(string listId) - { - return this.TryCatch(() => this.client.PopItemFromList(listId), listId); - } - - public string PopItemFromSet(string setId) - { - return this.TryCatch(() => this.client.PopItemFromSet(setId), setId); - } - - public string PopItemWithHighestScoreFromSortedSet(string setId) - { - return this.TryCatch(() => this.client.PopItemWithHighestScoreFromSortedSet(setId), setId); - } - - public string PopItemWithLowestScoreFromSortedSet(string setId) - { - return this.TryCatch(() => this.client.PopItemWithLowestScoreFromSortedSet(setId), setId); - } - - public void PrependItemToList(string listId, string value) - { - this.TryCatch(delegate - { - this.client.PrependItemToList(listId, value); - }, listId); - } - - public void PrependRangeToList(string listId, List values) - { - this.TryCatch(delegate - { - this.client.PrependRangeToList(listId, values); - }, listId); - } - - public long PublishMessage(string toChannel, string message) - { - return this.TryCatch(() => this.client.PublishMessage(toChannel, message), string.Empty); - } - - public void PushItemToList(string listId, string value) - { - this.TryCatch(delegate - { - this.client.PushItemToList(listId, value); - }, listId); - } - - public void RemoveAllFromList(string listId) - { - this.TryCatch(delegate - { - this.client.Remove(listId); - }, listId); - } - - public string RemoveEndFromList(string listId) - { - return this.TryCatch(() => this.client.RemoveEndFromList(listId), listId); - } - - public bool RemoveEntry(params string[] args) - { - return this.TryCatch(() => this.client.RemoveEntry(args), args[0]); - } - - public bool RemoveEntryFromHash(string hashId, string key) - { - return this.TryCatch(() => this.client.RemoveEntryFromHash(hashId, key), hashId); - } - - public long RemoveItemFromList(string listId, string value) - { - return this.TryCatch(() => this.client.RemoveItemFromList(listId, value), listId); - } - - public long RemoveItemFromList(string listId, string value, int noOfMatches) - { - return this.TryCatch(() => this.client.RemoveItemFromList(listId, value, noOfMatches), listId); - } - - public void RemoveItemFromSet(string setId, string item) - { - this.TryCatch(delegate - { - this.client.RemoveItemFromSet(setId, item); - }, setId); - } - - public bool RemoveItemFromSortedSet(string setId, string value) - { - return this.TryCatch(() => this.client.RemoveItemFromSortedSet(setId, value), setId); - } - /// - /// 骚操作-- redis 连接池-- 如果出现高并发,客户端的连接数量会上限,为了节省资源,重复利用连接对象,通过线程池去获取连接 - /// - /// - /// - /// - /// - public static IRedisClientsManager GetPoolClient(string host, int port, int db) - { - return new PooledRedisClientManager(db, host + ":" + port); - } - public long RemoveRangeFromSortedSet(string setId, int minRank, int maxRank) - { - return this.TryCatch(() => this.client.RemoveRangeFromSortedSet(setId, minRank, maxRank), setId); - } - - public long RemoveRangeFromSortedSetByScore(string setId, double fromScore, double toScore) - { - return this.TryCatch(() => this.client.RemoveRangeFromSortedSetByScore(setId, fromScore, toScore), setId); - } - - public long RemoveRangeFromSortedSetByScore(string setId, long fromScore, long toScore) - { - return this.TryCatch(() => this.client.RemoveRangeFromSortedSetByScore(setId, fromScore, toScore), setId); - } - - public string RemoveStartFromList(string listId) - { - return this.TryCatch(() => this.client.RemoveStartFromList(listId), listId); - } - - public void RenameKey(string fromName, string toName) - { - this.TryCatch(delegate - { - this.client.RenameKey(fromName, toName); - }, string.Empty); - } - - public List SearchKeys(string pattern) - { - return this.TryCatch>(() => this.client.SearchKeys(pattern), pattern); - } - - public void SetAll(Dictionary map) - { - this.TryCatch(delegate - { - this.client.SetAll(map); - }, string.Empty); - } - - public void SetAll(IEnumerable keys, IEnumerable values) - { - this.TryCatch(delegate - { - this.client.SetAll(keys, values); - }, string.Empty); - } - - public bool SetContainsItem(string setId, string item) - { - return this.TryCatch(() => this.client.SetContainsItem(setId, item), setId); - } - - public void SetEntry(string key, string value) - { - this.TryCatch(delegate - { - this.client.SetValue(key, value); - }, key); - } - - public void SetEntry(string key, string value, TimeSpan expireIn) - { - this.TryCatch(delegate - { - this.client.SetValue(key, value, expireIn); - }, key); - } - - public bool SetEntryIfNotExists(string key, string value) - { - return this.TryCatch(() => this.client.SetValueIfNotExists(key, value), key); - } - - public bool SetEntryInHash(string hashId, string key, string value) - { - return this.TryCatch(() => this.client.SetEntryInHash(hashId, key, value), hashId); - } - - public bool SetEntryInHashIfNotExists(string hashId, string key, string value) - { - return this.TryCatch(() => this.client.SetEntryInHashIfNotExists(hashId, key, value), hashId); - } - - public void SetItemInList(string listId, int listIndex, string value) - { - this.TryCatch(delegate - { - this.client.SetItemInList(listId, listIndex, value); - }, listId); - } - - public void SetRangeInHash(string hashId, IEnumerable> keyValuePairs) - { - this.TryCatch(delegate - { - this.client.SetRangeInHash(hashId, keyValuePairs); - }, hashId); - } - - public bool SortedSetContainsItem(string setId, string value) - { - return this.TryCatch(() => this.client.SortedSetContainsItem(setId, value), setId); - } - - public void StoreAsHash(T entity) - { - this.TryCatch(delegate - { - this.client.StoreAsHash(entity); - }, string.Empty); - } - - - public bool SetEntryInHash(string hashId, string key, T value) - { - return this.TryCatch(() => this.client.SetEntryInHash(hashId, key, TextExtensions.SerializeToString(value)), hashId); - } - - public T GetValueFromHash(string hashId, string key) - { - return this.TryCatch(() => JsonSerializer.DeserializeFromString(this.client.GetValueFromHash(hashId, key)), hashId); - } - - public bool SetEntryInHashIfNotExists(string hashId, string key, T value) - { - return this.TryCatch(() => this.client.SetEntryInHashIfNotExists(hashId, key, TextExtensions.SerializeToString(value)), hashId); - } - - public IDisposable AcquireLock(string key) - { - return this.TryCatch(() => this.client.AcquireLock(key), key); - } - - public IDisposable AcquireLock(string key, TimeSpan timeOut) - { - return this.TryCatch(() => this.client.AcquireLock(key, timeOut), key); - } - - - public DateTime GetServerTime() - { - return this.TryCatch(() => this.client.GetServerTime(), string.Empty); - } - - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/AbstractConsulDispatcher.cs b/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/AbstractConsulDispatcher.cs deleted file mode 100644 index b603875c..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/AbstractConsulDispatcher.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Consul; -using Microsoft.Extensions.Options; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Core.ConsulExtend -{ - public abstract class AbstractConsulDispatcher - { - protected ConsulClientOption _ConsulClientOption = null; - protected KeyValuePair[] _CurrentAgentServiceDictionary = null; - - public AbstractConsulDispatcher(IOptionsMonitor consulClientOption) - { - this._ConsulClientOption = consulClientOption.CurrentValue; - } - - /// - /// 负载均衡获取地址 - /// - /// Consul映射后的地址 - /// - public string GetAddress(string mappingUrl) - { - Uri uri = new Uri(mappingUrl); - string serviceName = uri.Host; - string addressPort = this.ChooseAddress(serviceName); - return $"{uri.Scheme}://{addressPort}{uri.PathAndQuery}"; - } - - protected virtual string ChooseAddress(string serviceName) - { - ConsulClient client = new ConsulClient(c => - { - c.Address = new Uri($"http://{this._ConsulClientOption.IP}:{this._ConsulClientOption.Port}/"); - c.Datacenter = this._ConsulClientOption.Datacenter; - }); - AgentService agentService = null; - //var response = client.Agent.Services().Result.Response; - ////foreach (var item in response) - ////{ - //// Console.WriteLine("***************************************"); - //// Console.WriteLine(item.Key); - //// var service = item.Value; - //// Console.WriteLine($"{service.Address}--{service.Port}--{service.Service}"); - //// Console.WriteLine("***************************************"); - ////} - - //this._CurrentAgentServiceDictionary = response.Where(s => s.Value.Service.Equals(serviceName, StringComparison.OrdinalIgnoreCase)).ToArray(); - - //升级consul实例获取 - var entrys = client.Health.Service(serviceName).Result.Response; - List> serviceList = new List>(); - for (int i = 0; i < entrys.Length; i++) - { - serviceList.Add(new KeyValuePair(i.ToString(), entrys[i].Service)); - } - this._CurrentAgentServiceDictionary = serviceList.ToArray(); - - int index = this.GetIndex(); - agentService = this._CurrentAgentServiceDictionary[index].Value; - - return $"{agentService.Address}:{agentService.Port}"; - } - - protected abstract int GetIndex(); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/AverageDispatcher.cs b/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/AverageDispatcher.cs deleted file mode 100644 index 905a6ea7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/AverageDispatcher.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Consul; -using Microsoft.Extensions.Options; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Core.ConsulExtend -{ - /// - /// 平均 - /// - public class AverageDispatcher : AbstractConsulDispatcher - { - #region Identity - private static int _iTotalCount = 0; - private static int iTotalCount - { - get - { - return _iTotalCount; - } - set - { - _iTotalCount = value >= Int32.MaxValue ? 0 : value; - } - } - - - public AverageDispatcher(IOptionsMonitor consulClientOption) : base(consulClientOption) - { - } - #endregion - - /// - /// 平均 - /// - /// - protected override int GetIndex() - { - return new Random(iTotalCount++).Next(0, base._CurrentAgentServiceDictionary.Length); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/PollingDispatcher.cs b/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/PollingDispatcher.cs deleted file mode 100644 index 882d7fbc..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/PollingDispatcher.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Consul; -using Microsoft.Extensions.Options; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Core.ConsulExtend -{ - /// - /// 轮询 - /// - public class PollingDispatcher : AbstractConsulDispatcher - { - #region Identity - private static int _iTotalCount = 0; - private static int iTotalCount - { - get - { - return _iTotalCount; - } - set - { - _iTotalCount = value >= Int32.MaxValue ? 0 : value; - } - } - - public PollingDispatcher(IOptionsMonitor consulClientOption) : base(consulClientOption) - { - } - #endregion - - /// - /// 轮询 - /// - /// - /// - protected override int GetIndex() - { - return iTotalCount++ % base._CurrentAgentServiceDictionary.Length; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/WeightDispatcher.cs b/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/WeightDispatcher.cs deleted file mode 100644 index 41a215f8..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/ConsulExtend/ClienExtend/WeightDispatcher.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Consul; -using Microsoft.Extensions.Options; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Core.ConsulExtend -{ - /// - /// 权重 - /// - public class WeightDispatcher : AbstractConsulDispatcher - { - #region Identity - private static int _iTotalCount = 0; - private static int iTotalCount - { - get - { - return _iTotalCount; - } - set - { - _iTotalCount = value >= Int32.MaxValue ? 0 : value; - } - } - public WeightDispatcher(IOptionsMonitor consulClientOption) : base(consulClientOption) - { - - } - #endregion - - protected override string ChooseAddress(string serviceName) - { - ConsulClient client = new ConsulClient(c => - { - c.Address = new Uri($"http://{base._ConsulClientOption.IP}:{base._ConsulClientOption.Port}/"); - c.Datacenter = base._ConsulClientOption.Datacenter; - }); - AgentService agentService = null; - var response = client.Agent.Services().Result.Response; - - this._CurrentAgentServiceDictionary = response.Where(s => s.Value.Service.Equals(serviceName, StringComparison.OrdinalIgnoreCase)).ToArray(); - - - var serviceDictionaryNew = new List(); - foreach (var service in base._CurrentAgentServiceDictionary) - { - serviceDictionaryNew.AddRange(Enumerable.Repeat(service.Value, int.TryParse(service.Value.Tags?[0], out int iWeight) ? 1 : iWeight)); - } - int index = new Random(DateTime.Now.Millisecond).Next(0, int.MaxValue) % serviceDictionaryNew.Count; - agentService = serviceDictionaryNew[index]; - - return $"{agentService.Address}:{agentService.Port}"; - } - /// - /// 不需要了 - /// - /// - protected override int GetIndex() - { - throw new NotImplementedException(); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/ElasticSearchInvoker.cs b/Yi.Framework.Net5/Yi.Framework.Core/ElasticSearchInvoker.cs deleted file mode 100644 index 4b4556cc..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/ElasticSearchInvoker.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.Extensions.Options; -using Nest; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Core -{ - public class ElasticSearchInvoker - { - private readonly ElasticSearchOptions _elasticSearchOptions; - - public ElasticSearchInvoker(IOptionsMonitor optionsMonitor) - { - _elasticSearchOptions = optionsMonitor.CurrentValue; - var settings = new ConnectionSettings(new Uri(_elasticSearchOptions.Url)).DefaultIndex(this._elasticSearchOptions.IndexName); - Client = new ElasticClient(settings); - } - private ElasticClient Client; - public ElasticClient GetElasticClient() - { - return Client; - } - public void Send(List model) where T : class - { - Client.IndexMany(model); - } - - public void InsertOrUpdata(T model) where T : class - { - Client.IndexDocument(model); - } - - public bool Delete(string id) where T : class - { - - var response = Client.Delete(id); - return response.IsValid; - } - public bool DropIndex(string indexName) - { - return Client.Indices.Delete(Indices.Parse(indexName)).IsValid; - } - public void CreateIndex(string indexName) - { - var settings = new ConnectionSettings(new Uri(_elasticSearchOptions.Url)).DefaultIndex(indexName); - this.Client = new ElasticClient(settings); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/Library/Microsoft.Bcl.AsyncInterfaces.dll b/Yi.Framework.Net5/Yi.Framework.Core/Library/Microsoft.Bcl.AsyncInterfaces.dll deleted file mode 100644 index c695bdd5..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.Core/Library/Microsoft.Bcl.AsyncInterfaces.dll and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Common.dll b/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Common.dll deleted file mode 100644 index f10b87b4..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Common.dll and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Interfaces.dll b/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Interfaces.dll deleted file mode 100644 index 4dbba7ef..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Interfaces.dll and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Redis.dll b/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Redis.dll deleted file mode 100644 index 5faefa26..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Redis.dll and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Text.dll b/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Text.dll deleted file mode 100644 index 2f701811..00000000 Binary files a/Yi.Framework.Net5/Yi.Framework.Core/Library/ServiceStack.Text.dll and /dev/null differ diff --git a/Yi.Framework.Net5/Yi.Framework.Core/MakeJwt.cs b/Yi.Framework.Net5/Yi.Framework.Core/MakeJwt.cs deleted file mode 100644 index 841351a2..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/MakeJwt.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Microsoft.IdentityModel.JsonWebTokens; -using Microsoft.IdentityModel.Tokens; -using System; -using System.Collections.Generic; -using System.IdentityModel.Tokens.Jwt; -using System.Linq; -using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.Const; -using Yi.Framework.Model.Models; -using JwtRegisteredClaimNames = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames; - -namespace Yi.Framework.Core -{ - - public class jwtUser - { - public user user { get; set; } - public List menuIds { get; set; } - - } - - public class MakeJwt - { - - /// - /// user需关联所有roles,还有一个menuIds - /// - /// - /// - public static string app(jwtUser _user) - { - //通过查询权限,把所有权限加入进令牌中 - List claims = new List(); - claims.Add(new Claim(JwtRegisteredClaimNames.Nbf, $"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}")); - claims.Add(new Claim(JwtRegisteredClaimNames.Exp, $"{new DateTimeOffset(DateTime.Now.AddMinutes(30)).ToUnixTimeSeconds()}")); - claims.Add(new Claim(ClaimTypes.Name, _user.user.username)); - claims.Add(new Claim(ClaimTypes.Sid, _user.user.id.ToString())); - foreach (var k in _user?.menuIds) - { - claims.Add(new Claim("menuIds",k.id.ToString())); - } - foreach (var k in _user.user.roles) - { - claims.Add(new Claim(ClaimTypes.Role, k.role_name)); - } - var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConst.SecurityKey)); - var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - - var token = new JwtSecurityToken( - issuer: JwtConst.Domain, - audience: JwtConst.Domain, - claims: claims, - expires: DateTime.Now.AddMinutes(30), - signingCredentials: creds); - var tokenData = new JwtSecurityTokenHandler().WriteToken(token); - - return tokenData; - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/Quartz/MyQuartzFactory.cs b/Yi.Framework.Net5/Yi.Framework.Core/Quartz/MyQuartzFactory.cs deleted file mode 100644 index 098989f7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/Quartz/MyQuartzFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Quartz; -using Quartz.Spi; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Core.Quartz -{ - public class MyQuartzFactory : IJobFactory - { - private readonly IServiceProvider _serviceProvider; - - public MyQuartzFactory(IServiceProvider serviceProvider) - { - _serviceProvider = serviceProvider; - } - - public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) - { - return _serviceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob; - } - - public void ReturnJob(IJob job) - { - var disposable = job as IDisposable; - disposable?.Dispose(); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/Quartz/QuartzInvoker.cs b/Yi.Framework.Net5/Yi.Framework.Core/Quartz/QuartzInvoker.cs deleted file mode 100644 index 7943078b..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/Quartz/QuartzInvoker.cs +++ /dev/null @@ -1,150 +0,0 @@ -using Microsoft.Extensions.Logging; -using Quartz; -using Quartz.Impl.Matchers; -using Quartz.Spi; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.Helper; -using Yi.Framework.Job; - -namespace Yi.Framework.Core -{ - public class QuartzInvoker - { - private readonly ISchedulerFactory _schedulerFactory; - private IScheduler _scheduler; - private ILogger _logger; - private IJobFactory _jobFactory; - public QuartzInvoker(ISchedulerFactory schedulerFactory, ILogger logger, IJobFactory jobFactory) - { - _schedulerFactory = schedulerFactory; - _logger = logger; - _jobFactory = jobFactory; - } - - /// - /// 开始任务 - /// - /// - /// - /// - /// - /// - /// - public async Task start(string cron, JobKey jobKey, string jobClass, long second = 0, IDictionary data = null) - { - if (data == null) - { - data = new Dictionary(); - } - - var myClass = AssemblyHelper.GetClass("Yi.Framework.Job", jobClass).FirstOrDefault(); - - _scheduler = await _schedulerFactory.GetScheduler(); - _scheduler.JobFactory = _jobFactory; - //开启调度器 - await _scheduler.Start(); - //创建一个触发器 - var trigger = TriggerBuilder.Create() - .StartAt(DateTimeOffset.Now.AddSeconds(second)) - .WithCronSchedule(cron) - .Build(); - //创建任务 - var jobDetail = JobBuilder.Create(myClass) - .UsingJobData(new JobDataMap(data)) - .WithIdentity(jobKey.Name, jobKey.Group) - .Build(); - //将触发器和任务器绑定到调度器中 - await _scheduler.ScheduleJob(jobDetail, trigger); - - _logger.LogWarning($"开始任务:{jobKey.Name},组别:{jobKey.Group}"); - } - - /// - /// 暂停任务 - /// - /// - /// - public async Task Stop(JobKey jobKey) - { - var _scheduler = await _schedulerFactory.GetScheduler(); - //LogUtil.Debug($"暂停任务{jobKey.Group},{jobKey.Name}"); - await _scheduler.PauseJob(jobKey); - _logger.LogWarning($"暂停任务:{jobKey.Name},组别:{jobKey.Group}"); - } - - - public async Task Delete(JobKey jobKey) - { - var _scheduler = await _schedulerFactory.GetScheduler(); - //LogUtil.Debug($"暂停任务{jobKey.Group},{jobKey.Name}"); - await _scheduler.DeleteJob(jobKey); - _logger.LogWarning($"删除任务:{jobKey.Name},组别:{jobKey.Group}"); - } - - public async Task Resume(JobKey jobKey) - { - var _scheduler = await _schedulerFactory.GetScheduler(); - //LogUtil.Debug($"恢复任务{jobKey.Group},{jobKey.Name}"); - await _scheduler.ResumeJob(jobKey); - _logger.LogWarning($"恢复任务:{jobKey.Name},组别:{jobKey.Group}"); - } - - - /// - /// 得到可运行的job列表 - /// - /// - public List getJobClassList() - { - var myClassList = AssemblyHelper.GetClass("Yi.Framework.Job"); - List data = new List(); - myClassList.ForEach(k => data.Add(k.Name)); - return data; - } - - /// - /// 得到现在正在运行的任务列表 - /// - /// - public async Task> getRunJobList() - { - _scheduler = await _schedulerFactory.GetScheduler(); - var groups = await _scheduler.GetJobGroupNames(); - var data = new List(); - foreach (var groupName in groups) - { - foreach (var jobKey in await _scheduler.GetJobKeys(GroupMatcher.GroupEquals(groupName))) - { - string jobName = jobKey.Name; - string jobGroup = jobKey.Group; - data.Add(jobKey); - var triggers = await _scheduler.GetTriggersOfJob(jobKey); - foreach (ITrigger trigger in triggers) - { - ///下一次的执行时间 - var utcTime =trigger.GetNextFireTimeUtc(); - string str = utcTime.ToString(); - //TimeZone.CurrentTimeZone.ToLocalTime(Convert.ToDateTime(str)); - - - } - } - } - - return data; - } - } - - - - public class JobKeyModel - { - public JobKey jobKey { get; set; } - public DateTime? nextTime { get; set; } - } -} - diff --git a/Yi.Framework.Net5/Yi.Framework.Core/RabbitMQInvoker.cs b/Yi.Framework.Net5/Yi.Framework.Core/RabbitMQInvoker.cs deleted file mode 100644 index b28fc22f..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/RabbitMQInvoker.cs +++ /dev/null @@ -1,257 +0,0 @@ -using Microsoft.Extensions.Options; -using RabbitMQ.Client; -using RabbitMQ.Client.Events; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Core -{ - /// - /// 一个Exchange----多个Queue-----弄个缓存映射关系,初始化+支持全新绑定 - /// 全局单例使用 - /// - /// 关系应该是直接配置到RabbitMQ了---程序只是向某个位置写入即可 - /// - /// - /// 全量更新--耗时---阻塞实时更新---换不同的exchange? - /// - public class RabbitMQInvoker - { - #region Identity - private readonly RabbitMQOptions _rabbitMQOptions; - private readonly string _HostName = null; - private readonly string _UserName = null; - private readonly string _Password = null; - private readonly int _Port = 0; - public RabbitMQInvoker(IOptionsMonitor optionsMonitor) : this(optionsMonitor.CurrentValue.HostName, optionsMonitor.CurrentValue.UserName, optionsMonitor.CurrentValue.Password,optionsMonitor.CurrentValue.Port) - { - this._rabbitMQOptions = optionsMonitor.CurrentValue; - } - - public RabbitMQInvoker(string hostName, string userName = "cc", string password = "cc",int port= 5672) - { - this._HostName = hostName; - this._UserName = userName; - this._Password = password; - this._Port = port; - } - #endregion - - #region Init - private static object RabbitMQInvoker_BindQueueLock = new object(); - private static Dictionary RabbitMQInvoker_ExchangeQueue = new Dictionary(); - private void InitBindQueue(RabbitMQConsumerModel rabbitMQConsumerModel) - { - if (!RabbitMQInvoker_ExchangeQueue.ContainsKey($"InitBindQueue_{rabbitMQConsumerModel.ExchangeName}_{rabbitMQConsumerModel.QueueName}")) - { - lock (RabbitMQInvoker_BindQueueLock) - { - if (!RabbitMQInvoker_ExchangeQueue.ContainsKey($"InitBindQueue_{rabbitMQConsumerModel.ExchangeName}_{rabbitMQConsumerModel.QueueName}")) - { - this.InitConnection(); - using (IModel channel = _CurrentConnection.CreateModel()) - { - channel.ExchangeDeclare(exchange: rabbitMQConsumerModel.ExchangeName, type: ExchangeType.Fanout, durable: true, autoDelete: false, arguments: null); - channel.QueueDeclare(queue: rabbitMQConsumerModel.QueueName, durable: true, exclusive: false, autoDelete: false, arguments: null); - channel.QueueBind(queue: rabbitMQConsumerModel.QueueName, exchange: rabbitMQConsumerModel.ExchangeName, routingKey: string.Empty, arguments: null); - } - RabbitMQInvoker_ExchangeQueue[$"InitBindQueue_{rabbitMQConsumerModel.ExchangeName}_{rabbitMQConsumerModel.QueueName}"] = true; - } - } - } - } - /// - /// 必须先声明exchange--检查+初始化 - /// - /// - private void InitExchange(string exchangeName) - { - if (!RabbitMQInvoker_ExchangeQueue.ContainsKey($"InitExchange_{exchangeName}"))//没用api确认 - { - lock (RabbitMQInvoker_BindQueueLock) - { - if (!RabbitMQInvoker_ExchangeQueue.ContainsKey($"InitExchange_{exchangeName}")) - { - this.InitConnection(); - using (IModel channel = _CurrentConnection.CreateModel()) - { - channel.ExchangeDeclare(exchange: exchangeName, type: ExchangeType.Fanout, durable: true, autoDelete: false, arguments: null); - } - RabbitMQInvoker_ExchangeQueue[$"InitExchange_{exchangeName}"] = true; - } - } - } - } - //public void UnBindQueue(string exchangeName, string queueName) - //{ - //} - - private static object RabbitMQInvoker_InitLock = new object(); - private static IConnection _CurrentConnection = null;//链接做成单例重用--channel是新的 - private void InitConnection() - { - //https://blog.csdn.net/weixin_30646315/article/details/99101279 - if (_CurrentConnection == null || !_CurrentConnection.IsOpen) - { - lock (RabbitMQInvoker_InitLock) - { - if (_CurrentConnection == null || !_CurrentConnection.IsOpen) - { - var factory = new ConnectionFactory() - { - HostName = this._HostName, - Password = this._Password, - UserName = this._UserName, - Port=this._Port - - }; - _CurrentConnection = factory.CreateConnection(); - } - } - } - } - #endregion - - /// - /// 只管exchange--- - /// 4种路由类型? - /// - /// Send前完成交换机初始化 - /// - /// - /// 建议Json格式 - public void Send(RabbitMQConsumerModel rabbitMQConsumerModel, string message) - { - this.InitExchange(rabbitMQConsumerModel.ExchangeName); - this.InitBindQueue(rabbitMQConsumerModel); - if (_CurrentConnection == null || !_CurrentConnection.IsOpen) - { - this.InitConnection(); - } - using (var channel = _CurrentConnection.CreateModel())//开辟新的信道通信 - { - try - { - channel.TxSelect();//开启Tx事务---RabbitMQ协议级的事务-----强事务 - - var body = Encoding.UTF8.GetBytes(message); - channel.BasicPublish(exchange: rabbitMQConsumerModel.ExchangeName, - routingKey: string.Empty, - basicProperties: null, - body: body); - channel.TxCommit();//提交 - Console.WriteLine($" [x] Sent {body.Length}"); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - Console.WriteLine($"【{message}】发送到Broker失败!{ex.Message}"); - channel.TxRollback(); //事务回滚--前面的所有操作就全部作废了。。。。 - } - } - } - - /// - /// 固定无消费队列名字---转移到目标队列---定好时间 - /// - /// - /// - /// - public void SendDelay(string targetExchangeName, string message, int delaySecond) - { - this.InitExchange(targetExchangeName); - - if (_CurrentConnection == null || !_CurrentConnection.IsOpen) - { - this.InitConnection(); - } - using (var channel = _CurrentConnection.CreateModel())//开辟新的信道通信 - { - try - { - string delayExchangeName = "ZhaoxiMSA_DelayExchange"; - - //普通交换器 - channel.ExchangeDeclare(delayExchangeName, "fanout", true, false, null); - //参数设置 - Dictionary args = new Dictionary(); - args.Add("x-message-ttl", delaySecond * 1000);//TTL 毫秒 - args.Add("x-dead-letter-exchange", targetExchangeName);//DLX - args.Add("x-dead-letter-routing-key", "routingkey");//routingKey - channel.QueueDeclare("ZhaoxiMSA_DelayQueue", true, false, false, args); - channel.QueueBind(queue: "ZhaoxiMSA_DelayQueue", - exchange: delayExchangeName, - routingKey: string.Empty, - arguments: null); - - ////DLX--- //死信队列绑定 - //channel.ExchangeDeclare("ZhaoxiMSA_exchange_dlx", "fanout", true, false, null); - //channel.QueueDeclare("ZhaoxiMSA_queue_dlx", true, false, false, null); - //channel.QueueBind("ZhaoxiMSA_queue_dlx", "ZhaoxiMSA_exchange_dlx", "routingkey", null); - - - channel.TxSelect();//开启Tx事务---RabbitMQ协议级的事务-----强事务 - var properties = channel.CreateBasicProperties(); - - var body = Encoding.UTF8.GetBytes(message); - channel.BasicPublish(exchange: delayExchangeName, - routingKey: string.Empty, - basicProperties: properties, - body: body); - channel.TxCommit();//提交 - Console.WriteLine($" [x] Sent {body.Length}"); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - Console.WriteLine($"【{message}】发送到Broker失败!{ex.Message}"); - channel.TxRollback(); //事务回滚--前面的所有操作就全部作废了。。。。 - } - } - } - - #region Receive - /// - /// 注册处理动作 - /// - /// - /// - public void RegistReciveAction(RabbitMQConsumerModel rabbitMQConsumerMode, Func func) - { - this.InitBindQueue(rabbitMQConsumerMode); - - Task.Run(() => - { - using (var channel = _CurrentConnection.CreateModel()) - { - var consumer = new EventingBasicConsumer(channel); - channel.BasicQos(0, 0, true); - consumer.Received += (sender, ea) => - { - string str = Encoding.UTF8.GetString(ea.Body.ToArray()); - if (func(str)) - { - channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);//确认已消费 - } - else - { - //channel.BasicReject(deliveryTag: ea.DeliveryTag, requeue: true);//放回队列--重新包装信息,放入其他队列 - } - }; - channel.BasicConsume(queue: rabbitMQConsumerMode.QueueName, - autoAck: false,//不ACK - consumer: consumer); - Console.WriteLine($" Register Consumer To {rabbitMQConsumerMode.ExchangeName}-{rabbitMQConsumerMode.QueueName}"); - Console.ReadLine(); - Console.WriteLine($" After Register Consumer To {rabbitMQConsumerMode.ExchangeName}-{rabbitMQConsumerMode.QueueName}"); - } - }); - } - #endregion - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/SMS/AliyunSMSInvoker.cs b/Yi.Framework.Net5/Yi.Framework.Core/SMS/AliyunSMSInvoker.cs deleted file mode 100644 index eb5bcb4c..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/SMS/AliyunSMSInvoker.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.Extensions.Options; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Core.SMS -{ - public class AliyunSMSInvoker - { - private IOptionsMonitor _sMSOptions; - public AliyunSMSInvoker(IOptionsMonitor sMSOptions) - { - _sMSOptions = sMSOptions; - } - private static AlibabaCloud.SDK.Dysmsapi20170525.Client CreateClient(string accessKeyId, string accessKeySecret) - { - AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config - { - // 您的AccessKey ID - AccessKeyId = accessKeyId, - // 您的AccessKey Secret - AccessKeySecret = accessKeySecret, - }; - // 访问的域名 - config.Endpoint = "dysmsapi.aliyuncs.com"; - return new AlibabaCloud.SDK.Dysmsapi20170525.Client(config); - } - - public void SendCode(string code,string phone) - { - AlibabaCloud.SDK.Dysmsapi20170525.Client client = CreateClient(_sMSOptions.CurrentValue.ID, _sMSOptions.CurrentValue.Secret); - AlibabaCloud.SDK.Dysmsapi20170525.Models.SendSmsRequest sendSmsRequest = new AlibabaCloud.SDK.Dysmsapi20170525.Models.SendSmsRequest - { - PhoneNumbers = phone, - SignName = _sMSOptions.CurrentValue.Sign, - TemplateCode = _sMSOptions.CurrentValue.Template, - TemplateParam = "{\"code\":\""+ code + "\"}", - }; - // 复制代码运行请自行打印 API 的返回值 - client.SendSms(sendSmsRequest); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/TreeMenuBuild.cs b/Yi.Framework.Net5/Yi.Framework.Core/TreeMenuBuild.cs deleted file mode 100644 index 14b0e6f8..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/TreeMenuBuild.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Core -{ - public static class TreeMenuBuild - { - /// - /// 过滤所有已经删除的菜单 - /// - /// - /// - public static menu Normal(menu menu_data) - { - for (int i = menu_data.children.Count() - 1; i >= 0; i--) - { - if (menu_data.children[i].is_delete == (short)Common.Enum.DelFlagEnum.Deleted) - { - menu_data.children.Remove(menu_data.children[i]); - } - else if (menu_data.children[i] != null) - { - Normal(menu_data.children[i]); - } - } - return menu_data; - } - - - - public static menu ShowFormat(menu menu_data, List allMenuIds) - { - return Format(Show(menu_data, allMenuIds)); - } - - - - /// - /// 过滤用户不展示及已删除及未拥有的菜单 - /// - /// - /// - /// - private static menu Show(menu menu_data, List allMenuIds) - { - for (int i = menu_data.children.Count() - 1; i >= 0; i--) - { - if (!allMenuIds.Contains(menu_data.children[i].id) || menu_data.children[i].is_delete == (short)Common.Enum.DelFlagEnum.Deleted || menu_data.children[i].is_show == (short)Common.Enum.ShowFlagEnum.NoShow) - { - menu_data.children.Remove(menu_data.children[i]); - } - else - { - Show(menu_data.children[i], allMenuIds); - } - } - return menu_data; - } - - /// - /// 为了匹配前端格式,通常和show方法一起 - /// - /// - /// - private static menu Format(menu menu_data) - { - for (int i = menu_data.children.Count() - 1; i >= 0; i--) - { - if (menu_data.children[i].icon == null) - { - menu_data.children[i].icon = "mdi-view-dashboard"; - } - if (menu_data.children != null || menu_data.children.Count() != 0) - { - Format(menu_data.children[i]); - } - } - if (menu_data.children.Count() == 0) - { - menu_data.children = null; - } - - return menu_data; - } - - public static menu Sort(menu menu_data) - { - if (menu_data.children != null) - { - for (int i = menu_data.children.Count() - 1; i >= 0; i--) - { - menu_data.children = menu_data.children.AsEnumerable().OrderByDescending(u => u.sort).ToList(); - - if (menu_data.children != null || menu_data.children.Count() != 0) - { - Sort(menu_data.children[i]); - } - } - } - return menu_data; - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Core/Yi.Framework.Core.csproj b/Yi.Framework.Net5/Yi.Framework.Core/Yi.Framework.Core.csproj deleted file mode 100644 index 50204716..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Core/Yi.Framework.Core.csproj +++ /dev/null @@ -1,43 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - - - - - - - - - - - - Library\Microsoft.Bcl.AsyncInterfaces.dll - - - Library\ServiceStack.Common.dll - - - Library\ServiceStack.Interfaces.dll - - - Library\ServiceStack.Redis.dll - - - Library\ServiceStack.Text.dll - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.DTOModel/ChangePwdDto.cs b/Yi.Framework.Net5/Yi.Framework.DTOModel/ChangePwdDto.cs deleted file mode 100644 index d8db8c1e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.DTOModel/ChangePwdDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.DTOModel -{ - public class ChangePwdDto - { - public user user { get; set; } - public string newPassword { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.DTOModel/ChildrenDto.cs b/Yi.Framework.Net5/Yi.Framework.DTOModel/ChildrenDto.cs deleted file mode 100644 index 18ee3742..00000000 --- a/Yi.Framework.Net5/Yi.Framework.DTOModel/ChildrenDto.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.DTOModel -{ - public class ChildrenDto - { - public int parentId { get; set; } - public T data { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.DTOModel/IdsDto.cs b/Yi.Framework.Net5/Yi.Framework.DTOModel/IdsDto.cs deleted file mode 100644 index 94a2ab1d..00000000 --- a/Yi.Framework.Net5/Yi.Framework.DTOModel/IdsDto.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Yi.Framework.DTOModel -{ - public class IdDto - { - public T id1 { get; set; } - public T id2 { get; set; } - } - - public class IdsDto - { - public T id{ get; set; } - public List ids { get; set; } - } - - public class IdsListDto - { - public List ids1 { get; set; } - public List ids2 { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.DTOModel/SettingDto.cs b/Yi.Framework.Net5/Yi.Framework.DTOModel/SettingDto.cs deleted file mode 100644 index 3e3dca70..00000000 --- a/Yi.Framework.Net5/Yi.Framework.DTOModel/SettingDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.DTOModel -{ - public class SettingDto - { - public string InitIcon { get; set; } - public string InitRole { get; set; } - public string Title { get; set; } - public List ImageList { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.DTOModel/Yi.Framework.DTOModel.csproj b/Yi.Framework.Net5/Yi.Framework.DTOModel/Yi.Framework.DTOModel.csproj deleted file mode 100644 index 7f350e24..00000000 --- a/Yi.Framework.Net5/Yi.Framework.DTOModel/Yi.Framework.DTOModel.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - net5.0 - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/InitESIndexWorker.cs b/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/InitESIndexWorker.cs deleted file mode 100644 index f18a0372..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/InitESIndexWorker.cs +++ /dev/null @@ -1,84 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Common.Models; -using Yi.Framework.Core; - -namespace Yi.Framework.ElasticSearchProcessor -{ - public class InitESIndexWorker : BackgroundService - { - private readonly IConfiguration _configuration; - private readonly ILogger _logger; - private readonly RabbitMQInvoker _RabbitMQInvoker; - private readonly ElasticSearchInvoker _elasticSearchInvoker; - - public InitESIndexWorker(ILogger logger, RabbitMQInvoker rabbitMQInvoker, IConfiguration configuration, ElasticSearchInvoker elasticSearchInvoker) - { - this._logger = logger; - this._RabbitMQInvoker = rabbitMQInvoker; - this._configuration = configuration; - this._elasticSearchInvoker = elasticSearchInvoker; - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - RabbitMQConsumerModel rabbitMQConsumerModel = new RabbitMQConsumerModel() - { - ExchangeName = RabbitMQExchangeQueueName.SKUCQRS_Exchange, - QueueName = RabbitMQExchangeQueueName.SKUCQRS_Queue_ESIndex - }; - HttpClient _HttpClient = new HttpClient(); - this._RabbitMQInvoker.RegistReciveAction(rabbitMQConsumerModel, message => - { - try - { - //õģ͡ - //SPUCQRSQueueModel spuCQRSQueueModel = JsonConvert.DeserializeObject(message); - - //жɾģesӦIJ - //switch (spuCQRSQueueModel.CQRSType) - //{ - // case (int)SPUCQRSQueueModelType.Insert: - // case (int)SPUCQRSQueueModelType.Update: - // { - // Goods goods = this._ISearchService.GetGoodsBySpuId(spuCQRSQueueModel.SpuId); - // this._IElasticSearchService.InsertOrUpdata(goods); - // break; - // } - // case (int)SPUCQRSQueueModelType.Delete: - // this._IElasticSearchService.Delete(spuCQRSQueueModel.SpuId.ToString()); - // break; - // default: - // throw new Exception("wrong spuCQRSQueueModel.CQRSType"); - //} - - this._logger.LogInformation($"{nameof(InitESIndexWorker)}.Init ESIndex succeed SpuId"); - return true; - } - catch (Exception ex) - { - LogModel logModel = new LogModel() - { - OriginalClassName = this.GetType().FullName, - OriginalMethodName = nameof(ExecuteAsync), - Remark = "ʱҵ־" - }; - this._logger.LogError(ex, $"{nameof(InitESIndexWorker)}.Init ESIndex failed message={message}, Exception:{ex.Message}", JsonConvert.SerializeObject(logModel)); - return false; - } - }); - await Task.CompletedTask; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Log4net.config b/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Log4net.config deleted file mode 100644 index 958c7e78..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Log4net.config +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Program.cs b/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Program.cs deleted file mode 100644 index b0e05774..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Program.cs +++ /dev/null @@ -1,68 +0,0 @@ - -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using Yi.Framework.WebCore; -using Yi.Framework.WebCore.BuilderExtend; -using Yi.Framework.WebCore.MiddlewareExtend; - -namespace Yi.Framework.ElasticSearchProcessor -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureAppConfiguration((hostBuilderContext, configurationBuilder) => - { - configurationBuilder.AddCommandLine(args); - configurationBuilder.AddJsonFileService(); - //configurationBuilder.AddJsonFile("configuration.json", optional: false, reloadOnChange: true); - #region - //Apollo配置 - #endregion - //configurationBuilder.AddApolloService("Yi"); - }) - .ConfigureLogging(loggingBuilder => - { - loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddLog4Net(); - }) - .ConfigureServices((hostContext, services) => - { - - IConfiguration configuration = services.BuildServiceProvider().GetRequiredService(); - - #region - //Ioc配置 - #endregion - services.AddSingleton(new Appsettings(configuration)); - - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); - #region 服务注入 - //services.Configure(configuration.GetSection("MysqlConn")); - - - #region - //RabbitMQ服务配置 - #endregion - services.AddRabbitMQService(); - #endregion - - #region Consul - //services.Configure(configuration.GetSection("ConsulClientOption")); - //services.AddTransient(); - #endregion - - }); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/WarmupESIndexWorker.cs b/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/WarmupESIndexWorker.cs deleted file mode 100644 index 8c57cb58..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/WarmupESIndexWorker.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Common.Models; -using Yi.Framework.Common.QueueModel; -using Yi.Framework.Core; -using Yi.Framework.Interface; - -namespace Yi.Framework.ElasticSearchProcessor -{ - public class WarmupESIndexWorker : BackgroundService - { - private readonly IConfiguration _configuration; - private readonly ILogger _logger; - private readonly RabbitMQInvoker _RabbitMQInvoker; - private readonly ElasticSearchInvoker _elasticSearchInvoker; - private readonly IOptionsMonitor _ElasticSearchOptions = null; - - - public WarmupESIndexWorker(ILogger logger, RabbitMQInvoker rabbitMQInvoker, IConfiguration configuration, ElasticSearchInvoker elasticSearchInvoker, IOptionsMonitor optionsMonitor) - { - this._logger = logger; - this._RabbitMQInvoker = rabbitMQInvoker; - this._configuration = configuration; - this._elasticSearchInvoker = elasticSearchInvoker; - this._ElasticSearchOptions = optionsMonitor; - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - RabbitMQConsumerModel rabbitMQConsumerModel = new RabbitMQConsumerModel() - { - ExchangeName = RabbitMQExchangeQueueName.SKUWarmup_Exchange, - QueueName = RabbitMQExchangeQueueName.SKUWarmup_Queue_ESIndex - }; - HttpClient _HttpClient = new HttpClient(); - this._RabbitMQInvoker.RegistReciveAction(rabbitMQConsumerModel, message => - { - //SKUWarmupQueueModel skuWarmupQueueModel = JsonConvert.DeserializeObject(message); - //õϢģ͡ - #region ɾIndex---½Index---ٽȫ - { - try - { - this._elasticSearchInvoker.DropIndex(this._ElasticSearchOptions.CurrentValue.IndexName); - //this._searchService.ImpDataBySpu(); - //esݵ - this._logger.LogInformation($"{nameof(WarmupESIndexWorker)}.InitAll succeed"); - return true; - } - catch (Exception ex) - { - var logModel = new LogModel() - { - OriginalClassName = this.GetType().FullName, - OriginalMethodName = nameof(ExecuteAsync), - Remark = "ʱҵ־" - }; - this._logger.LogError(ex, $"{nameof(WarmupESIndexWorker)}.Warmup ESIndex failed message={message}, Exception:{ex.Message}", JsonConvert.SerializeObject(logModel)); - return false; - } - } - #endregion - }); - await Task.CompletedTask; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Worker.cs b/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Worker.cs deleted file mode 100644 index 2966fab6..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Worker.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace Yi.Framework.ElasticSearchProcessor -{ - public class Worker : BackgroundService - { - private readonly ILogger _logger; - - public Worker(ILogger logger) - { - _logger = logger; - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - while (!stoppingToken.IsCancellationRequested) - { - _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); - await Task.Delay(100000, stoppingToken); - } - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Yi.Framework.ElasticSearchProcessor.csproj b/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Yi.Framework.ElasticSearchProcessor.csproj deleted file mode 100644 index 93993039..00000000 --- a/Yi.Framework.Net5/Yi.Framework.ElasticSearchProcessor/Yi.Framework.ElasticSearchProcessor.csproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - net5.0 - - - - - - - - - - PreserveNewest - true - PreserveNewest - - - PreserveNewest - true - PreserveNewest - - - - - - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/IBaseService.cs b/Yi.Framework.Net5/Yi.Framework.Interface/IBaseService.cs deleted file mode 100644 index 2e9e8a03..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/IBaseService.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Interface -{ - public interface IBaseService where T : class, new() - { - #region - //通过id得到实体 - #endregion - Task GetEntityById(int id); - - #region - //通过表达式得到实体 - #endregion - Task GetEntity(Expression> whereLambda); - - #region - //得到全部实体 - #endregion - Task> GetAllEntitiesAsync(); - - #region - //通过表达式得到实体 - #endregion - Task> GetEntitiesAsync(Expression> whereLambda); - - #region - //通过表达式得到实体,分页版本 - #endregion - Task GetCountAsync(Expression> whereLambda); - - #region - //通过表达式统计数量 - #endregion - IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda); - - #region - //通过表达式分组 - #endregion - Task, int>> GetPageEntities(int pageSize, int pageIndex, Expression> whereLambda, Expression> orderByLambda, bool isAsc); - - #region - //添加实体 - #endregion - Task AddAsync(T entity); - - #region - //添加多个实体 - #endregion - Task AddAsync(IEnumerable entities); - - #region - //更新实体 - #endregion - Task UpdateAsync(T entity); - - #region - //更新多个实体 - #endregion - Task UpdateListAsync(IEnumerable entities); - - #region - //更新实体部分属性 - #endregion - Task DeleteAsync(T entity); - - #region - //删除实体 - #endregion - Task DeleteAsync(int id); - - #region - //通过id删除实体 - #endregion - Task DeleteAsync(IEnumerable ids); - - #region - //通过id列表删除多个实体 - #endregion - Task DeleteAsync(Expression> where); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/IMenuService.cs b/Yi.Framework.Net5/Yi.Framework.Interface/IMenuService.cs deleted file mode 100644 index aafce7e3..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/IMenuService.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Interface -{ - public partial interface IMenuService:IBaseService - { - /// - /// 获取所有菜单,关联接口 - /// 这个是要递归的,但是要过滤掉删除的,所以,可以写一个通用过滤掉删除的方法 - /// - /// - Task GetMenuInMould(); - /// - /// 增 - /// 现在,top菜单只允许为一个 - /// - /// - Task AddTopMenu(menu _menu); - /// - /// 给一个菜单设置一个接口,Id1为菜单id,Id2为接口id - /// 用于给菜单设置接口 - /// - /// - Task SetMouldByMenu(int id1, int id2); - /// - /// 给一个菜单添加子节点(注意:添加,不是覆盖) - /// - /// - Task AddChildrenMenu(int menu_id, menu _children); - /// - /// 获取用户的目录菜单,不包含接口 - /// 用于账户信息页面,显示这个用户有哪些菜单,需要并列 - /// - /// - Task> GetTopMenusByTopMenuIds(List menuIds); - Task> GetTopMenuByUserId(int userId); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/IMouldService.cs b/Yi.Framework.Net5/Yi.Framework.Interface/IMouldService.cs deleted file mode 100644 index a9708a21..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/IMouldService.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Interface -{ - public partial interface IMouldService : IBaseService - { - - - /// - /// 得到该接口属于哪个菜单的 - /// - /// - /// - Task GetMenuByMould(mould _mould); - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/IRoleService.cs b/Yi.Framework.Net5/Yi.Framework.Interface/IRoleService.cs deleted file mode 100644 index 5b0ea14e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/IRoleService.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Interface -{ - public partial interface IRoleService:IBaseService - { - - /// - /// 获取该角色的所有菜单 - /// - /// - /// - Task> GetMenusByRole(int roleId); - - /// - /// 给多个角色设置多个菜单 - /// - /// - /// - /// - Task SetMenusByRolesId(List menuIds, List roleIds); - /// - /// 获取多个用户的菜单,并列,不包含子菜单 - /// - /// - /// - Task> GetMenusByRoleId(List roleIds); - /// - /// 获取用户的角色 - /// - /// - /// - Task> GetRolesByUserId(int userId); - /// - /// 获取该角色的top菜单 - /// - /// - /// - Task> GetTopMenusByRoleId(int roleId); - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/IUserService.cs b/Yi.Framework.Net5/Yi.Framework.Interface/IUserService.cs deleted file mode 100644 index 86f11bce..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/IUserService.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Interface -{ - public partial interface IUserService:IBaseService - { - - /// - /// 登录,传入_user需包含用户名与密码/角色 - /// - /// - Task Login(user _user); - - /// - /// 注册,需要检测是否用户名重复 - /// - /// - Task Register(user _user); - /// - /// 给多个用户设置多个角色 - /// - /// - /// - /// - Task SetRoleByUser(List roleIds, List userIds); - /// - /// 通过id获取用户信息,关联角色、菜单、子菜单、接口 - /// - /// - /// - Task GetUserById(int userId); - /// - /// email验证 - /// - /// - /// - Task EmailIsExsit(string emailAddress); - - /// - /// sms验证 - /// - /// - /// - Task PhoneIsExsit(string smsAddress); - - /// - /// 通过用户id,得到该用户的所有信息,关联角色 - /// - /// - /// - Task GetUserInRolesByHttpUser(int userId); - /// - /// 通过http获取用户id,得到该用户所有的菜单(递归的那种),把所有children为[]的值全部过滤成null,不要绑定mould - /// - /// - /// - Task GetMenuByHttpUser(List allMenuIds); - /// - /// 根据路由获取菜单 - /// - /// - /// - Task> GetAxiosByRouter(string router,int userId, List menuIds); - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/T4Iservice.cs b/Yi.Framework.Net5/Yi.Framework.Interface/T4Iservice.cs deleted file mode 100644 index bf91c56d..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/T4Iservice.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Interface -{ - - public partial interface IMenuService:IBaseService - { - Task DelListByUpdateAsync(List _ids); - Task> GetAllEntitiesTrueAsync(); - } - - public partial interface IMouldService:IBaseService - { - Task DelListByUpdateAsync(List _ids); - Task> GetAllEntitiesTrueAsync(); - } - - public partial interface IRoleService:IBaseService - { - Task DelListByUpdateAsync(List _ids); - Task> GetAllEntitiesTrueAsync(); - } - - public partial interface IUserService:IBaseService - { - Task DelListByUpdateAsync(List _ids); - Task> GetAllEntitiesTrueAsync(); - } - - public partial interface IVisitService:IBaseService - { - Task DelListByUpdateAsync(List _ids); - Task> GetAllEntitiesTrueAsync(); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/T4Iservice.tt b/Yi.Framework.Net5/Yi.Framework.Interface/T4Iservice.tt deleted file mode 100644 index 0357f5a4..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/T4Iservice.tt +++ /dev/null @@ -1,43 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.IO" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string dirPath= Path.Combine(solutionsPath,@"Yi.Framework.Model\Models\"); - DirectoryInfo dir = new DirectoryInfo(dirPath); - FileInfo[] finfo = dir.GetFiles(); - string filenames = string.Empty; - List filenameList = new List(); - for (int i = 0; i < finfo.Length; i++) - { - filenames = finfo[i].Name ; - string[] fname=filenames.Split('.'); - filenameList.Add(fname[0]); - } - - -#> -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Interface -{ - <# foreach(string k in filenameList){ - string fn= k.Substring(0,1).ToUpper()+k.Substring(1); - #> - - public partial interface I<#= fn #>Service:IBaseService<<#= k #>> - { - Task DelListByUpdateAsync(List _ids); - Task>> GetAllEntitiesTrueAsync(); - } -<# } #> -} diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/Yi - Backup.Framework.Interface.csproj b/Yi.Framework.Net5/Yi.Framework.Interface/Yi - Backup.Framework.Interface.csproj deleted file mode 100644 index 289ee267..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/Yi - Backup.Framework.Interface.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Interface/Yi.Framework.Interface.csproj b/Yi.Framework.Net5/Yi.Framework.Interface/Yi.Framework.Interface.csproj deleted file mode 100644 index 54e221d2..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Interface/Yi.Framework.Interface.csproj +++ /dev/null @@ -1,42 +0,0 @@ - - - - net5.0 - - - - - - - - - True - True - T4Iservice.tt - - - - - - - - - - T4Iservice.cs - TextTemplatingFileGenerator - - - - - - - - - - True - True - T4IService.tt - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.MSUnitTest/UnitTest1.cs b/Yi.Framework.Net5/Yi.Framework.MSUnitTest/UnitTest1.cs deleted file mode 100644 index 67df934b..00000000 --- a/Yi.Framework.Net5/Yi.Framework.MSUnitTest/UnitTest1.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Yi.Framework.MSUnitTest -{ - [TestClass] - public class UnitTest1 - { - [TestMethod] - public void TestMethod1() - { - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.MSUnitTest/Yi.Framework.MSUnitTest.csproj b/Yi.Framework.Net5/Yi.Framework.MSUnitTest/Yi.Framework.MSUnitTest.csproj deleted file mode 100644 index db7e1fed..00000000 --- a/Yi.Framework.Net5/Yi.Framework.MSUnitTest/Yi.Framework.MSUnitTest.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net5.0 - - false - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Model/BaseModels/baseModel.cs b/Yi.Framework.Net5/Yi.Framework.Model/BaseModels/baseModel.cs deleted file mode 100644 index 0229e997..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/BaseModels/baseModel.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Model.Models -{ - public class baseModel - { - [Key] - [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] - public T id { get; set; } - public int is_delete { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/BaseModels/loopModel.cs b/Yi.Framework.Net5/Yi.Framework.Model/BaseModels/loopModel.cs deleted file mode 100644 index dd2f16fd..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/BaseModels/loopModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Model.Models -{ - public class loopModel:baseModel - { - public int is_top { get; set; } - public int sort { get; set; } - public int is_show { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/DataContext.cs b/Yi.Framework.Net5/Yi.Framework.Model/DataContext.cs deleted file mode 100644 index 40cd5730..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/DataContext.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Options; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.Const; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Model -{ - //Add-Migration yi-1 - //Update-Database yi-1 - public partial class DataContext : DbContext - { - //private readonly IOptionsMonitor _optionsMonitor; - public static string _connStr; - public static string DbSelect = DbConst.Mysql; - //public DataContext(IOptionsMonitor optionsMonitor) - //{ - // _optionsMonitor = optionsMonitor; - // _connStr = _optionsMonitor.CurrentValue.WriteUrl; - //} - public DbContext ToWriteOrRead(string connstr) - { - _connStr = connstr; - return this; - } - - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if (!optionsBuilder.IsConfigured) - { - switch (DbSelect) - { - case DbConst.Mysql: - var serverVersion = new MySqlServerVersion(new Version(8, 0, 21)); - optionsBuilder.UseMySql(_connStr, serverVersion); break; - case DbConst.Sqlite: - optionsBuilder.UseSqlite(_connStr); break; - case DbConst.Sqlserver: - optionsBuilder.UseSqlServer(_connStr);break; - case DbConst.Oracle: - optionsBuilder.UseOracle(_connStr);break; - default: - Console.WriteLine("错误!请确保你选择了正确的数据库!");break; - } - } - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080544_ec1.Designer.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080544_ec1.Designer.cs deleted file mode 100644 index 98620124..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080544_ec1.Designer.cs +++ /dev/null @@ -1,219 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Yi.Framework.Model; - -namespace Yi.Framework.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20211106080544_ec1")] - partial class ec1 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 64) - .HasAnnotation("ProductVersion", "5.0.11"); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_show") - .HasColumnType("int"); - - b.Property("is_top") - .HasColumnType("int"); - - b.Property("menu_name") - .HasColumnType("longtext"); - - b.Property("menuid") - .HasColumnType("int"); - - b.Property("mouldid") - .HasColumnType("int"); - - b.Property("roleid") - .HasColumnType("int"); - - b.Property("router") - .HasColumnType("longtext"); - - b.Property("sort") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("menuid"); - - b.HasIndex("mouldid"); - - b.HasIndex("roleid"); - - b.ToTable("menu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.mould", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("mould_name") - .HasColumnType("longtext"); - - b.Property("url") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("introduce") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("role_name") - .HasColumnType("longtext"); - - b.Property("userid") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("userid"); - - b.ToTable("role"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("address") - .HasColumnType("longtext"); - - b.Property("age") - .HasColumnType("int"); - - b.Property("email") - .HasColumnType("longtext"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("introduction") - .HasColumnType("longtext"); - - b.Property("ip") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("nick") - .HasColumnType("longtext"); - - b.Property("password") - .HasColumnType("longtext"); - - b.Property("phone") - .HasColumnType("int"); - - b.Property("username") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("user"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.visit", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("num") - .HasColumnType("int"); - - b.Property("time") - .HasColumnType("datetime(6)"); - - b.HasKey("id"); - - b.ToTable("visit"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany("children") - .HasForeignKey("menuid"); - - b.HasOne("Yi.Framework.Model.Models.mould", "mould") - .WithMany() - .HasForeignKey("mouldid"); - - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany("menus") - .HasForeignKey("roleid"); - - b.Navigation("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.HasOne("Yi.Framework.Model.Models.user", null) - .WithMany("roles") - .HasForeignKey("userid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Navigation("children"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Navigation("menus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Navigation("roles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080544_ec1.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080544_ec1.cs deleted file mode 100644 index baaf79d9..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080544_ec1.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Yi.Framework.Model.Migrations -{ - public partial class ec1 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080646_ec2.Designer.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080646_ec2.Designer.cs deleted file mode 100644 index 6d9fb503..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080646_ec2.Designer.cs +++ /dev/null @@ -1,732 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Yi.Framework.Model; - -namespace Yi.Framework.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20211106080646_ec2")] - partial class ec2 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 64) - .HasAnnotation("ProductVersion", "5.0.11"); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("image") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("letter") - .HasColumnType("longtext"); - - b.Property("name") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("brand"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand_category", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("brandId") - .HasColumnType("int"); - - b.Property("categoryId") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("brandId"); - - b.HasIndex("categoryId"); - - b.ToTable("brand_category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_parent") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext"); - - b.Property("sort") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.ToTable("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_show") - .HasColumnType("int"); - - b.Property("is_top") - .HasColumnType("int"); - - b.Property("menu_name") - .HasColumnType("longtext"); - - b.Property("menuid") - .HasColumnType("int"); - - b.Property("mouldid") - .HasColumnType("int"); - - b.Property("roleid") - .HasColumnType("int"); - - b.Property("router") - .HasColumnType("longtext"); - - b.Property("sort") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("menuid"); - - b.HasIndex("mouldid"); - - b.HasIndex("roleid"); - - b.ToTable("menu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.mould", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("mould_name") - .HasColumnType("longtext"); - - b.Property("url") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.order", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("actual_pay") - .HasColumnType("int"); - - b.Property("buyer_message") - .HasColumnType("longtext"); - - b.Property("buyer_nick") - .HasColumnType("longtext"); - - b.Property("buyer_rate") - .HasColumnType("int"); - - b.Property("creat_time") - .HasColumnType("datetime(6)"); - - b.Property("invoice_type") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("payment_type") - .HasColumnType("int"); - - b.Property("post_fee") - .HasColumnType("int"); - - b.Property("promotion_ids") - .HasColumnType("longtext"); - - b.Property("receiver") - .HasColumnType("longtext"); - - b.Property("receiver_address") - .HasColumnType("longtext"); - - b.Property("receiver_city") - .HasColumnType("longtext"); - - b.Property("receiver_district") - .HasColumnType("longtext"); - - b.Property("receiver_mobile") - .HasColumnType("longtext"); - - b.Property("receiver_state") - .HasColumnType("longtext"); - - b.Property("receiver_zip") - .HasColumnType("longtext"); - - b.Property("shipping_code") - .HasColumnType("longtext"); - - b.Property("shipping_name") - .HasColumnType("longtext"); - - b.Property("skuid") - .HasColumnType("int"); - - b.Property("source_type") - .HasColumnType("int"); - - b.Property("total_pay") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("skuid"); - - b.ToTable("order"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("introduce") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("role_name") - .HasColumnType("longtext"); - - b.Property("userid") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("userid"); - - b.ToTable("role"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("crate_time") - .HasColumnType("datetime(6)"); - - b.Property("enable") - .HasColumnType("int"); - - b.Property("images") - .HasColumnType("longtext"); - - b.Property("indexes") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("last_update_time") - .HasColumnType("datetime(6)"); - - b.Property("own_spec") - .HasColumnType("longtext"); - - b.Property("price") - .HasColumnType("int"); - - b.Property("spuid") - .HasColumnType("int"); - - b.Property("title") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.HasIndex("spuid"); - - b.ToTable("sku"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.ToTable("spec_group"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("generic") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext"); - - b.Property("numeric") - .HasColumnType("int"); - - b.Property("searching") - .HasColumnType("int"); - - b.Property("segments") - .HasColumnType("longtext"); - - b.Property("spec_Groupid") - .HasColumnType("int"); - - b.Property("unit") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.HasIndex("spec_Groupid"); - - b.ToTable("spec_param"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("brandid") - .HasColumnType("int"); - - b.Property("crate_time") - .HasColumnType("datetime(6)"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("last_update_time") - .HasColumnType("datetime(6)"); - - b.Property("saleable") - .HasColumnType("int"); - - b.Property("spu_Detailid") - .HasColumnType("int"); - - b.Property("sub_title") - .HasColumnType("longtext"); - - b.Property("title") - .HasColumnType("longtext"); - - b.Property("valid") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("brandid"); - - b.HasIndex("spu_Detailid"); - - b.ToTable("spu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu_detail", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("after_service") - .HasColumnType("longtext"); - - b.Property("description") - .HasColumnType("longtext"); - - b.Property("generic_spec") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("packing_list") - .HasColumnType("longtext"); - - b.Property("special_spec") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("spu_detail"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.stock", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("seckill_stock") - .HasColumnType("int"); - - b.Property("seckill_total") - .HasColumnType("int"); - - b.Property("skuid") - .HasColumnType("int"); - - b.Property("stock_count") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("skuid"); - - b.ToTable("stock"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("address") - .HasColumnType("longtext"); - - b.Property("age") - .HasColumnType("int"); - - b.Property("email") - .HasColumnType("longtext"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("introduction") - .HasColumnType("longtext"); - - b.Property("ip") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("nick") - .HasColumnType("longtext"); - - b.Property("password") - .HasColumnType("longtext"); - - b.Property("phone") - .HasColumnType("int"); - - b.Property("username") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("user"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.visit", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("num") - .HasColumnType("int"); - - b.Property("time") - .HasColumnType("datetime(6)"); - - b.HasKey("id"); - - b.ToTable("visit"); - }); - - modelBuilder.Entity("categoryspu", b => - { - b.Property("categoriesid") - .HasColumnType("int"); - - b.Property("spusid") - .HasColumnType("int"); - - b.HasKey("categoriesid", "spusid"); - - b.HasIndex("spusid"); - - b.ToTable("categoryspu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand_category", b => - { - b.HasOne("Yi.Framework.Model.Models.brand", "brand") - .WithMany("categories") - .HasForeignKey("brandId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("brands") - .HasForeignKey("categoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("brand"); - - b.Navigation("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany("chidrens") - .HasForeignKey("categoryid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany("children") - .HasForeignKey("menuid"); - - b.HasOne("Yi.Framework.Model.Models.mould", "mould") - .WithMany() - .HasForeignKey("mouldid"); - - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany("menus") - .HasForeignKey("roleid"); - - b.Navigation("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.order", b => - { - b.HasOne("Yi.Framework.Model.Models.sku", null) - .WithMany("orders") - .HasForeignKey("skuid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.HasOne("Yi.Framework.Model.Models.user", null) - .WithMany("roles") - .HasForeignKey("userid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.HasOne("Yi.Framework.Model.Models.spu", "spu") - .WithMany("skus") - .HasForeignKey("spuid"); - - b.Navigation("spu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("spec_Groups") - .HasForeignKey("categoryid"); - - b.Navigation("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b => - { - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("spec_Params") - .HasForeignKey("categoryid"); - - b.HasOne("Yi.Framework.Model.Models.spec_group", "spec_Group") - .WithMany("spec_Params") - .HasForeignKey("spec_Groupid"); - - b.Navigation("category"); - - b.Navigation("spec_Group"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.HasOne("Yi.Framework.Model.Models.brand", "brand") - .WithMany("spus") - .HasForeignKey("brandid"); - - b.HasOne("Yi.Framework.Model.Models.spu_detail", "spu_Detail") - .WithMany() - .HasForeignKey("spu_Detailid"); - - b.Navigation("brand"); - - b.Navigation("spu_Detail"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.stock", b => - { - b.HasOne("Yi.Framework.Model.Models.sku", "sku") - .WithMany() - .HasForeignKey("skuid"); - - b.Navigation("sku"); - }); - - modelBuilder.Entity("categoryspu", b => - { - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany() - .HasForeignKey("categoriesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.spu", null) - .WithMany() - .HasForeignKey("spusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand", b => - { - b.Navigation("categories"); - - b.Navigation("spus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.Navigation("brands"); - - b.Navigation("chidrens"); - - b.Navigation("spec_Groups"); - - b.Navigation("spec_Params"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Navigation("children"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Navigation("menus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.Navigation("orders"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.Navigation("spec_Params"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.Navigation("skus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Navigation("roles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080646_ec2.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080646_ec2.cs deleted file mode 100644 index 6ffc7373..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106080646_ec2.cs +++ /dev/null @@ -1,436 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Yi.Framework.Model.Migrations -{ - public partial class ec2 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "brand", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - image = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - letter = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_brand", x => x.id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "category", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - sort = table.Column(type: "int", nullable: false), - is_parent = table.Column(type: "int", nullable: false), - categoryid = table.Column(type: "int", nullable: true), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_category", x => x.id); - table.ForeignKey( - name: "FK_category_category_categoryid", - column: x => x.categoryid, - principalTable: "category", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "spu_detail", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - description = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - generic_spec = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - special_spec = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - packing_list = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - after_service = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_spu_detail", x => x.id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "brand_category", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - brandId = table.Column(type: "int", nullable: false), - categoryId = table.Column(type: "int", nullable: false), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_brand_category", x => x.id); - table.ForeignKey( - name: "FK_brand_category_brand_brandId", - column: x => x.brandId, - principalTable: "brand", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_brand_category_category_categoryId", - column: x => x.categoryId, - principalTable: "category", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "spec_group", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - categoryid = table.Column(type: "int", nullable: true), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_spec_group", x => x.id); - table.ForeignKey( - name: "FK_spec_group_category_categoryid", - column: x => x.categoryid, - principalTable: "category", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "spu", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - title = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - sub_title = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - saleable = table.Column(type: "int", nullable: false), - valid = table.Column(type: "int", nullable: false), - crate_time = table.Column(type: "datetime(6)", nullable: false), - last_update_time = table.Column(type: "datetime(6)", nullable: false), - brandid = table.Column(type: "int", nullable: true), - spu_Detailid = table.Column(type: "int", nullable: true), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_spu", x => x.id); - table.ForeignKey( - name: "FK_spu_brand_brandid", - column: x => x.brandid, - principalTable: "brand", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_spu_spu_detail_spu_Detailid", - column: x => x.spu_Detailid, - principalTable: "spu_detail", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "spec_param", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - numeric = table.Column(type: "int", nullable: false), - unit = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - generic = table.Column(type: "int", nullable: false), - searching = table.Column(type: "int", nullable: false), - segments = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - spec_Groupid = table.Column(type: "int", nullable: true), - categoryid = table.Column(type: "int", nullable: true), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_spec_param", x => x.id); - table.ForeignKey( - name: "FK_spec_param_category_categoryid", - column: x => x.categoryid, - principalTable: "category", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_spec_param_spec_group_spec_Groupid", - column: x => x.spec_Groupid, - principalTable: "spec_group", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "categoryspu", - columns: table => new - { - categoriesid = table.Column(type: "int", nullable: false), - spusid = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_categoryspu", x => new { x.categoriesid, x.spusid }); - table.ForeignKey( - name: "FK_categoryspu_category_categoriesid", - column: x => x.categoriesid, - principalTable: "category", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_categoryspu_spu_spusid", - column: x => x.spusid, - principalTable: "spu", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "sku", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - title = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - images = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - price = table.Column(type: "int", nullable: false), - indexes = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - enable = table.Column(type: "int", nullable: false), - own_spec = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - crate_time = table.Column(type: "datetime(6)", nullable: false), - last_update_time = table.Column(type: "datetime(6)", nullable: false), - spuid = table.Column(type: "int", nullable: true), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sku", x => x.id); - table.ForeignKey( - name: "FK_sku_spu_spuid", - column: x => x.spuid, - principalTable: "spu", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "order", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - total_pay = table.Column(type: "int", nullable: false), - actual_pay = table.Column(type: "int", nullable: false), - payment_type = table.Column(type: "int", nullable: false), - post_fee = table.Column(type: "int", nullable: false), - promotion_ids = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - creat_time = table.Column(type: "datetime(6)", nullable: false), - shipping_name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - shipping_code = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - buyer_message = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - buyer_nick = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - buyer_rate = table.Column(type: "int", nullable: false), - receiver_state = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - receiver_city = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - receiver_district = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - receiver_address = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - receiver_mobile = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - receiver_zip = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - receiver = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - invoice_type = table.Column(type: "int", nullable: false), - source_type = table.Column(type: "int", nullable: false), - skuid = table.Column(type: "int", nullable: true), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_order", x => x.id); - table.ForeignKey( - name: "FK_order_sku_skuid", - column: x => x.skuid, - principalTable: "sku", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "stock", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - seckill_stock = table.Column(type: "int", nullable: false), - seckill_total = table.Column(type: "int", nullable: false), - stock_count = table.Column(type: "int", nullable: false), - skuid = table.Column(type: "int", nullable: true), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_stock", x => x.id); - table.ForeignKey( - name: "FK_stock_sku_skuid", - column: x => x.skuid, - principalTable: "sku", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_brand_category_brandId", - table: "brand_category", - column: "brandId"); - - migrationBuilder.CreateIndex( - name: "IX_brand_category_categoryId", - table: "brand_category", - column: "categoryId"); - - migrationBuilder.CreateIndex( - name: "IX_category_categoryid", - table: "category", - column: "categoryid"); - - migrationBuilder.CreateIndex( - name: "IX_categoryspu_spusid", - table: "categoryspu", - column: "spusid"); - - migrationBuilder.CreateIndex( - name: "IX_order_skuid", - table: "order", - column: "skuid"); - - migrationBuilder.CreateIndex( - name: "IX_sku_spuid", - table: "sku", - column: "spuid"); - - migrationBuilder.CreateIndex( - name: "IX_spec_group_categoryid", - table: "spec_group", - column: "categoryid"); - - migrationBuilder.CreateIndex( - name: "IX_spec_param_categoryid", - table: "spec_param", - column: "categoryid"); - - migrationBuilder.CreateIndex( - name: "IX_spec_param_spec_Groupid", - table: "spec_param", - column: "spec_Groupid"); - - migrationBuilder.CreateIndex( - name: "IX_spu_brandid", - table: "spu", - column: "brandid"); - - migrationBuilder.CreateIndex( - name: "IX_spu_spu_Detailid", - table: "spu", - column: "spu_Detailid"); - - migrationBuilder.CreateIndex( - name: "IX_stock_skuid", - table: "stock", - column: "skuid"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "brand_category"); - - migrationBuilder.DropTable( - name: "categoryspu"); - - migrationBuilder.DropTable( - name: "order"); - - migrationBuilder.DropTable( - name: "spec_param"); - - migrationBuilder.DropTable( - name: "stock"); - - migrationBuilder.DropTable( - name: "spec_group"); - - migrationBuilder.DropTable( - name: "sku"); - - migrationBuilder.DropTable( - name: "category"); - - migrationBuilder.DropTable( - name: "spu"); - - migrationBuilder.DropTable( - name: "brand"); - - migrationBuilder.DropTable( - name: "spu_detail"); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106082100_yi-1.Designer.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106082100_yi-1.Designer.cs deleted file mode 100644 index 2e948098..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106082100_yi-1.Designer.cs +++ /dev/null @@ -1,248 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Yi.Framework.Model; - -namespace Yi.Framework.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20211106082100_yi-1")] - partial class yi1 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 64) - .HasAnnotation("ProductVersion", "5.0.11"); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_show") - .HasColumnType("int"); - - b.Property("is_top") - .HasColumnType("int"); - - b.Property("menu_name") - .HasColumnType("longtext"); - - b.Property("menuid") - .HasColumnType("int"); - - b.Property("mouldid") - .HasColumnType("int"); - - b.Property("router") - .HasColumnType("longtext"); - - b.Property("sort") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("menuid"); - - b.HasIndex("mouldid"); - - b.ToTable("menu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.mould", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("mould_name") - .HasColumnType("longtext"); - - b.Property("url") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("introduce") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("role_name") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("role"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("address") - .HasColumnType("longtext"); - - b.Property("age") - .HasColumnType("int"); - - b.Property("email") - .HasColumnType("longtext"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("introduction") - .HasColumnType("longtext"); - - b.Property("ip") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("nick") - .HasColumnType("longtext"); - - b.Property("password") - .HasColumnType("longtext"); - - b.Property("phone") - .HasColumnType("longtext"); - - b.Property("username") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("user"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.visit", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("num") - .HasColumnType("int"); - - b.Property("time") - .HasColumnType("datetime(6)"); - - b.HasKey("id"); - - b.ToTable("visit"); - }); - - modelBuilder.Entity("menurole", b => - { - b.Property("menusid") - .HasColumnType("int"); - - b.Property("rolesid") - .HasColumnType("int"); - - b.HasKey("menusid", "rolesid"); - - b.HasIndex("rolesid"); - - b.ToTable("menurole"); - }); - - modelBuilder.Entity("roleuser", b => - { - b.Property("rolesid") - .HasColumnType("int"); - - b.Property("usersid") - .HasColumnType("int"); - - b.HasKey("rolesid", "usersid"); - - b.HasIndex("usersid"); - - b.ToTable("roleuser"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany("children") - .HasForeignKey("menuid"); - - b.HasOne("Yi.Framework.Model.Models.mould", "mould") - .WithMany() - .HasForeignKey("mouldid"); - - b.Navigation("mould"); - }); - - modelBuilder.Entity("menurole", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany() - .HasForeignKey("menusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("roleuser", b => - { - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.user", null) - .WithMany() - .HasForeignKey("usersid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Navigation("children"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106082100_yi-1.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106082100_yi-1.cs deleted file mode 100644 index 0fc278db..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106082100_yi-1.cs +++ /dev/null @@ -1,231 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Yi.Framework.Model.Migrations -{ - public partial class yi1 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "mould", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - mould_name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - url = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_mould", x => x.id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "role", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - role_name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - introduce = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_role", x => x.id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "user", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - username = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - password = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - icon = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - nick = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - email = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - ip = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - age = table.Column(type: "int", nullable: true), - introduction = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - address = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - phone = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_user", x => x.id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "visit", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - time = table.Column(type: "datetime(6)", nullable: false), - num = table.Column(type: "int", nullable: false), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_visit", x => x.id); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "menu", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - icon = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - router = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - menu_name = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - mouldid = table.Column(type: "int", nullable: true), - menuid = table.Column(type: "int", nullable: true), - is_delete = table.Column(type: "int", nullable: false), - is_top = table.Column(type: "int", nullable: false), - sort = table.Column(type: "int", nullable: false), - is_show = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_menu", x => x.id); - table.ForeignKey( - name: "FK_menu_menu_menuid", - column: x => x.menuid, - principalTable: "menu", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_menu_mould_mouldid", - column: x => x.mouldid, - principalTable: "mould", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "roleuser", - columns: table => new - { - rolesid = table.Column(type: "int", nullable: false), - usersid = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_roleuser", x => new { x.rolesid, x.usersid }); - table.ForeignKey( - name: "FK_roleuser_role_rolesid", - column: x => x.rolesid, - principalTable: "role", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_roleuser_user_usersid", - column: x => x.usersid, - principalTable: "user", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "menurole", - columns: table => new - { - menusid = table.Column(type: "int", nullable: false), - rolesid = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_menurole", x => new { x.menusid, x.rolesid }); - table.ForeignKey( - name: "FK_menurole_menu_menusid", - column: x => x.menusid, - principalTable: "menu", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_menurole_role_rolesid", - column: x => x.rolesid, - principalTable: "role", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_menu_menuid", - table: "menu", - column: "menuid"); - - migrationBuilder.CreateIndex( - name: "IX_menu_mouldid", - table: "menu", - column: "mouldid"); - - migrationBuilder.CreateIndex( - name: "IX_menurole_rolesid", - table: "menurole", - column: "rolesid"); - - migrationBuilder.CreateIndex( - name: "IX_roleuser_usersid", - table: "roleuser", - column: "usersid"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "menurole"); - - migrationBuilder.DropTable( - name: "roleuser"); - - migrationBuilder.DropTable( - name: "visit"); - - migrationBuilder.DropTable( - name: "menu"); - - migrationBuilder.DropTable( - name: "role"); - - migrationBuilder.DropTable( - name: "user"); - - migrationBuilder.DropTable( - name: "mould"); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106084427_ec3.Designer.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106084427_ec3.Designer.cs deleted file mode 100644 index 8c0467c2..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106084427_ec3.Designer.cs +++ /dev/null @@ -1,770 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Yi.Framework.Model; - -namespace Yi.Framework.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20211106084427_ec3")] - partial class ec3 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 64) - .HasAnnotation("ProductVersion", "5.0.11"); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("image") - .HasColumnType("longtext") - .HasComment("品牌图片"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("letter") - .HasColumnType("longtext") - .HasComment("品牌首字母"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("品牌名称"); - - b.HasKey("id"); - - b.ToTable("brand"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_parent") - .HasColumnType("int") - .HasComment("是否父类别"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("类别名称"); - - b.Property("sort") - .HasColumnType("int") - .HasComment("排序"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.ToTable("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_show") - .HasColumnType("int"); - - b.Property("is_top") - .HasColumnType("int"); - - b.Property("menu_name") - .HasColumnType("longtext"); - - b.Property("menuid") - .HasColumnType("int"); - - b.Property("mouldid") - .HasColumnType("int"); - - b.Property("roleid") - .HasColumnType("int"); - - b.Property("router") - .HasColumnType("longtext"); - - b.Property("sort") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("menuid"); - - b.HasIndex("mouldid"); - - b.HasIndex("roleid"); - - b.ToTable("menu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.mould", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("mould_name") - .HasColumnType("longtext"); - - b.Property("url") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.order", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("actual_pay") - .HasColumnType("int") - .HasComment("实付金额。单位:分。如:20007,表示:200元7分"); - - b.Property("buyer_message") - .HasColumnType("longtext") - .HasComment("买家留言"); - - b.Property("buyer_nick") - .HasColumnType("longtext") - .HasComment("买家昵称"); - - b.Property("buyer_rate") - .HasColumnType("int") - .HasComment("买家是否已经评价,0未评价,1已评价"); - - b.Property("creat_time") - .HasColumnType("datetime(6)") - .HasComment("订单创建时间"); - - b.Property("invoice_type") - .HasColumnType("int") - .HasComment("发票类型:0无发票1普通发票,2电子发票,3增值税发票"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("payment_type") - .HasColumnType("int") - .HasComment("支付类型,1、在线支付,2、货到付款"); - - b.Property("post_fee") - .HasColumnType("int") - .HasComment("邮费。单位:分。如:20007,表示:200元7分"); - - b.Property("promotion_ids") - .HasColumnType("longtext") - .HasComment("promotion_ids"); - - b.Property("receiver") - .HasColumnType("longtext") - .HasComment("收货人"); - - b.Property("receiver_address") - .HasColumnType("longtext") - .HasComment("收获地址(街道、住址等详细地址)"); - - b.Property("receiver_city") - .HasColumnType("longtext") - .HasComment("收获地址(市)"); - - b.Property("receiver_district") - .HasColumnType("longtext") - .HasComment("收获地址(区/县)"); - - b.Property("receiver_mobile") - .HasColumnType("longtext") - .HasComment("收货人手机"); - - b.Property("receiver_state") - .HasColumnType("longtext") - .HasComment("收获地址(省)"); - - b.Property("receiver_zip") - .HasColumnType("longtext") - .HasComment("收货人邮编"); - - b.Property("shipping_code") - .HasColumnType("longtext") - .HasComment("物流单号"); - - b.Property("shipping_name") - .HasColumnType("longtext") - .HasComment("物流名称"); - - b.Property("skuid") - .HasColumnType("int"); - - b.Property("source_type") - .HasColumnType("int") - .HasComment("订单来源:1:app端,2:pc端,3:M端,4:微信端,5:手机qq端"); - - b.Property("total_pay") - .HasColumnType("int") - .HasComment("总金额,单位为分"); - - b.HasKey("id"); - - b.HasIndex("skuid"); - - b.ToTable("order"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("introduce") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("role_name") - .HasColumnType("longtext"); - - b.Property("userid") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("userid"); - - b.ToTable("role"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("crate_time") - .HasColumnType("datetime(6)") - .HasComment("创建时间"); - - b.Property("enable") - .HasColumnType("int") - .HasComment("是否有效,0无效,1有效"); - - b.Property("images") - .HasColumnType("longtext") - .HasComment("商品的图片,多个图片以‘,’分割"); - - b.Property("indexes") - .HasColumnType("longtext") - .HasComment("特有规格属性在spu属性模板中的对应下标组合"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("last_update_time") - .HasColumnType("datetime(6)") - .HasComment("最后更新时间"); - - b.Property("own_spec") - .HasColumnType("longtext") - .HasComment("sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序"); - - b.Property("price") - .HasColumnType("int") - .HasComment("销售价格,单位为分"); - - b.Property("spuid") - .HasColumnType("int"); - - b.Property("title") - .HasColumnType("longtext") - .HasComment("商品标题"); - - b.HasKey("id"); - - b.HasIndex("spuid"); - - b.ToTable("sku"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("规格组名称"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.ToTable("spec_group"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("generic") - .HasColumnType("int") - .HasComment("是否是sku通用属性,true或false"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("参数名"); - - b.Property("numeric") - .HasColumnType("int") - .HasComment("是否是数字类型参数,true或false"); - - b.Property("searching") - .HasColumnType("int") - .HasComment("是否用于搜索过滤,true或false"); - - b.Property("segments") - .HasColumnType("longtext") - .HasComment("数值类型参数,如果需要搜索,则添加分段间隔值,如CPU频率间隔:0.5-1.0"); - - b.Property("spec_Groupid") - .HasColumnType("int"); - - b.Property("unit") - .HasColumnType("longtext") - .HasComment("数字类型参数的单位,非数字类型可以为空"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.HasIndex("spec_Groupid"); - - b.ToTable("spec_param"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("brandid") - .HasColumnType("int"); - - b.Property("crate_time") - .HasColumnType("datetime(6)") - .HasComment("创建时间"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("last_update_time") - .HasColumnType("datetime(6)") - .HasComment("最后更新时间"); - - b.Property("saleable") - .HasColumnType("int") - .HasComment("是否上架"); - - b.Property("spu_Detailid") - .HasColumnType("int"); - - b.Property("sub_title") - .HasColumnType("longtext") - .HasComment("子标题"); - - b.Property("title") - .HasColumnType("longtext") - .HasComment("标题"); - - b.Property("valid") - .HasColumnType("int") - .HasComment("是否有效"); - - b.HasKey("id"); - - b.HasIndex("brandid"); - - b.HasIndex("spu_Detailid"); - - b.ToTable("spu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu_detail", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("after_service") - .HasColumnType("longtext") - .HasComment("售后服务"); - - b.Property("description") - .HasColumnType("longtext") - .HasComment("描述"); - - b.Property("generic_spec") - .HasColumnType("longtext") - .HasComment("通用规格参数数据"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("packing_list") - .HasColumnType("longtext") - .HasComment("包装清单"); - - b.Property("special_spec") - .HasColumnType("longtext") - .HasComment("特有规格参数及可选值信息,json格式"); - - b.HasKey("id"); - - b.ToTable("spu_detail"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.stock", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("seckill_stock") - .HasColumnType("int") - .HasComment("可秒杀库存"); - - b.Property("seckill_total") - .HasColumnType("int") - .HasComment("秒杀总数量"); - - b.Property("skuid") - .HasColumnType("int"); - - b.Property("stock_count") - .HasColumnType("int") - .HasComment("库存数量"); - - b.HasKey("id"); - - b.HasIndex("skuid"); - - b.ToTable("stock"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("address") - .HasColumnType("longtext"); - - b.Property("age") - .HasColumnType("int"); - - b.Property("email") - .HasColumnType("longtext"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("introduction") - .HasColumnType("longtext"); - - b.Property("ip") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("nick") - .HasColumnType("longtext"); - - b.Property("password") - .HasColumnType("longtext"); - - b.Property("phone") - .HasColumnType("int"); - - b.Property("username") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("user"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.visit", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("num") - .HasColumnType("int"); - - b.Property("time") - .HasColumnType("datetime(6)"); - - b.HasKey("id"); - - b.ToTable("visit"); - }); - - modelBuilder.Entity("brandcategory", b => - { - b.Property("brandsid") - .HasColumnType("int"); - - b.Property("categoriesid") - .HasColumnType("int"); - - b.HasKey("brandsid", "categoriesid"); - - b.HasIndex("categoriesid"); - - b.ToTable("brandcategory"); - }); - - modelBuilder.Entity("categoryspu", b => - { - b.Property("categoriesid") - .HasColumnType("int"); - - b.Property("spusid") - .HasColumnType("int"); - - b.HasKey("categoriesid", "spusid"); - - b.HasIndex("spusid"); - - b.ToTable("categoryspu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany("chidrens") - .HasForeignKey("categoryid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany("children") - .HasForeignKey("menuid"); - - b.HasOne("Yi.Framework.Model.Models.mould", "mould") - .WithMany() - .HasForeignKey("mouldid"); - - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany("menus") - .HasForeignKey("roleid"); - - b.Navigation("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.order", b => - { - b.HasOne("Yi.Framework.Model.Models.sku", null) - .WithMany("orders") - .HasForeignKey("skuid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.HasOne("Yi.Framework.Model.Models.user", null) - .WithMany("roles") - .HasForeignKey("userid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.HasOne("Yi.Framework.Model.Models.spu", "spu") - .WithMany("skus") - .HasForeignKey("spuid"); - - b.Navigation("spu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("spec_Groups") - .HasForeignKey("categoryid"); - - b.Navigation("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b => - { - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("spec_Params") - .HasForeignKey("categoryid"); - - b.HasOne("Yi.Framework.Model.Models.spec_group", "spec_Group") - .WithMany("spec_Params") - .HasForeignKey("spec_Groupid"); - - b.Navigation("category"); - - b.Navigation("spec_Group"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.HasOne("Yi.Framework.Model.Models.brand", "brand") - .WithMany("spus") - .HasForeignKey("brandid"); - - b.HasOne("Yi.Framework.Model.Models.spu_detail", "spu_Detail") - .WithMany() - .HasForeignKey("spu_Detailid"); - - b.Navigation("brand"); - - b.Navigation("spu_Detail"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.stock", b => - { - b.HasOne("Yi.Framework.Model.Models.sku", "sku") - .WithMany() - .HasForeignKey("skuid"); - - b.Navigation("sku"); - }); - - modelBuilder.Entity("brandcategory", b => - { - b.HasOne("Yi.Framework.Model.Models.brand", null) - .WithMany() - .HasForeignKey("brandsid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany() - .HasForeignKey("categoriesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("categoryspu", b => - { - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany() - .HasForeignKey("categoriesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.spu", null) - .WithMany() - .HasForeignKey("spusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand", b => - { - b.Navigation("spus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.Navigation("chidrens"); - - b.Navigation("spec_Groups"); - - b.Navigation("spec_Params"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Navigation("children"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Navigation("menus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.Navigation("orders"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.Navigation("spec_Params"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.Navigation("skus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Navigation("roles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106084427_ec3.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106084427_ec3.cs deleted file mode 100644 index c88a2028..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106084427_ec3.cs +++ /dev/null @@ -1,1265 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Yi.Framework.Model.Migrations -{ - public partial class ec3 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "brand_category"); - - migrationBuilder.AlterColumn( - name: "stock_count", - table: "stock", - type: "int", - nullable: false, - comment: "库存数量", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "seckill_total", - table: "stock", - type: "int", - nullable: false, - comment: "秒杀总数量", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "seckill_stock", - table: "stock", - type: "int", - nullable: false, - comment: "可秒杀库存", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "special_spec", - table: "spu_detail", - type: "longtext", - nullable: true, - comment: "特有规格参数及可选值信息,json格式", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "packing_list", - table: "spu_detail", - type: "longtext", - nullable: true, - comment: "包装清单", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "generic_spec", - table: "spu_detail", - type: "longtext", - nullable: true, - comment: "通用规格参数数据", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "description", - table: "spu_detail", - type: "longtext", - nullable: true, - comment: "描述", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "after_service", - table: "spu_detail", - type: "longtext", - nullable: true, - comment: "售后服务", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "valid", - table: "spu", - type: "int", - nullable: false, - comment: "是否有效", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "title", - table: "spu", - type: "longtext", - nullable: true, - comment: "标题", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "sub_title", - table: "spu", - type: "longtext", - nullable: true, - comment: "子标题", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "saleable", - table: "spu", - type: "int", - nullable: false, - comment: "是否上架", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "last_update_time", - table: "spu", - type: "datetime(6)", - nullable: false, - comment: "最后更新时间", - oldClrType: typeof(DateTime), - oldType: "datetime(6)"); - - migrationBuilder.AlterColumn( - name: "crate_time", - table: "spu", - type: "datetime(6)", - nullable: false, - comment: "创建时间", - oldClrType: typeof(DateTime), - oldType: "datetime(6)"); - - migrationBuilder.AlterColumn( - name: "unit", - table: "spec_param", - type: "longtext", - nullable: true, - comment: "数字类型参数的单位,非数字类型可以为空", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "segments", - table: "spec_param", - type: "longtext", - nullable: true, - comment: "数值类型参数,如果需要搜索,则添加分段间隔值,如CPU频率间隔:0.5-1.0", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "searching", - table: "spec_param", - type: "int", - nullable: false, - comment: "是否用于搜索过滤,true或false", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "numeric", - table: "spec_param", - type: "int", - nullable: false, - comment: "是否是数字类型参数,true或false", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "name", - table: "spec_param", - type: "longtext", - nullable: true, - comment: "参数名", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "generic", - table: "spec_param", - type: "int", - nullable: false, - comment: "是否是sku通用属性,true或false", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "name", - table: "spec_group", - type: "longtext", - nullable: true, - comment: "规格组名称", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "title", - table: "sku", - type: "longtext", - nullable: true, - comment: "商品标题", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "price", - table: "sku", - type: "int", - nullable: false, - comment: "销售价格,单位为分", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "own_spec", - table: "sku", - type: "longtext", - nullable: true, - comment: "sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "last_update_time", - table: "sku", - type: "datetime(6)", - nullable: false, - comment: "最后更新时间", - oldClrType: typeof(DateTime), - oldType: "datetime(6)"); - - migrationBuilder.AlterColumn( - name: "indexes", - table: "sku", - type: "longtext", - nullable: true, - comment: "特有规格属性在spu属性模板中的对应下标组合", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "images", - table: "sku", - type: "longtext", - nullable: true, - comment: "商品的图片,多个图片以‘,’分割", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "enable", - table: "sku", - type: "int", - nullable: false, - comment: "是否有效,0无效,1有效", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "crate_time", - table: "sku", - type: "datetime(6)", - nullable: false, - comment: "创建时间", - oldClrType: typeof(DateTime), - oldType: "datetime(6)"); - - migrationBuilder.AlterColumn( - name: "total_pay", - table: "order", - type: "int", - nullable: false, - comment: "总金额,单位为分", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "source_type", - table: "order", - type: "int", - nullable: false, - comment: "订单来源:1:app端,2:pc端,3:M端,4:微信端,5:手机qq端", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "shipping_name", - table: "order", - type: "longtext", - nullable: true, - comment: "物流名称", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "shipping_code", - table: "order", - type: "longtext", - nullable: true, - comment: "物流单号", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_zip", - table: "order", - type: "longtext", - nullable: true, - comment: "收货人邮编", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_state", - table: "order", - type: "longtext", - nullable: true, - comment: "收获地址(省)", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_mobile", - table: "order", - type: "longtext", - nullable: true, - comment: "收货人手机", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_district", - table: "order", - type: "longtext", - nullable: true, - comment: "收获地址(区/县)", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_city", - table: "order", - type: "longtext", - nullable: true, - comment: "收获地址(市)", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_address", - table: "order", - type: "longtext", - nullable: true, - comment: "收获地址(街道、住址等详细地址)", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver", - table: "order", - type: "longtext", - nullable: true, - comment: "收货人", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "promotion_ids", - table: "order", - type: "longtext", - nullable: true, - comment: "promotion_ids", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "post_fee", - table: "order", - type: "int", - nullable: false, - comment: "邮费。单位:分。如:20007,表示:200元7分", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "payment_type", - table: "order", - type: "int", - nullable: false, - comment: "支付类型,1、在线支付,2、货到付款", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "invoice_type", - table: "order", - type: "int", - nullable: false, - comment: "发票类型:0无发票1普通发票,2电子发票,3增值税发票", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "creat_time", - table: "order", - type: "datetime(6)", - nullable: false, - comment: "订单创建时间", - oldClrType: typeof(DateTime), - oldType: "datetime(6)"); - - migrationBuilder.AlterColumn( - name: "buyer_rate", - table: "order", - type: "int", - nullable: false, - comment: "买家是否已经评价,0未评价,1已评价", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "buyer_nick", - table: "order", - type: "longtext", - nullable: true, - comment: "买家昵称", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "buyer_message", - table: "order", - type: "longtext", - nullable: true, - comment: "买家留言", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "actual_pay", - table: "order", - type: "int", - nullable: false, - comment: "实付金额。单位:分。如:20007,表示:200元7分", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "sort", - table: "category", - type: "int", - nullable: false, - comment: "排序", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "name", - table: "category", - type: "longtext", - nullable: true, - comment: "类别名称", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "is_parent", - table: "category", - type: "int", - nullable: false, - comment: "是否父类别", - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "name", - table: "brand", - type: "longtext", - nullable: true, - comment: "品牌名称", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "letter", - table: "brand", - type: "longtext", - nullable: true, - comment: "品牌首字母", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "image", - table: "brand", - type: "longtext", - nullable: true, - comment: "品牌图片", - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "brandcategory", - columns: table => new - { - brandsid = table.Column(type: "int", nullable: false), - categoriesid = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_brandcategory", x => new { x.brandsid, x.categoriesid }); - table.ForeignKey( - name: "FK_brandcategory_brand_brandsid", - column: x => x.brandsid, - principalTable: "brand", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_brandcategory_category_categoriesid", - column: x => x.categoriesid, - principalTable: "category", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_brandcategory_categoriesid", - table: "brandcategory", - column: "categoriesid"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "brandcategory"); - - migrationBuilder.AlterColumn( - name: "stock_count", - table: "stock", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "库存数量"); - - migrationBuilder.AlterColumn( - name: "seckill_total", - table: "stock", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "秒杀总数量"); - - migrationBuilder.AlterColumn( - name: "seckill_stock", - table: "stock", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "可秒杀库存"); - - migrationBuilder.AlterColumn( - name: "special_spec", - table: "spu_detail", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "特有规格参数及可选值信息,json格式") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "packing_list", - table: "spu_detail", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "包装清单") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "generic_spec", - table: "spu_detail", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "通用规格参数数据") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "description", - table: "spu_detail", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "描述") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "after_service", - table: "spu_detail", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "售后服务") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "valid", - table: "spu", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "是否有效"); - - migrationBuilder.AlterColumn( - name: "title", - table: "spu", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "标题") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "sub_title", - table: "spu", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "子标题") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "saleable", - table: "spu", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "是否上架"); - - migrationBuilder.AlterColumn( - name: "last_update_time", - table: "spu", - type: "datetime(6)", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "datetime(6)", - oldComment: "最后更新时间"); - - migrationBuilder.AlterColumn( - name: "crate_time", - table: "spu", - type: "datetime(6)", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "datetime(6)", - oldComment: "创建时间"); - - migrationBuilder.AlterColumn( - name: "unit", - table: "spec_param", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "数字类型参数的单位,非数字类型可以为空") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "segments", - table: "spec_param", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "数值类型参数,如果需要搜索,则添加分段间隔值,如CPU频率间隔:0.5-1.0") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "searching", - table: "spec_param", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "是否用于搜索过滤,true或false"); - - migrationBuilder.AlterColumn( - name: "numeric", - table: "spec_param", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "是否是数字类型参数,true或false"); - - migrationBuilder.AlterColumn( - name: "name", - table: "spec_param", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "参数名") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "generic", - table: "spec_param", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "是否是sku通用属性,true或false"); - - migrationBuilder.AlterColumn( - name: "name", - table: "spec_group", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "规格组名称") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "title", - table: "sku", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "商品标题") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "price", - table: "sku", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "销售价格,单位为分"); - - migrationBuilder.AlterColumn( - name: "own_spec", - table: "sku", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "last_update_time", - table: "sku", - type: "datetime(6)", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "datetime(6)", - oldComment: "最后更新时间"); - - migrationBuilder.AlterColumn( - name: "indexes", - table: "sku", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "特有规格属性在spu属性模板中的对应下标组合") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "images", - table: "sku", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "商品的图片,多个图片以‘,’分割") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "enable", - table: "sku", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "是否有效,0无效,1有效"); - - migrationBuilder.AlterColumn( - name: "crate_time", - table: "sku", - type: "datetime(6)", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "datetime(6)", - oldComment: "创建时间"); - - migrationBuilder.AlterColumn( - name: "total_pay", - table: "order", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "总金额,单位为分"); - - migrationBuilder.AlterColumn( - name: "source_type", - table: "order", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "订单来源:1:app端,2:pc端,3:M端,4:微信端,5:手机qq端"); - - migrationBuilder.AlterColumn( - name: "shipping_name", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "物流名称") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "shipping_code", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "物流单号") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_zip", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "收货人邮编") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_state", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "收获地址(省)") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_mobile", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "收货人手机") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_district", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "收获地址(区/县)") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_city", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "收获地址(市)") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver_address", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "收获地址(街道、住址等详细地址)") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "receiver", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "收货人") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "promotion_ids", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "promotion_ids") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "post_fee", - table: "order", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "邮费。单位:分。如:20007,表示:200元7分"); - - migrationBuilder.AlterColumn( - name: "payment_type", - table: "order", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "支付类型,1、在线支付,2、货到付款"); - - migrationBuilder.AlterColumn( - name: "invoice_type", - table: "order", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "发票类型:0无发票1普通发票,2电子发票,3增值税发票"); - - migrationBuilder.AlterColumn( - name: "creat_time", - table: "order", - type: "datetime(6)", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "datetime(6)", - oldComment: "订单创建时间"); - - migrationBuilder.AlterColumn( - name: "buyer_rate", - table: "order", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "买家是否已经评价,0未评价,1已评价"); - - migrationBuilder.AlterColumn( - name: "buyer_nick", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "买家昵称") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "buyer_message", - table: "order", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "买家留言") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "actual_pay", - table: "order", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "实付金额。单位:分。如:20007,表示:200元7分"); - - migrationBuilder.AlterColumn( - name: "sort", - table: "category", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "排序"); - - migrationBuilder.AlterColumn( - name: "name", - table: "category", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "类别名称") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "is_parent", - table: "category", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "int", - oldComment: "是否父类别"); - - migrationBuilder.AlterColumn( - name: "name", - table: "brand", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "品牌名称") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "letter", - table: "brand", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "品牌首字母") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "image", - table: "brand", - type: "longtext", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true, - oldComment: "品牌图片") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "brand_category", - columns: table => new - { - id = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - brandId = table.Column(type: "int", nullable: false), - categoryId = table.Column(type: "int", nullable: false), - is_delete = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_brand_category", x => x.id); - table.ForeignKey( - name: "FK_brand_category_brand_brandId", - column: x => x.brandId, - principalTable: "brand", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_brand_category_category_categoryId", - column: x => x.categoryId, - principalTable: "category", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_brand_category_brandId", - table: "brand_category", - column: "brandId"); - - migrationBuilder.CreateIndex( - name: "IX_brand_category_categoryId", - table: "brand_category", - column: "categoryId"); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106110713_ec4.Designer.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106110713_ec4.Designer.cs deleted file mode 100644 index 9c033a51..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106110713_ec4.Designer.cs +++ /dev/null @@ -1,799 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Yi.Framework.Model; - -namespace Yi.Framework.Model.Migrations -{ - [DbContext(typeof(DataContext))] - [Migration("20211106110713_ec4")] - partial class ec4 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 64) - .HasAnnotation("ProductVersion", "5.0.11"); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("image") - .HasColumnType("longtext") - .HasComment("品牌图片"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("letter") - .HasColumnType("longtext") - .HasComment("品牌首字母"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("品牌名称"); - - b.HasKey("id"); - - b.ToTable("brand"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_parent") - .HasColumnType("int") - .HasComment("是否父类别"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("类别名称"); - - b.Property("sort") - .HasColumnType("int") - .HasComment("排序"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.ToTable("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_show") - .HasColumnType("int"); - - b.Property("is_top") - .HasColumnType("int"); - - b.Property("menu_name") - .HasColumnType("longtext"); - - b.Property("menuid") - .HasColumnType("int"); - - b.Property("mouldid") - .HasColumnType("int"); - - b.Property("router") - .HasColumnType("longtext"); - - b.Property("sort") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("menuid"); - - b.HasIndex("mouldid"); - - b.ToTable("menu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.mould", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("mould_name") - .HasColumnType("longtext"); - - b.Property("url") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.order", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("actual_pay") - .HasColumnType("int") - .HasComment("实付金额。单位:分。如:20007,表示:200元7分"); - - b.Property("buyer_message") - .HasColumnType("longtext") - .HasComment("买家留言"); - - b.Property("buyer_nick") - .HasColumnType("longtext") - .HasComment("买家昵称"); - - b.Property("buyer_rate") - .HasColumnType("int") - .HasComment("买家是否已经评价,0未评价,1已评价"); - - b.Property("creat_time") - .HasColumnType("datetime(6)") - .HasComment("订单创建时间"); - - b.Property("invoice_type") - .HasColumnType("int") - .HasComment("发票类型:0无发票1普通发票,2电子发票,3增值税发票"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("payment_type") - .HasColumnType("int") - .HasComment("支付类型,1、在线支付,2、货到付款"); - - b.Property("post_fee") - .HasColumnType("int") - .HasComment("邮费。单位:分。如:20007,表示:200元7分"); - - b.Property("promotion_ids") - .HasColumnType("longtext") - .HasComment("promotion_ids"); - - b.Property("receiver") - .HasColumnType("longtext") - .HasComment("收货人"); - - b.Property("receiver_address") - .HasColumnType("longtext") - .HasComment("收获地址(街道、住址等详细地址)"); - - b.Property("receiver_city") - .HasColumnType("longtext") - .HasComment("收获地址(市)"); - - b.Property("receiver_district") - .HasColumnType("longtext") - .HasComment("收获地址(区/县)"); - - b.Property("receiver_mobile") - .HasColumnType("longtext") - .HasComment("收货人手机"); - - b.Property("receiver_state") - .HasColumnType("longtext") - .HasComment("收获地址(省)"); - - b.Property("receiver_zip") - .HasColumnType("longtext") - .HasComment("收货人邮编"); - - b.Property("shipping_code") - .HasColumnType("longtext") - .HasComment("物流单号"); - - b.Property("shipping_name") - .HasColumnType("longtext") - .HasComment("物流名称"); - - b.Property("skuid") - .HasColumnType("int"); - - b.Property("source_type") - .HasColumnType("int") - .HasComment("订单来源:1:app端,2:pc端,3:M端,4:微信端,5:手机qq端"); - - b.Property("total_pay") - .HasColumnType("int") - .HasComment("总金额,单位为分"); - - b.HasKey("id"); - - b.HasIndex("skuid"); - - b.ToTable("order"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("introduce") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("role_name") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("role"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("crate_time") - .HasColumnType("datetime(6)") - .HasComment("创建时间"); - - b.Property("enable") - .HasColumnType("int") - .HasComment("是否有效,0无效,1有效"); - - b.Property("images") - .HasColumnType("longtext") - .HasComment("商品的图片,多个图片以‘,’分割"); - - b.Property("indexes") - .HasColumnType("longtext") - .HasComment("特有规格属性在spu属性模板中的对应下标组合"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("last_update_time") - .HasColumnType("datetime(6)") - .HasComment("最后更新时间"); - - b.Property("own_spec") - .HasColumnType("longtext") - .HasComment("sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序"); - - b.Property("price") - .HasColumnType("int") - .HasComment("销售价格,单位为分"); - - b.Property("spuid") - .HasColumnType("int"); - - b.Property("title") - .HasColumnType("longtext") - .HasComment("商品标题"); - - b.HasKey("id"); - - b.HasIndex("spuid"); - - b.ToTable("sku"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("规格组名称"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.ToTable("spec_group"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("generic") - .HasColumnType("int") - .HasComment("是否是sku通用属性,true或false"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("参数名"); - - b.Property("numeric") - .HasColumnType("int") - .HasComment("是否是数字类型参数,true或false"); - - b.Property("searching") - .HasColumnType("int") - .HasComment("是否用于搜索过滤,true或false"); - - b.Property("segments") - .HasColumnType("longtext") - .HasComment("数值类型参数,如果需要搜索,则添加分段间隔值,如CPU频率间隔:0.5-1.0"); - - b.Property("spec_Groupid") - .HasColumnType("int"); - - b.Property("unit") - .HasColumnType("longtext") - .HasComment("数字类型参数的单位,非数字类型可以为空"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.HasIndex("spec_Groupid"); - - b.ToTable("spec_param"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("brandid") - .HasColumnType("int"); - - b.Property("crate_time") - .HasColumnType("datetime(6)") - .HasComment("创建时间"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("last_update_time") - .HasColumnType("datetime(6)") - .HasComment("最后更新时间"); - - b.Property("saleable") - .HasColumnType("int") - .HasComment("是否上架"); - - b.Property("spu_Detailid") - .HasColumnType("int"); - - b.Property("sub_title") - .HasColumnType("longtext") - .HasComment("子标题"); - - b.Property("title") - .HasColumnType("longtext") - .HasComment("标题"); - - b.Property("valid") - .HasColumnType("int") - .HasComment("是否有效"); - - b.HasKey("id"); - - b.HasIndex("brandid"); - - b.HasIndex("spu_Detailid"); - - b.ToTable("spu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu_detail", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("after_service") - .HasColumnType("longtext") - .HasComment("售后服务"); - - b.Property("description") - .HasColumnType("longtext") - .HasComment("描述"); - - b.Property("generic_spec") - .HasColumnType("longtext") - .HasComment("通用规格参数数据"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("packing_list") - .HasColumnType("longtext") - .HasComment("包装清单"); - - b.Property("special_spec") - .HasColumnType("longtext") - .HasComment("特有规格参数及可选值信息,json格式"); - - b.HasKey("id"); - - b.ToTable("spu_detail"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.stock", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("seckill_stock") - .HasColumnType("int") - .HasComment("可秒杀库存"); - - b.Property("seckill_total") - .HasColumnType("int") - .HasComment("秒杀总数量"); - - b.Property("skuid") - .HasColumnType("int"); - - b.Property("stock_count") - .HasColumnType("int") - .HasComment("库存数量"); - - b.HasKey("id"); - - b.HasIndex("skuid"); - - b.ToTable("stock"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("address") - .HasColumnType("longtext"); - - b.Property("age") - .HasColumnType("int"); - - b.Property("email") - .HasColumnType("longtext"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("introduction") - .HasColumnType("longtext"); - - b.Property("ip") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("nick") - .HasColumnType("longtext"); - - b.Property("password") - .HasColumnType("longtext"); - - b.Property("phone") - .HasColumnType("longtext"); - - b.Property("username") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("user"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.visit", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("num") - .HasColumnType("int"); - - b.Property("time") - .HasColumnType("datetime(6)"); - - b.HasKey("id"); - - b.ToTable("visit"); - }); - - modelBuilder.Entity("brandcategory", b => - { - b.Property("brandsid") - .HasColumnType("int"); - - b.Property("categoriesid") - .HasColumnType("int"); - - b.HasKey("brandsid", "categoriesid"); - - b.HasIndex("categoriesid"); - - b.ToTable("brandcategory"); - }); - - modelBuilder.Entity("categoryspu", b => - { - b.Property("categoriesid") - .HasColumnType("int"); - - b.Property("spusid") - .HasColumnType("int"); - - b.HasKey("categoriesid", "spusid"); - - b.HasIndex("spusid"); - - b.ToTable("categoryspu"); - }); - - modelBuilder.Entity("menurole", b => - { - b.Property("menusid") - .HasColumnType("int"); - - b.Property("rolesid") - .HasColumnType("int"); - - b.HasKey("menusid", "rolesid"); - - b.HasIndex("rolesid"); - - b.ToTable("menurole"); - }); - - modelBuilder.Entity("roleuser", b => - { - b.Property("rolesid") - .HasColumnType("int"); - - b.Property("usersid") - .HasColumnType("int"); - - b.HasKey("rolesid", "usersid"); - - b.HasIndex("usersid"); - - b.ToTable("roleuser"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany("chidrens") - .HasForeignKey("categoryid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany("children") - .HasForeignKey("menuid"); - - b.HasOne("Yi.Framework.Model.Models.mould", "mould") - .WithMany() - .HasForeignKey("mouldid"); - - b.Navigation("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.order", b => - { - b.HasOne("Yi.Framework.Model.Models.sku", null) - .WithMany("orders") - .HasForeignKey("skuid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.HasOne("Yi.Framework.Model.Models.spu", "spu") - .WithMany("skus") - .HasForeignKey("spuid"); - - b.Navigation("spu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("spec_Groups") - .HasForeignKey("categoryid"); - - b.Navigation("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b => - { - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("spec_Params") - .HasForeignKey("categoryid"); - - b.HasOne("Yi.Framework.Model.Models.spec_group", "spec_Group") - .WithMany("spec_Params") - .HasForeignKey("spec_Groupid"); - - b.Navigation("category"); - - b.Navigation("spec_Group"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.HasOne("Yi.Framework.Model.Models.brand", "brand") - .WithMany("spus") - .HasForeignKey("brandid"); - - b.HasOne("Yi.Framework.Model.Models.spu_detail", "spu_Detail") - .WithMany() - .HasForeignKey("spu_Detailid"); - - b.Navigation("brand"); - - b.Navigation("spu_Detail"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.stock", b => - { - b.HasOne("Yi.Framework.Model.Models.sku", "sku") - .WithMany() - .HasForeignKey("skuid"); - - b.Navigation("sku"); - }); - - modelBuilder.Entity("brandcategory", b => - { - b.HasOne("Yi.Framework.Model.Models.brand", null) - .WithMany() - .HasForeignKey("brandsid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany() - .HasForeignKey("categoriesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("categoryspu", b => - { - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany() - .HasForeignKey("categoriesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.spu", null) - .WithMany() - .HasForeignKey("spusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("menurole", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany() - .HasForeignKey("menusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("roleuser", b => - { - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.user", null) - .WithMany() - .HasForeignKey("usersid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand", b => - { - b.Navigation("spus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.Navigation("chidrens"); - - b.Navigation("spec_Groups"); - - b.Navigation("spec_Params"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Navigation("children"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.Navigation("orders"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.Navigation("spec_Params"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.Navigation("skus"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106110713_ec4.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106110713_ec4.cs deleted file mode 100644 index dc279917..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/20211106110713_ec4.cs +++ /dev/null @@ -1,161 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Yi.Framework.Model.Migrations -{ - public partial class ec4 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_menu_role_roleid", - table: "menu"); - - migrationBuilder.DropForeignKey( - name: "FK_role_user_userid", - table: "role"); - - migrationBuilder.DropIndex( - name: "IX_role_userid", - table: "role"); - - migrationBuilder.DropIndex( - name: "IX_menu_roleid", - table: "menu"); - - migrationBuilder.DropColumn( - name: "userid", - table: "role"); - - migrationBuilder.DropColumn( - name: "roleid", - table: "menu"); - - migrationBuilder.AlterColumn( - name: "phone", - table: "user", - type: "longtext", - nullable: true, - oldClrType: typeof(int), - oldType: "int", - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "menurole", - columns: table => new - { - menusid = table.Column(type: "int", nullable: false), - rolesid = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_menurole", x => new { x.menusid, x.rolesid }); - table.ForeignKey( - name: "FK_menurole_menu_menusid", - column: x => x.menusid, - principalTable: "menu", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_menurole_role_rolesid", - column: x => x.rolesid, - principalTable: "role", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "roleuser", - columns: table => new - { - rolesid = table.Column(type: "int", nullable: false), - usersid = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_roleuser", x => new { x.rolesid, x.usersid }); - table.ForeignKey( - name: "FK_roleuser_role_rolesid", - column: x => x.rolesid, - principalTable: "role", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_roleuser_user_usersid", - column: x => x.usersid, - principalTable: "user", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_menurole_rolesid", - table: "menurole", - column: "rolesid"); - - migrationBuilder.CreateIndex( - name: "IX_roleuser_usersid", - table: "roleuser", - column: "usersid"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "menurole"); - - migrationBuilder.DropTable( - name: "roleuser"); - - migrationBuilder.AlterColumn( - name: "phone", - table: "user", - type: "int", - nullable: true, - oldClrType: typeof(string), - oldType: "longtext", - oldNullable: true) - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "userid", - table: "role", - type: "int", - nullable: true); - - migrationBuilder.AddColumn( - name: "roleid", - table: "menu", - type: "int", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_role_userid", - table: "role", - column: "userid"); - - migrationBuilder.CreateIndex( - name: "IX_menu_roleid", - table: "menu", - column: "roleid"); - - migrationBuilder.AddForeignKey( - name: "FK_menu_role_roleid", - table: "menu", - column: "roleid", - principalTable: "role", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_role_user_userid", - table: "role", - column: "userid", - principalTable: "user", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/DataContextModelSnapshot.cs b/Yi.Framework.Net5/Yi.Framework.Model/Migrations/DataContextModelSnapshot.cs deleted file mode 100644 index 7fcf5023..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Migrations/DataContextModelSnapshot.cs +++ /dev/null @@ -1,797 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Yi.Framework.Model; - -namespace Yi.Framework.Model.Migrations -{ - [DbContext(typeof(DataContext))] - partial class DataContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 64) - .HasAnnotation("ProductVersion", "5.0.11"); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("image") - .HasColumnType("longtext") - .HasComment("品牌图片"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("letter") - .HasColumnType("longtext") - .HasComment("品牌首字母"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("品牌名称"); - - b.HasKey("id"); - - b.ToTable("brand"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_parent") - .HasColumnType("int") - .HasComment("是否父类别"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("类别名称"); - - b.Property("sort") - .HasColumnType("int") - .HasComment("排序"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.ToTable("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("is_show") - .HasColumnType("int"); - - b.Property("is_top") - .HasColumnType("int"); - - b.Property("menu_name") - .HasColumnType("longtext"); - - b.Property("menuid") - .HasColumnType("int"); - - b.Property("mouldid") - .HasColumnType("int"); - - b.Property("router") - .HasColumnType("longtext"); - - b.Property("sort") - .HasColumnType("int"); - - b.HasKey("id"); - - b.HasIndex("menuid"); - - b.HasIndex("mouldid"); - - b.ToTable("menu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.mould", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("mould_name") - .HasColumnType("longtext"); - - b.Property("url") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.order", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("actual_pay") - .HasColumnType("int") - .HasComment("实付金额。单位:分。如:20007,表示:200元7分"); - - b.Property("buyer_message") - .HasColumnType("longtext") - .HasComment("买家留言"); - - b.Property("buyer_nick") - .HasColumnType("longtext") - .HasComment("买家昵称"); - - b.Property("buyer_rate") - .HasColumnType("int") - .HasComment("买家是否已经评价,0未评价,1已评价"); - - b.Property("creat_time") - .HasColumnType("datetime(6)") - .HasComment("订单创建时间"); - - b.Property("invoice_type") - .HasColumnType("int") - .HasComment("发票类型:0无发票1普通发票,2电子发票,3增值税发票"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("payment_type") - .HasColumnType("int") - .HasComment("支付类型,1、在线支付,2、货到付款"); - - b.Property("post_fee") - .HasColumnType("int") - .HasComment("邮费。单位:分。如:20007,表示:200元7分"); - - b.Property("promotion_ids") - .HasColumnType("longtext") - .HasComment("promotion_ids"); - - b.Property("receiver") - .HasColumnType("longtext") - .HasComment("收货人"); - - b.Property("receiver_address") - .HasColumnType("longtext") - .HasComment("收获地址(街道、住址等详细地址)"); - - b.Property("receiver_city") - .HasColumnType("longtext") - .HasComment("收获地址(市)"); - - b.Property("receiver_district") - .HasColumnType("longtext") - .HasComment("收获地址(区/县)"); - - b.Property("receiver_mobile") - .HasColumnType("longtext") - .HasComment("收货人手机"); - - b.Property("receiver_state") - .HasColumnType("longtext") - .HasComment("收获地址(省)"); - - b.Property("receiver_zip") - .HasColumnType("longtext") - .HasComment("收货人邮编"); - - b.Property("shipping_code") - .HasColumnType("longtext") - .HasComment("物流单号"); - - b.Property("shipping_name") - .HasColumnType("longtext") - .HasComment("物流名称"); - - b.Property("skuid") - .HasColumnType("int"); - - b.Property("source_type") - .HasColumnType("int") - .HasComment("订单来源:1:app端,2:pc端,3:M端,4:微信端,5:手机qq端"); - - b.Property("total_pay") - .HasColumnType("int") - .HasComment("总金额,单位为分"); - - b.HasKey("id"); - - b.HasIndex("skuid"); - - b.ToTable("order"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.role", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("introduce") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("role_name") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("role"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("crate_time") - .HasColumnType("datetime(6)") - .HasComment("创建时间"); - - b.Property("enable") - .HasColumnType("int") - .HasComment("是否有效,0无效,1有效"); - - b.Property("images") - .HasColumnType("longtext") - .HasComment("商品的图片,多个图片以‘,’分割"); - - b.Property("indexes") - .HasColumnType("longtext") - .HasComment("特有规格属性在spu属性模板中的对应下标组合"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("last_update_time") - .HasColumnType("datetime(6)") - .HasComment("最后更新时间"); - - b.Property("own_spec") - .HasColumnType("longtext") - .HasComment("sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序"); - - b.Property("price") - .HasColumnType("int") - .HasComment("销售价格,单位为分"); - - b.Property("spuid") - .HasColumnType("int"); - - b.Property("title") - .HasColumnType("longtext") - .HasComment("商品标题"); - - b.HasKey("id"); - - b.HasIndex("spuid"); - - b.ToTable("sku"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("规格组名称"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.ToTable("spec_group"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("categoryid") - .HasColumnType("int"); - - b.Property("generic") - .HasColumnType("int") - .HasComment("是否是sku通用属性,true或false"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("name") - .HasColumnType("longtext") - .HasComment("参数名"); - - b.Property("numeric") - .HasColumnType("int") - .HasComment("是否是数字类型参数,true或false"); - - b.Property("searching") - .HasColumnType("int") - .HasComment("是否用于搜索过滤,true或false"); - - b.Property("segments") - .HasColumnType("longtext") - .HasComment("数值类型参数,如果需要搜索,则添加分段间隔值,如CPU频率间隔:0.5-1.0"); - - b.Property("spec_Groupid") - .HasColumnType("int"); - - b.Property("unit") - .HasColumnType("longtext") - .HasComment("数字类型参数的单位,非数字类型可以为空"); - - b.HasKey("id"); - - b.HasIndex("categoryid"); - - b.HasIndex("spec_Groupid"); - - b.ToTable("spec_param"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("brandid") - .HasColumnType("int"); - - b.Property("crate_time") - .HasColumnType("datetime(6)") - .HasComment("创建时间"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("last_update_time") - .HasColumnType("datetime(6)") - .HasComment("最后更新时间"); - - b.Property("saleable") - .HasColumnType("int") - .HasComment("是否上架"); - - b.Property("spu_Detailid") - .HasColumnType("int"); - - b.Property("sub_title") - .HasColumnType("longtext") - .HasComment("子标题"); - - b.Property("title") - .HasColumnType("longtext") - .HasComment("标题"); - - b.Property("valid") - .HasColumnType("int") - .HasComment("是否有效"); - - b.HasKey("id"); - - b.HasIndex("brandid"); - - b.HasIndex("spu_Detailid"); - - b.ToTable("spu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu_detail", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("after_service") - .HasColumnType("longtext") - .HasComment("售后服务"); - - b.Property("description") - .HasColumnType("longtext") - .HasComment("描述"); - - b.Property("generic_spec") - .HasColumnType("longtext") - .HasComment("通用规格参数数据"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("packing_list") - .HasColumnType("longtext") - .HasComment("包装清单"); - - b.Property("special_spec") - .HasColumnType("longtext") - .HasComment("特有规格参数及可选值信息,json格式"); - - b.HasKey("id"); - - b.ToTable("spu_detail"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.stock", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("seckill_stock") - .HasColumnType("int") - .HasComment("可秒杀库存"); - - b.Property("seckill_total") - .HasColumnType("int") - .HasComment("秒杀总数量"); - - b.Property("skuid") - .HasColumnType("int"); - - b.Property("stock_count") - .HasColumnType("int") - .HasComment("库存数量"); - - b.HasKey("id"); - - b.HasIndex("skuid"); - - b.ToTable("stock"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.user", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("address") - .HasColumnType("longtext"); - - b.Property("age") - .HasColumnType("int"); - - b.Property("email") - .HasColumnType("longtext"); - - b.Property("icon") - .HasColumnType("longtext"); - - b.Property("introduction") - .HasColumnType("longtext"); - - b.Property("ip") - .HasColumnType("longtext"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("nick") - .HasColumnType("longtext"); - - b.Property("password") - .HasColumnType("longtext"); - - b.Property("phone") - .HasColumnType("longtext"); - - b.Property("username") - .HasColumnType("longtext"); - - b.HasKey("id"); - - b.ToTable("user"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.visit", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("is_delete") - .HasColumnType("int"); - - b.Property("num") - .HasColumnType("int"); - - b.Property("time") - .HasColumnType("datetime(6)"); - - b.HasKey("id"); - - b.ToTable("visit"); - }); - - modelBuilder.Entity("brandcategory", b => - { - b.Property("brandsid") - .HasColumnType("int"); - - b.Property("categoriesid") - .HasColumnType("int"); - - b.HasKey("brandsid", "categoriesid"); - - b.HasIndex("categoriesid"); - - b.ToTable("brandcategory"); - }); - - modelBuilder.Entity("categoryspu", b => - { - b.Property("categoriesid") - .HasColumnType("int"); - - b.Property("spusid") - .HasColumnType("int"); - - b.HasKey("categoriesid", "spusid"); - - b.HasIndex("spusid"); - - b.ToTable("categoryspu"); - }); - - modelBuilder.Entity("menurole", b => - { - b.Property("menusid") - .HasColumnType("int"); - - b.Property("rolesid") - .HasColumnType("int"); - - b.HasKey("menusid", "rolesid"); - - b.HasIndex("rolesid"); - - b.ToTable("menurole"); - }); - - modelBuilder.Entity("roleuser", b => - { - b.Property("rolesid") - .HasColumnType("int"); - - b.Property("usersid") - .HasColumnType("int"); - - b.HasKey("rolesid", "usersid"); - - b.HasIndex("usersid"); - - b.ToTable("roleuser"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany("chidrens") - .HasForeignKey("categoryid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany("children") - .HasForeignKey("menuid"); - - b.HasOne("Yi.Framework.Model.Models.mould", "mould") - .WithMany() - .HasForeignKey("mouldid"); - - b.Navigation("mould"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.order", b => - { - b.HasOne("Yi.Framework.Model.Models.sku", null) - .WithMany("orders") - .HasForeignKey("skuid"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.HasOne("Yi.Framework.Model.Models.spu", "spu") - .WithMany("skus") - .HasForeignKey("spuid"); - - b.Navigation("spu"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("spec_Groups") - .HasForeignKey("categoryid"); - - b.Navigation("category"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_param", b => - { - b.HasOne("Yi.Framework.Model.Models.category", "category") - .WithMany("spec_Params") - .HasForeignKey("categoryid"); - - b.HasOne("Yi.Framework.Model.Models.spec_group", "spec_Group") - .WithMany("spec_Params") - .HasForeignKey("spec_Groupid"); - - b.Navigation("category"); - - b.Navigation("spec_Group"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.HasOne("Yi.Framework.Model.Models.brand", "brand") - .WithMany("spus") - .HasForeignKey("brandid"); - - b.HasOne("Yi.Framework.Model.Models.spu_detail", "spu_Detail") - .WithMany() - .HasForeignKey("spu_Detailid"); - - b.Navigation("brand"); - - b.Navigation("spu_Detail"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.stock", b => - { - b.HasOne("Yi.Framework.Model.Models.sku", "sku") - .WithMany() - .HasForeignKey("skuid"); - - b.Navigation("sku"); - }); - - modelBuilder.Entity("brandcategory", b => - { - b.HasOne("Yi.Framework.Model.Models.brand", null) - .WithMany() - .HasForeignKey("brandsid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany() - .HasForeignKey("categoriesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("categoryspu", b => - { - b.HasOne("Yi.Framework.Model.Models.category", null) - .WithMany() - .HasForeignKey("categoriesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.spu", null) - .WithMany() - .HasForeignKey("spusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("menurole", b => - { - b.HasOne("Yi.Framework.Model.Models.menu", null) - .WithMany() - .HasForeignKey("menusid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("roleuser", b => - { - b.HasOne("Yi.Framework.Model.Models.role", null) - .WithMany() - .HasForeignKey("rolesid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Yi.Framework.Model.Models.user", null) - .WithMany() - .HasForeignKey("usersid") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.brand", b => - { - b.Navigation("spus"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.category", b => - { - b.Navigation("chidrens"); - - b.Navigation("spec_Groups"); - - b.Navigation("spec_Params"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.menu", b => - { - b.Navigation("children"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.sku", b => - { - b.Navigation("orders"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spec_group", b => - { - b.Navigation("spec_Params"); - }); - - modelBuilder.Entity("Yi.Framework.Model.Models.spu", b => - { - b.Navigation("skus"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/DbContextExtend.cs b/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/DbContextExtend.cs deleted file mode 100644 index d4cb3846..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/DbContextExtend.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Text; - -namespace Yi.Framework.Model.ModelFactory -{ - public static class DbContextExtend - { - public static DbContext ToWriteOrRead(this DbContext dbContext, string conn) - { - if (dbContext is DataContext) - { - - var context= (DataContext)dbContext; // context 是 EFCoreContext 实例; - - return context.ToWriteOrRead(conn); - } - else - throw new Exception(); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/DbContextFactory.cs b/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/DbContextFactory.cs deleted file mode 100644 index a156afdf..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/DbContextFactory.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Options; -using System; -using System.Collections.Generic; -using System.Text; -using Yi.Framework.Common.Enum; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.Model.ModelFactory -{ - public class DbContextFactory : IDbContextFactory - { - - private DbContext _Context = null; - - private DbConnOptions _readAndWrite = null; - - public static bool MutiDB_Enabled = false; - //private static int _iSeed = 0;//应该long - - /// - ///能把链接信息也注入进来 - ///需要IOptionsMonitor - /// - /// - public DbContextFactory(DbContext context, IOptionsMonitor options) - { - _readAndWrite = options.CurrentValue; - this._Context = context; - } - public DbContext ConnWriteOrRead(WriteAndReadEnum writeAndRead) - { - //判断枚举,不同的枚举可以创建不同的Context 或者更换Context链接; - if (MutiDB_Enabled) - { - switch (writeAndRead) - { - case WriteAndReadEnum.Write: - ToWrite(); - break; //选择链接//更换_Context链接 //选择链接 - case WriteAndReadEnum.Read: - ToRead(); - break; //选择链接//更换_Context链接 - default: - break; - } - } - else - { - ToWrite(); - } - - return _Context; - } - - /// - /// 更换成主库连接 - /// - /// - private void ToWrite() - { - string conn = _readAndWrite.WriteUrl; - //_Context.Database.GetDbConnection().; - _Context.ToWriteOrRead(conn); - } - - - private static int _iSeed = 0; - - /// - /// 更换成主库连接 - /// - /// ///策略---数据库查询的负载均衡 - /// - /// - private void ToRead() - { - string conn = string.Empty; - { - // //随机 - //int Count= _readAndWrite.ReadConnectionList.Count; - //int index= new Random().Next(0, Count); - //conn = _readAndWrite.ReadConnectionList[index]; - } - { - //来一个轮询 - conn = this._readAndWrite.ReadUrl[_iSeed++ % this._readAndWrite.ReadUrl.Count];//轮询; - } - { - ///是不是可以直接配置到配置文件里面 - } - _Context.ToWriteOrRead(conn); - } - - //public DbContext CreateContext() - //{ - - //} - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/IDbContextFactory.cs b/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/IDbContextFactory.cs deleted file mode 100644 index 818bca67..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/ModelFactory/IDbContextFactory.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Text; -using Yi.Framework.Common.Enum; - -namespace Yi.Framework.Model.ModelFactory -{ - public interface IDbContextFactory - { - public DbContext ConnWriteOrRead(WriteAndReadEnum writeAndRead); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Models/menu.cs b/Yi.Framework.Net5/Yi.Framework.Model/Models/menu.cs deleted file mode 100644 index 0a562163..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Models/menu.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Model.Models -{ - public class menu :loopModel - { - public string icon { get; set; } - public string router { get; set; } - public string menu_name { get; set; } - - - - public List children { get; set; } - - public List roles { get; set; } - - public mould mould { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Models/mould.cs b/Yi.Framework.Net5/Yi.Framework.Model/Models/mould.cs deleted file mode 100644 index f86a5489..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Models/mould.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Model.Models -{ - public class mould:baseModel - { - public string mould_name { get; set; } - public string url { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Models/role.cs b/Yi.Framework.Net5/Yi.Framework.Model/Models/role.cs deleted file mode 100644 index 8516124f..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Models/role.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Model.Models -{ - public class role:baseModel - { - public string role_name { get; set; } - public string introduce { get; set; } - - - public List menus { get; set; } - public List users { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Models/user.cs b/Yi.Framework.Net5/Yi.Framework.Model/Models/user.cs deleted file mode 100644 index 58857e36..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Models/user.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Model.Models -{ - public class user:baseModel - { - public string username { get; set; } - public string password { get; set; } - public string icon { get; set; } - public string nick { get; set; } - public string email { get; set; } - public string ip { get; set; } - public int? age { get; set; } - public string introduction { get; set; } - public string address { get; set; } - public string phone { get; set; } - - - public List roles { get; set; } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Models/visit.cs b/Yi.Framework.Net5/Yi.Framework.Model/Models/visit.cs deleted file mode 100644 index 845b753c..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Models/visit.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Model.Models -{ - public class visit:baseModel - { - public DateTime time { get; set; } - public int num { get; set; } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Search/PageResult.cs b/Yi.Framework.Net5/Yi.Framework.Model/Search/PageResult.cs deleted file mode 100644 index 52fde5cb..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Search/PageResult.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Yi.Framework.Model.Search -{ - public class PageResult - { - public static readonly long serialVersionUID = 4612105649493688532L; - public long total; // 总记录数 - public int totalPages; //总页数 - public List rows; // 每页显示的数据集合 - - public PageResult(long total, List rows) - { - this.total = total; - this.rows = rows; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Search/SearchRequest.cs b/Yi.Framework.Net5/Yi.Framework.Model/Search/SearchRequest.cs deleted file mode 100644 index a3853d37..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Search/SearchRequest.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Model.Search -{ - public class SearchRequest - { - public static readonly int DEFAULT_PAGE = 1; - public static readonly int DEFAULT_SIZE = 20; - public string key { get; set; } - public int page { get; set; } - //排序字段 - public string sortBy { get; set; } - //是否降序 - public bool descending { get; set; } - //过滤字段 - public Dictionary filter = new Dictionary(); - - public int getPage() - { - if (page == 0) - { - return DEFAULT_PAGE; - } - // 获取页码时做一些校验,不能小于1 - return Math.Max(DEFAULT_PAGE, page); - } - - public int getSize() - { - return DEFAULT_SIZE; - } - - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Model/T4DataContext.cs b/Yi.Framework.Net5/Yi.Framework.Model/T4DataContext.cs deleted file mode 100644 index 071e4b24..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/T4DataContext.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Text; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Model -{ - public partial class DataContext :DbContext - { - public DbSet menu { get; set; } - public DbSet mould { get; set; } - public DbSet role { get; set; } - public DbSet user { get; set; } - public DbSet visit { get; set; } - } -} - diff --git a/Yi.Framework.Net5/Yi.Framework.Model/T4DataContext.tt b/Yi.Framework.Net5/Yi.Framework.Model/T4DataContext.tt deleted file mode 100644 index ecc01244..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/T4DataContext.tt +++ /dev/null @@ -1,40 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.IO" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string dirPath= Path.Combine(solutionsPath,@"Yi.Framework.Model\Models\"); - DirectoryInfo dir = new DirectoryInfo(dirPath); - FileInfo[] finfo = dir.GetFiles(); - string filenames = string.Empty; - List filenameList = new List(); - for (int i = 0; i < finfo.Length; i++) - { - filenames = finfo[i].Name ; - string[] f=filenames.Split('.'); - filenameList.Add(f[0]); - } - - -#> -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Text; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Model -{ - public partial class DataContext :DbContext - { -<# foreach(string k in filenameList){ - #> - public DbSet<<#=k #>> <#=k #> { get; set; } -<# } #> - } -} - diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Yi - Backup (1).Framework.Model.csproj b/Yi.Framework.Net5/Yi.Framework.Model/Yi - Backup (1).Framework.Model.csproj deleted file mode 100644 index a18e350c..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Yi - Backup (1).Framework.Model.csproj +++ /dev/null @@ -1,59 +0,0 @@ - - - - net5.0 - - - - - True - True - T4DataContext.tt - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - TextTemplatingFileGenerator - T4DaraContext.cs - - - TextTemplatingFileGenerator - T4DataContext.cs - - - - - - - - - - True - True - T4DaraContext.tt - - - True - True - T4DataContext.tt - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Yi - Backup.Framework.Model.csproj b/Yi.Framework.Net5/Yi.Framework.Model/Yi - Backup.Framework.Model.csproj deleted file mode 100644 index 7cfe4b70..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Yi - Backup.Framework.Model.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Model/Yi.Framework.Model.csproj b/Yi.Framework.Net5/Yi.Framework.Model/Yi.Framework.Model.csproj deleted file mode 100644 index a18e350c..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Model/Yi.Framework.Model.csproj +++ /dev/null @@ -1,59 +0,0 @@ - - - - net5.0 - - - - - True - True - T4DataContext.tt - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - TextTemplatingFileGenerator - T4DaraContext.cs - - - TextTemplatingFileGenerator - T4DataContext.cs - - - - - - - - - - True - True - T4DaraContext.tt - - - True - True - T4DataContext.tt - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Log4net.config b/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Log4net.config deleted file mode 100644 index 958c7e78..00000000 --- a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Log4net.config +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Program.cs b/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Program.cs deleted file mode 100644 index c2e35d88..00000000 --- a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Program.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.OcelotGateway -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureAppConfiguration((hostBuilderContext, configurationBuilder) => - { - configurationBuilder.AddCommandLine(args); - configurationBuilder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false); - configurationBuilder.AddJsonFile("configuration.json", optional: false, reloadOnChange: true); - #region - //Apollo - #endregion - //configurationBuilder.AddApolloService("Yi"); - }) - .ConfigureLogging(loggingBuilder => - { - loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddLog4Net(); - }) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup().UseUrls("http://*:7200"); - }); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Startup.cs b/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Startup.cs deleted file mode 100644 index 25a2f4b2..00000000 --- a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Startup.cs +++ /dev/null @@ -1,80 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Microsoft.OpenApi.Models; -using Ocelot.DependencyInjection; -using Ocelot.Middleware; -using Ocelot.Provider.Consul; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; -using Ocelot.Cache.CacheManager; -using Yi.Framework.WebCore.MiddlewareExtend; -using Ocelot.Provider.Polly; - -namespace Yi.Framework.OcelotGateway -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - - services.AddControllers(); - #region - // - #endregion - services.AddCorsService(); - - #region - //ط - #endregion - services.AddOcelot().AddConsul().AddCacheManager(x =>{x.WithDictionaryHandle();}).AddPolly(); - - #region - //Swagger - #endregion - services.AddSwaggerService("Yi.Framework.OcelotGateway"); - #region - //JwtȨ - #endregion - services.AddJwtService(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - //if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - #region - //Swaggerע - #endregion - app.UseSwaggerService(new SwaggerModel("api/api/swagger/v1/swagger.json","API"), new SwaggerModel("api/item/swagger/v1/swagger.json", "̬ҳ")); - } - #region - //طע - #endregion - app.UseOcelot(); - - #region - //Ȩע - #endregion - app.UseAuthentication(); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/SwaggerDoc.xml b/Yi.Framework.Net5/Yi.Framework.OcelotGateway/SwaggerDoc.xml deleted file mode 100644 index 16f3de1b..00000000 --- a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/SwaggerDoc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - Yi.Framework.OcelotGateway - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Yi.Framework.OcelotGateway.csproj b/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Yi.Framework.OcelotGateway.csproj deleted file mode 100644 index 9bb224ac..00000000 --- a/Yi.Framework.Net5/Yi.Framework.OcelotGateway/Yi.Framework.OcelotGateway.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net5.0 - - - - D:\CC.Yi\CC.Yi\Yi.Framework\Yi.Framework.OcelotGateway\SwaggerDoc.xml - 1701;1702;CS1591 - - - - - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.PageDetail/Controllers/PageDetaiController.cs b/Yi.Framework.Net5/Yi.Framework.PageDetail/Controllers/PageDetaiController.cs deleted file mode 100644 index 39a8aeaa..00000000 --- a/Yi.Framework.Net5/Yi.Framework.PageDetail/Controllers/PageDetaiController.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.PageDetail.Controllers -{ - public class PageDetaiController : Controller - { - private IUserService _IUserService; - public PageDetaiController(IUserService IUserService) - { - _IUserService = IUserService; - } - [Route("/item/{id}.html")] - public IActionResult Index(int id) - { - var htmlmodel = _IUserService.GetEntityById(id); - return View(htmlmodel); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.PageDetail/Log4net.config b/Yi.Framework.Net5/Yi.Framework.PageDetail/Log4net.config deleted file mode 100644 index 958c7e78..00000000 --- a/Yi.Framework.Net5/Yi.Framework.PageDetail/Log4net.config +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.PageDetail/Program.cs b/Yi.Framework.Net5/Yi.Framework.PageDetail/Program.cs deleted file mode 100644 index 17f7bd75..00000000 --- a/Yi.Framework.Net5/Yi.Framework.PageDetail/Program.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.PageDetail -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureAppConfiguration((hostBuilderContext, configurationBuilder) => - { - configurationBuilder.AddCommandLine(args); - configurationBuilder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false); - configurationBuilder.AddJsonFile("configuration.json", optional: false, reloadOnChange: true); - #region - //Apollo - #endregion - //configurationBuilder.AddApolloService("Yi"); - }) - .ConfigureLogging(loggingBuilder => - { - loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddLog4Net(); - }) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup().UseUrls("http://*:7007"); - }); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.PageDetail/Startup.cs b/Yi.Framework.Net5/Yi.Framework.PageDetail/Startup.cs deleted file mode 100644 index 52b9cce4..00000000 --- a/Yi.Framework.Net5/Yi.Framework.PageDetail/Startup.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Yi.Framework.Interface; -using Yi.Framework.Service; -using Yi.Framework.WebCore.MiddlewareExtend; - -namespace Yi.Framework.PageDetail -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddIocService(Configuration); - - services.AddControllers(); - #region - //Swagger - #endregion - services.AddSwaggerService("Yi.Framework.OcelotGateway.PageDetail"); - - services.AddScoped(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - //if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - #region - //Swaggerע - #endregion - app.UseSwaggerService(); - } - - app.UseHttpsRedirection(); - - app.UseRouting(); - - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.PageDetail/SwaggerDoc.xml b/Yi.Framework.Net5/Yi.Framework.PageDetail/SwaggerDoc.xml deleted file mode 100644 index f7714016..00000000 --- a/Yi.Framework.Net5/Yi.Framework.PageDetail/SwaggerDoc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - Yi.Framework.PageDetail - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.PageDetail/Views/PageDetai/Index.cshtml b/Yi.Framework.Net5/Yi.Framework.PageDetail/Views/PageDetai/Index.cshtml deleted file mode 100644 index 703417fb..00000000 --- a/Yi.Framework.Net5/Yi.Framework.PageDetail/Views/PageDetai/Index.cshtml +++ /dev/null @@ -1,90 +0,0 @@ -@model Yi.Framework.Model.Models.user - -@{ - ViewData["Title"] = "Index"; -} - -

Index

- -
-

user

-
-
-
- @Html.DisplayNameFor(model => model.username) -
-
- @Html.DisplayFor(model => model.username) -
-
- @Html.DisplayNameFor(model => model.password) -
-
- @Html.DisplayFor(model => model.password) -
-
- @Html.DisplayNameFor(model => model.icon) -
-
- @Html.DisplayFor(model => model.icon) -
-
- @Html.DisplayNameFor(model => model.nick) -
-
- @Html.DisplayFor(model => model.nick) -
-
- @Html.DisplayNameFor(model => model.email) -
-
- @Html.DisplayFor(model => model.email) -
-
- @Html.DisplayNameFor(model => model.ip) -
-
- @Html.DisplayFor(model => model.ip) -
-
- @Html.DisplayNameFor(model => model.age) -
-
- @Html.DisplayFor(model => model.age) -
-
- @Html.DisplayNameFor(model => model.introduction) -
-
- @Html.DisplayFor(model => model.introduction) -
-
- @Html.DisplayNameFor(model => model.address) -
-
- @Html.DisplayFor(model => model.address) -
-
- @Html.DisplayNameFor(model => model.phone) -
-
- @Html.DisplayFor(model => model.phone) -
-
- @Html.DisplayNameFor(model => model.id) -
-
- @Html.DisplayFor(model => model.id) -
-
- @Html.DisplayNameFor(model => model.is_delete) -
-
- @Html.DisplayFor(model => model.is_delete) -
-
-
-
- @Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) | - Back to List -
diff --git a/Yi.Framework.Net5/Yi.Framework.PageDetail/Views/Shared/_ValidationScriptsPartial.cshtml b/Yi.Framework.Net5/Yi.Framework.PageDetail/Views/Shared/_ValidationScriptsPartial.cshtml deleted file mode 100644 index ed86611b..00000000 --- a/Yi.Framework.Net5/Yi.Framework.PageDetail/Views/Shared/_ValidationScriptsPartial.cshtml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.PageDetail/Yi.Framework.PageDetail.csproj b/Yi.Framework.Net5/Yi.Framework.PageDetail/Yi.Framework.PageDetail.csproj deleted file mode 100644 index 464f7f90..00000000 --- a/Yi.Framework.Net5/Yi.Framework.PageDetail/Yi.Framework.PageDetail.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - net5.0 - - - - D:\CC.Yi\CC.Yi\Yi.Framework\Yi.Framework.PageDetail\SwaggerDoc.xml - ;NU1605 - 1701;1702;CS1591 - - - - - - - - - - - - - - - - - PreserveNewest - true - PreserveNewest - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Log4net.config b/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Log4net.config deleted file mode 100644 index 958c7e78..00000000 --- a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Log4net.config +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Program.cs b/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Program.cs deleted file mode 100644 index a0dfebec..00000000 --- a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Program.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Com.Ctrip.Framework.Apollo; -using Com.Ctrip.Framework.Apollo.Core; -using Com.Ctrip.Framework.Apollo.Enums; -using Com.Ctrip.Framework.Apollo.Logging; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Core; -using Yi.Framework.Core.ConsulExtend; -using Yi.Framework.WebCore; -using Yi.Framework.WebCore.MiddlewareExtend; - -namespace Yi.Framework.SMSProcessor -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureAppConfiguration((hostBuilderContext, configurationBuilder) => - { - configurationBuilder.AddCommandLine(args); - configurationBuilder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false); - //configurationBuilder.AddJsonFile("configuration.json", optional: false, reloadOnChange: true); - #region - //Apollo配置 - #endregion - //configurationBuilder.AddApolloService("Yi"); - }) - .ConfigureLogging(loggingBuilder => - { - loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddLog4Net(); - }) - .ConfigureServices((hostContext, services) => - { - - IConfiguration configuration = services.BuildServiceProvider().GetRequiredService(); - - #region - //Ioc配置 - #endregion - services.AddSingleton(new Appsettings(configuration)); - services.AddHostedService(); - services.AddHostedService(); - - #region 服务注入 - //services.Configure(configuration.GetSection("MysqlConn")); - - - #region - //RabbitMQ服务配置 - #endregion - services.AddRabbitMQService(); - #endregion - - #region - //短信服务配置 - #endregion - services.AddSMSService(); - - #region Consul - //services.Configure(configuration.GetSection("ConsulClientOption")); - //services.AddTransient(); - #endregion - - }); - } - } diff --git a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/SendWorker.cs b/Yi.Framework.Net5/Yi.Framework.SMSProcessor/SendWorker.cs deleted file mode 100644 index a2c942e3..00000000 --- a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/SendWorker.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Yi.Framework.Common.Const; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Common.Models; -using Yi.Framework.Common.QueueModel; -using Yi.Framework.Core; -using Yi.Framework.Core.ConsulExtend; -using Yi.Framework.Core.SMS; - -namespace Yi.Framework.SMSProcessor -{ - public class SendWorker : BackgroundService - { - private readonly ILogger _logger; - private readonly RabbitMQInvoker _RabbitMQInvoker; - private readonly AliyunSMSInvoker _aliyunSMSInvoker; - public SendWorker(ILogger logger, RabbitMQInvoker rabbitMQInvoker,AliyunSMSInvoker aliyunSMSInvoker) - { - this._logger = logger; - this._RabbitMQInvoker = rabbitMQInvoker; - _aliyunSMSInvoker = aliyunSMSInvoker; - - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - RabbitMQConsumerModel rabbitMQConsumerModel = new RabbitMQConsumerModel() - { - ExchangeName = RabbitConst.SMS_Exchange, - QueueName = RabbitConst.SMS_Queue_Send - }; - HttpClient _HttpClient = new HttpClient(); - this._RabbitMQInvoker.RegistReciveAction(rabbitMQConsumerModel, message => - { - var data= Common.Helper.JsonHelper.StrToObj(message); - try - { - _aliyunSMSInvoker.SendCode(data.code, data.phone); - - return true; - } - catch (Exception ex) - { - var logModel = new LogModel() - { - OriginalClassName = this.GetType().FullName, - OriginalMethodName = nameof(ExecuteAsync), - Remark = "Ϣд־" - }; - this._logger.LogError(ex, $"{nameof(SendWorker)}, Exception:{ex.Message}", JsonConvert.SerializeObject(logModel)); - return false; - } - }); - await Task.CompletedTask; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Worker.cs b/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Worker.cs deleted file mode 100644 index d6039afb..00000000 --- a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Worker.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace Yi.Framework.SMSProcessor -{ - public class Worker : BackgroundService - { - private readonly ILogger _logger; - private readonly IConfiguration _IConfiguration; - public Worker(ILogger logger, IConfiguration configuration) - { - this._logger = logger; - this._IConfiguration = configuration; - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - while (!stoppingToken.IsCancellationRequested) - { - _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); - _logger.LogInformation($"Worker appsetting ConsulClientOption:Ip={this._IConfiguration["ConsulClientOption:Ip"]}"); - await Task.Delay(100000, stoppingToken); - } - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Yi.Framework.SMSProcessor.csproj b/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Yi.Framework.SMSProcessor.csproj deleted file mode 100644 index 95a479a4..00000000 --- a/Yi.Framework.Net5/Yi.Framework.SMSProcessor/Yi.Framework.SMSProcessor.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - net5.0 - Exe - Yi.Framework.SMSProcessor.Program - - - - - - - - - Always - true - PreserveNewest - - - - - - - - - - - - - - Always - - - Always - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Service/BaseService.cs b/Yi.Framework.Net5/Yi.Framework.Service/BaseService.cs deleted file mode 100644 index c74a9760..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/BaseService.cs +++ /dev/null @@ -1,136 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.Enum; -using Yi.Framework.Interface; -using Yi.Framework.Model.ModelFactory; - -namespace Yi.Framework.Service -{ - public class BaseService : IBaseService where T : class, new() - { - public DbContext _Db; - public DbContext _DbRead; - public IDbContextFactory _DbFactory; - public BaseService(IDbContextFactory DbFactory) - { - _DbFactory = DbFactory; - _Db = DbFactory.ConnWriteOrRead(WriteAndReadEnum.Write); - _DbRead = DbFactory.ConnWriteOrRead(WriteAndReadEnum.Read); - } - - public async Task GetEntityById(int id) - { - return await _Db.Set().FindAsync(id); - } - - - public async Task> GetAllEntitiesAsync() - { - return await _Db.Set().ToListAsync(); - } - - public async Task> GetEntitiesAsync(Expression> whereLambda) - { - return await _Db.Set().Where(whereLambda).ToListAsync(); - } - - public async Task GetCountAsync(Expression> whereLambda) //统计数量 - { - return await _Db.Set().CountAsync(whereLambda); - } - - public IQueryable> GetGroup(Expression> whereLambda, Expression> groupByLambda) //分组 - { - return _Db.Set().Where(whereLambda).GroupBy(groupByLambda).AsQueryable(); - } - - public async Task, int>> GetPageEntities(int pageSize, int pageIndex, Expression> whereLambda, Expression> orderByLambda, bool isAsc) - { - int total = await GetCountAsync(whereLambda); - - IEnumerable pageData; - if (isAsc) - { - pageData = await _Db.Set().Where(whereLambda) - .OrderBy(orderByLambda) - .Skip(pageSize * (pageIndex - 1)) - .Take(pageSize).ToListAsync(); - } - else - { - pageData = await _Db.Set().Where(whereLambda) - .OrderByDescending(orderByLambda) - .Skip(pageSize * (pageIndex - 1)) - .Take(pageSize).ToListAsync(); - } - - return Tuple.Create, int>(pageData, total); - } - - public async Task AddAsync(T entity) - { - _Db.Set().Add(entity); - return await _Db.SaveChangesAsync() > 0; - } - - public async Task AddAsync(IEnumerable entities) - { - _Db.Set().AddRange(entities); - return await _Db.SaveChangesAsync() > 0; - } - - public async Task UpdateAsync(T entity) - { - _Db.Set().Update(entity); - return await _Db.SaveChangesAsync() > 0; - } - - public async Task UpdateListAsync(IEnumerable entities) - { - _Db.Set().UpdateRange(entities); - return await _Db.SaveChangesAsync() > 0; - } - - public async Task DeleteAsync(T entity) - { - _Db.Set().Remove(entity); - return await _Db.SaveChangesAsync() > 0; - } - - public async Task DeleteAsync(int id) - { - _Db.Set().Remove(await GetEntityById(id)); - return await _Db.SaveChangesAsync() > 0; - } - - public async Task DeleteAsync(IEnumerable ids) - { - foreach (var id in ids) - { - _Db.Set().RemoveRange(await GetEntityById(id)); - } - return await _Db.SaveChangesAsync() > 0; - } - public async Task DeleteAsync(Expression> where) - { - IEnumerable entities = await GetEntitiesAsync(where); - if (entities != null) - { - _Db.Set().RemoveRange(entities); - - return await _Db.SaveChangesAsync() > 0; - } - return false; - } - - public async Task GetEntity(Expression> whereLambda) - { - return await _Db.Set().Where(whereLambda).FirstOrDefaultAsync(); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Service/MenuService.cs b/Yi.Framework.Net5/Yi.Framework.Service/MenuService.cs deleted file mode 100644 index 41f71ca9..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/MenuService.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Service -{ - public partial class MenuService:BaseService, IMenuService - { - short Normal = (short)Common.Enum.DelFlagEnum.Normal; - public async Task AddChildrenMenu(int menu_id, menu _children) - { - var menu_data = await _DbRead.Set().Include(u => u.children).Where(u => u.id == menu_id).FirstOrDefaultAsync(); - _children.is_top = (short)Common.Enum.TopFlagEnum.Children; - menu_data.children.Add(_children); - await UpdateAsync(menu_data); - return menu_data; - } - - public async Task AddTopMenu(menu _menu) - { - _menu.is_top = (short)Common.Enum.TopFlagEnum.Children; - - return await AddAsync(_menu); - } - - public async Task GetMenuInMould() - { - var menu_data= await _DbRead.Set().Include(u=>u.mould) - .Include(u => u.children).ThenInclude(u => u.mould).OrderByDescending(u => u.sort) - .Include(u=>u.children).ThenInclude(u => u.children).ThenInclude(u => u.mould) - .Include(u => u.children).ThenInclude(u => u.children).ThenInclude(u => u.children).ThenInclude(u => u.mould) - .Include(u => u.children).ThenInclude(u => u.children).ThenInclude(u => u.children).ThenInclude(u => u.children).ThenInclude(u => u.mould) - .Where(u =>u.is_delete == Normal && u.is_show == (short)Common.Enum.ShowFlagEnum.Show && u.is_top == (short)Common.Enum.TopFlagEnum.Top) - .FirstOrDefaultAsync(); - return TreeMenuBuild.Sort(TreeMenuBuild.Normal(menu_data)); - } - - - public async Task> GetTopMenusByTopMenuIds(List menuIds) - { - return await _DbRead.Set().AsNoTracking().Where(u => menuIds.Contains(u.id)).OrderBy(u=>u.sort).ToListAsync(); - } - - public async Task SetMouldByMenu(int id1,int id2) - { - var menu_data = await _DbRead.Set().Include(u => u.mould).Where(u => u.id == id1).FirstOrDefaultAsync(); - var mould_data = await _DbRead.Set().Where(u => u.id == id1).FirstOrDefaultAsync(); - menu_data.mould = mould_data; - _Db.Update(menu_data); - return menu_data; - } - - - public async Task> GetTopMenuByUserId(int userId) - { - var user_data = await _DbRead.Set().Include(u => u.roles).ThenInclude(u => u.menus).Where(u=>u.id==userId).FirstOrDefaultAsync(); - List menuList = new(); - user_data.roles.ForEach(u => - { - var m = u.menus.Where(u => u.is_delete == Normal).ToList(); - menuList = menuList.Union(m).ToList(); - }); - return menuList; - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Service/MouldService.cs b/Yi.Framework.Net5/Yi.Framework.Service/MouldService.cs deleted file mode 100644 index 21409683..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/MouldService.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Service -{ - public partial class MouldService:BaseService, IMouldService - { - /// - /// 这个获取的是菜单,用的是菜单表,应该放到菜单service里面,像这种只用到id的,就传一个id就可以了 - /// - /// - /// - public async Task GetMenuByMould(mould _mould) - { - var menu_data = await _Db.Set().Include(u => u.mould).Where(u => u.mould == _mould && u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).FirstOrDefaultAsync(); - return menu_data; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Service/RoleService.cs b/Yi.Framework.Net5/Yi.Framework.Service/RoleService.cs deleted file mode 100644 index 1461c1af..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/RoleService.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Interface; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Service -{ - public partial class RoleService:BaseService, IRoleService - { - short Normal = (short)Common.Enum.DelFlagEnum.Normal; - - public async Task> GetRolesByUserId(int userId) - { - var user_data =await _Db.Set().Include(u => u.roles).Where(u => u.id==userId).FirstOrDefaultAsync(); - var roleList = user_data.roles.Where(u=>u.is_delete==Normal).ToList(); - roleList.ForEach(u => u.users = null); - return roleList; - } - - - public async Task SetMenusByRolesId(List menuIds,List roleIds) - { - var role_data = await _Db.Set().Include(u => u.menus).ThenInclude(u => u.children).Where(u =>roleIds.Contains(u.id) && u.is_delete == Normal).ToListAsync(); - var menuList = await _Db.Set().Where(u => menuIds.Contains(u.id)&&u.is_delete ==Normal).ToListAsync(); - foreach(var role in role_data) - { - role.menus =menuList; - } - return await UpdateListAsync(role_data); - } - - public async Task> GetMenusByRoleId(List< int> roleIds) - { - var role_data = await _Db.Set().Include(u => u.menus).Where(u => roleIds.Contains(u.id) && u.is_delete == Normal).ToListAsync(); - List menuList = new(); - role_data.ForEach(u => - { - var m = u.menus.Where(u => u.is_delete == Normal).ToList(); - menuList = menuList.Union(m).ToList(); - }); - return menuList; - } - public async Task> GetTopMenusByRoleId(int roleId) - { - var role_data = await _Db.Set().Include(u=>u.menus).Where(u => u.id == roleId).FirstOrDefaultAsync(); - var menuList = role_data.menus.Where(u => u.is_delete == Normal).ToList(); - - menuList.ForEach(u => u.roles = null); - - return menuList; - } - - public async Task> GetMenusByRole(int roleId) - { - var role_data = await _Db.Set().Include(u => u.menus).Where(u => u.id == roleId).FirstOrDefaultAsync(); - var menuList = role_data.menus.Where(u => u.is_delete == Normal).ToList(); - return menuList; - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Service/T4Service.cs b/Yi.Framework.Net5/Yi.Framework.Service/T4Service.cs deleted file mode 100644 index 1b59d0eb..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/T4Service.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; -using Yi.Framework.Interface; -using Microsoft.EntityFrameworkCore; -using Yi.Framework.Model.ModelFactory; - -namespace Yi.Framework.Service -{ - - public partial class MenuService:BaseService,IMenuService - { - public MenuService(IDbContextFactory DbFactory):base(DbFactory){ } - - public async Task DelListByUpdateAsync(List _ids) - { - var menuList = await GetEntitiesAsync(u=>_ids.Contains(u.id)); - menuList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted); - return await UpdateListAsync(menuList); - } - - public async Task> GetAllEntitiesTrueAsync() - { - return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal); - } - - } - - public partial class MouldService:BaseService,IMouldService - { - public MouldService(IDbContextFactory DbFactory):base(DbFactory){ } - - public async Task DelListByUpdateAsync(List _ids) - { - var mouldList = await GetEntitiesAsync(u=>_ids.Contains(u.id)); - mouldList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted); - return await UpdateListAsync(mouldList); - } - - public async Task> GetAllEntitiesTrueAsync() - { - return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal); - } - - } - - public partial class RoleService:BaseService,IRoleService - { - public RoleService(IDbContextFactory DbFactory):base(DbFactory){ } - - public async Task DelListByUpdateAsync(List _ids) - { - var roleList = await GetEntitiesAsync(u=>_ids.Contains(u.id)); - roleList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted); - return await UpdateListAsync(roleList); - } - - public async Task> GetAllEntitiesTrueAsync() - { - return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal); - } - - } - - public partial class UserService:BaseService,IUserService - { - public UserService(IDbContextFactory DbFactory):base(DbFactory){ } - - public async Task DelListByUpdateAsync(List _ids) - { - var userList = await GetEntitiesAsync(u=>_ids.Contains(u.id)); - userList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted); - return await UpdateListAsync(userList); - } - - public async Task> GetAllEntitiesTrueAsync() - { - return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal); - } - - } - - public partial class VisitService:BaseService,IVisitService - { - public VisitService(IDbContextFactory DbFactory):base(DbFactory){ } - - public async Task DelListByUpdateAsync(List _ids) - { - var visitList = await GetEntitiesAsync(u=>_ids.Contains(u.id)); - visitList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted); - return await UpdateListAsync(visitList); - } - - public async Task> GetAllEntitiesTrueAsync() - { - return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal); - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Service/T4Service.tt b/Yi.Framework.Net5/Yi.Framework.Service/T4Service.tt deleted file mode 100644 index ba340807..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/T4Service.tt +++ /dev/null @@ -1,58 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ assembly name="System.Core" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#@ import namespace="System.IO" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ output extension=".cs" #> -<# - string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 - string dirPath= Path.Combine(solutionsPath,@"Yi.Framework.Model\Models\"); - DirectoryInfo dir = new DirectoryInfo(dirPath); - FileInfo[] finfo = dir.GetFiles(); - string filenames = string.Empty; - List filenameList = new List(); - for (int i = 0; i < finfo.Length; i++) - { - filenames = finfo[i].Name ; - string[] fname=filenames.Split('.'); - filenameList.Add(fname[0]); - } - - -#> -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; -using Yi.Framework.Interface; -using Microsoft.EntityFrameworkCore; -using Yi.Framework.Model.ModelFactory; - -namespace Yi.Framework.Service -{ - <# foreach(string k in filenameList){ - string fn= k.Substring(0,1).ToUpper()+k.Substring(1); - #> - - public partial class <#= fn #>Service:BaseService<<#= k #>>,I<#= fn #>Service - { - public <#= fn #>Service(IDbContextFactory DbFactory):base(DbFactory){ } - - public async Task DelListByUpdateAsync(List _ids) - { - var <#= k #>List = await GetEntitiesAsync(u=>_ids.Contains(u.id)); - <#= k #>List.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted); - return await UpdateListAsync(<#= k #>List); - } - - public async Task>> GetAllEntitiesTrueAsync() - { - return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal); - } - - } -<# } #> -} diff --git a/Yi.Framework.Net5/Yi.Framework.Service/UserService.cs b/Yi.Framework.Net5/Yi.Framework.Service/UserService.cs deleted file mode 100644 index 6e9396cf..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/UserService.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core; -using Yi.Framework.Interface; -using Yi.Framework.Model; -using Yi.Framework.Model.ModelFactory; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Service -{ - public partial class UserService : BaseService, IUserService - { - short Normal = (short)Common.Enum.DelFlagEnum.Normal; - public async Task PhoneIsExsit(string smsAddress) - { - var userList = await GetEntity(u => u.phone == smsAddress); - if (userList == null) - { - return false; - } - return true; - } - - public async Task EmailIsExsit(string emailAddress) - { - var userList = await GetEntity(u => u.email == emailAddress); - if (userList == null) - { - return false; - } - return true; - } - /// - /// - /// - /// - /// - public async Task GetUserById(int userId) - { - return await _DbRead.Set().Include(u => u.roles).ThenInclude(u => u.menus).ThenInclude(u => u.children).ThenInclude(u => u.mould).Where(u=>u.id==userId).FirstOrDefaultAsync(); - - } - public async Task> GetAxiosByRouter(string router, int userId, List menuIds) - { - var user_data =await GetUserById(userId); - List menuList = new(); - foreach(var item in user_data.roles) - { - var m=item.menus.Where(u =>u?.router?.ToUpper() == router.ToUpper()).FirstOrDefault(); - if (m == null) { break; } - menuList = m.children?.Where(u => menuIds.Contains(u.id)&&u.is_delete==Normal).ToList(); - - } - return menuList; - } - - public async Task GetMenuByHttpUser(List allMenuIds) - { - var topMenu =await _DbRead.Set().Include(u => u.children).ThenInclude(u => u.children).ThenInclude(u => u.children).ThenInclude(u => u.children).ThenInclude(u => u.children).Where(u => u.is_top == (short)Common.Enum.ShowFlagEnum.Show).FirstOrDefaultAsync(); - //现在要开始关联菜单了 - return TreeMenuBuild.Sort(TreeMenuBuild.ShowFormat(topMenu, allMenuIds)); ; - } - public async Task GetUserInRolesByHttpUser(int userId) - { - var data = await GetUserById(userId); - data.roles?.ForEach(u=> { - u.users = null; - u.menus = null; - }); - return data; - } - - public async Task Login(user _user) - { - var user_data = await _DbRead.Set().Include(u => u.roles).Where(u => u.username == _user.username && u.password ==_user.password &&u.is_delete == Normal).FirstOrDefaultAsync(); - return user_data; - } - - public async Task Register(user _user) - { - var user_data = await GetEntity(u => u.username == _user.username); - if (user_data != null) - { - return false; - } - return await UpdateAsync(_user); - } - - public async Task SetRoleByUser(List roleIds, List userIds) - { - var user_data = await _DbRead.Set().Include(u => u.roles).Where(u => userIds.Contains(u.id)).ToListAsync(); - var roleList = await _DbRead.Set().Where(u => roleIds.Contains(u.id)).ToListAsync(); - user_data.ForEach(u => u.roles = roleList); - return await UpdateListAsync(user_data); - } - - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Service/Yi - Backup.Framework.Service.csproj b/Yi.Framework.Net5/Yi.Framework.Service/Yi - Backup.Framework.Service.csproj deleted file mode 100644 index c54fe835..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/Yi - Backup.Framework.Service.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Service/Yi.Framework.Service.csproj b/Yi.Framework.Net5/Yi.Framework.Service/Yi.Framework.Service.csproj deleted file mode 100644 index a12bfcff..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Service/Yi.Framework.Service.csproj +++ /dev/null @@ -1,44 +0,0 @@ - - - - net5.0 - - - - - - - - - True - True - T4Service.tt - - - - - - - - - - - - T4Service.cs - TextTemplatingFileGenerator - - - - - - - - - - True - True - T4Service.tt - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/InitPageWorker.cs b/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/InitPageWorker.cs deleted file mode 100644 index 86e132f7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/InitPageWorker.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Common.Models; -using Yi.Framework.Common.QueueModel; -using Yi.Framework.Core; -using Yi.Framework.Core.ConsulExtend; - -namespace Yi.Framework.StaticPageProcessor -{ - public class InitPageWorker : BackgroundService - { - private readonly IConfiguration _configuration; - private readonly ILogger _logger; - private readonly RabbitMQInvoker _RabbitMQInvoker; - private readonly AbstractConsulDispatcher _AbstractConsulDispatcher = null; - - public InitPageWorker(ILogger logger, RabbitMQInvoker rabbitMQInvoker, IConfiguration configuration, AbstractConsulDispatcher abstractConsulDispatcher) - { - this._logger = logger; - this._RabbitMQInvoker = rabbitMQInvoker; - this._configuration = configuration; - this._AbstractConsulDispatcher = abstractConsulDispatcher; - - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - RabbitMQConsumerModel rabbitMQConsumerModel = new RabbitMQConsumerModel() - { - ExchangeName = RabbitMQExchangeQueueName.SKUCQRS_Exchange, - QueueName = RabbitMQExchangeQueueName.SKUCQRS_Queue_StaticPage - }; - HttpClient _HttpClient = new HttpClient(); - this._RabbitMQInvoker.RegistReciveAction(rabbitMQConsumerModel, message => - { - SPUCQRSQueueModel skuCQRSQueueModel = JsonConvert.DeserializeObject(message); - - string detailUrl = this._AbstractConsulDispatcher.GetAddress(this._configuration["DetailPageUrl"]); - string totalUrl = null; - switch (skuCQRSQueueModel.CQRSType) - { - case (int)SPUCQRSQueueModelType.Insert: - totalUrl = $"{detailUrl}{skuCQRSQueueModel.SpuId}.html"; - break; - case (int)SPUCQRSQueueModelType.Update: - totalUrl = $"{detailUrl}{skuCQRSQueueModel.SpuId}.html"; - break; - case (int)SPUCQRSQueueModelType.Delete: - totalUrl = $"{detailUrl}{skuCQRSQueueModel.SpuId}.html?ActionHeader=Delete"; - break; - default: - break; - } - - try - { - var result = _HttpClient.GetAsync(totalUrl).Result; - if (result.StatusCode == HttpStatusCode.OK) - { - this._logger.LogInformation($"{nameof(WarmupPageWorker)}.Init succeed {totalUrl}"); - return true; - } - else - { - this._logger.LogWarning($"{nameof(WarmupPageWorker)}.Init succeed {totalUrl}"); - return false; - } - } - catch (Exception ex) - { - var logModel = new LogModel() - { - OriginalClassName = this.GetType().FullName, - OriginalMethodName = nameof(ExecuteAsync), - Remark = "ʱҵ־" - }; - this._logger.LogError(ex, $"{nameof(WarmupPageWorker)}.Init failed {totalUrl}, Exception:{ex.Message}", JsonConvert.SerializeObject(logModel)); - return false; - } - }); - await Task.CompletedTask; - //while (!stoppingToken.IsCancellationRequested) - //{ - // _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); - // await Task.Delay(1000, stoppingToken); - //} - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Log4net.config b/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Log4net.config deleted file mode 100644 index 958c7e78..00000000 --- a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Log4net.config +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Program.cs b/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Program.cs deleted file mode 100644 index c7cfbfd7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Program.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Com.Ctrip.Framework.Apollo; -using Com.Ctrip.Framework.Apollo.Core; -using Com.Ctrip.Framework.Apollo.Enums; -using Com.Ctrip.Framework.Apollo.Logging; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Core; -using Yi.Framework.Core.ConsulExtend; - -namespace Yi.Framework.StaticPageProcessor -{ - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureAppConfiguration((hostBuilderContext, configurationBuilder) => - { - configurationBuilder.AddCommandLine(args); - configurationBuilder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false); - configurationBuilder.AddJsonFile("configuration.json", optional: false, reloadOnChange: true); - #region - //Apollo配置 - #endregion - //configurationBuilder.AddApolloService("Yi"); - }) - .ConfigureLogging(loggingBuilder => - { - loggingBuilder.AddFilter("System", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddFilter("Microsoft", Microsoft.Extensions.Logging.LogLevel.Warning); - loggingBuilder.AddLog4Net(); - }) - .ConfigureServices((hostContext, services) => - { - - IConfiguration configuration = services.BuildServiceProvider().GetRequiredService(); - - services.AddHostedService(); - services.AddHostedService(); - - #region 服务注入 - //services.Configure(configuration.GetSection("MysqlConn")); - - services.AddTransient(); - services.Configure(configuration.GetSection("RedisConn")); - - services.AddSingleton(); - services.Configure(configuration.GetSection("RabbitMQOptions")); - #endregion - - #region Consul - services.Configure(configuration.GetSection("ConsulClientOption")); - services.AddTransient(); - #endregion - - services.AddHostedService(); - }); - } - } diff --git a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/WarmupPageWorker.cs b/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/WarmupPageWorker.cs deleted file mode 100644 index 23d9d4c5..00000000 --- a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/WarmupPageWorker.cs +++ /dev/null @@ -1,133 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Common.Models; -using Yi.Framework.Common.QueueModel; -using Yi.Framework.Core; -using Yi.Framework.Core.ConsulExtend; - -namespace Yi.Framework.StaticPageProcessor -{ - public class WarmupPageWorker : BackgroundService - { - private readonly IConfiguration _configuration; - private readonly ILogger _logger; - private readonly RabbitMQInvoker _RabbitMQInvoker; - private readonly AbstractConsulDispatcher _IConsulDispatcher = null; - - public WarmupPageWorker(ILogger logger, RabbitMQInvoker rabbitMQInvoker, IConfiguration configuration, AbstractConsulDispatcher consulDispatcher) - { - this._logger = logger; - this._RabbitMQInvoker = rabbitMQInvoker; - this._configuration = configuration; - this._IConsulDispatcher = consulDispatcher; - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - RabbitMQConsumerModel rabbitMQConsumerModel = new RabbitMQConsumerModel() - { - ExchangeName = RabbitMQExchangeQueueName.SKUWarmup_Exchange, - QueueName = RabbitMQExchangeQueueName.SKUWarmup_Queue_StaticPage - }; - HttpClient _HttpClient = new HttpClient(); - this._RabbitMQInvoker.RegistReciveAction(rabbitMQConsumerModel, message => - { - string realUrl= this._IConsulDispatcher.GetAddress(this._configuration["DetailPageUrl"]); - - SKUWarmupQueueModel skuWarmupQueueModel = JsonConvert.DeserializeObject(message); - #region ClearAll - { - string totalUrl = $"{realUrl}{0}.html?ActionHeader=ClearAll"; - try - { - var result = _HttpClient.GetAsync(totalUrl).Result; - if (result.StatusCode == HttpStatusCode.OK) - { - this._logger.LogInformation($"{nameof(WarmupPageWorker)}.ClearAll succeed {totalUrl}"); - //return true; - } - else - { - this._logger.LogWarning($"{nameof(WarmupPageWorker)}.ClearAll failed {totalUrl}"); - return false; - } - } - catch (Exception ex) - { - this._logger.LogError($"{nameof(WarmupPageWorker)}.ClearAll failed {totalUrl}, Exception:{ex.Message}"); - return false; - } - } - #endregion - - #region Ȼȫ Warmup - { - // -------¼µ - - int count = 100;//βѯ - int pageIndex = 1;//ҳҳߵ - while (count == 100) - { - - -// -------------------> ˴ɾ̬ҳƣͨʹidʶ,ͨserviceIJѯõid - List ids = new List{ 1,2,3,4,5,6,7,8,9}; -// -------------------> ˴ɾ̬ҳƣͨʹidʶ,ͨserviceIJѯõid - - - foreach (var id in ids) - { - string totalUrl = $"{realUrl}{id}.html"; - try - { - var result = _HttpClient.GetAsync(totalUrl).Result; - if (result.StatusCode == HttpStatusCode.OK) - { - this._logger.LogInformation($"{nameof(WarmupPageWorker)}.Warmup succeed {totalUrl}"); - //return true; - } - else - { - this._logger.LogWarning($"{nameof(WarmupPageWorker)}.Warmup failed {totalUrl}"); - return false; - } - } - catch (Exception ex) - { - var logModel = new LogModel() - { - OriginalClassName = this.GetType().FullName, - OriginalMethodName = nameof(ExecuteAsync), - Remark = "ʱҵ־" - }; - this._logger.LogError(ex, $"{nameof(WarmupPageWorker)}.Warmup failed {totalUrl}, Exception:{ex.Message}", JsonConvert.SerializeObject(logModel)); - return false; - } - } - pageIndex++; - count = ids.Count; - } - } - #endregion - return true; - }); - await Task.CompletedTask; - //while (!stoppingToken.IsCancellationRequested) - //{ - // _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); - // await Task.Delay(1000, stoppingToken); - //} - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Worker.cs b/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Worker.cs deleted file mode 100644 index f73f389e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Worker.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace Yi.Framework.StaticPageProcessor -{ - public class Worker : BackgroundService - { - private readonly ILogger _logger; - private readonly IConfiguration _IConfiguration; - public Worker(ILogger logger, IConfiguration configuration) - { - this._logger = logger; - this._IConfiguration = configuration; - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - while (!stoppingToken.IsCancellationRequested) - { - _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); - _logger.LogInformation($"Worker appsetting ConsulClientOption:Ip={this._IConfiguration["ConsulClientOption:Ip"]}"); - await Task.Delay(1000, stoppingToken); - } - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Yi.Framework.StaticPageProcessor.csproj b/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Yi.Framework.StaticPageProcessor.csproj deleted file mode 100644 index 8cb7cd48..00000000 --- a/Yi.Framework.Net5/Yi.Framework.StaticPageProcessor/Yi.Framework.StaticPageProcessor.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - net5.0 - Exe - - - - - - - - - PreserveNewest - true - PreserveNewest - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.Task/HttpJob.cs b/Yi.Framework.Net5/Yi.Framework.Task/HttpJob.cs deleted file mode 100644 index bb16da9e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Task/HttpJob.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.Extensions.Logging; -using Quartz; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; - -namespace Yi.Framework.Job -{ - public class HttpJob : IJob - { - private ILogger _logger; - public HttpJob(ILogger logger) - { - _logger = logger; - } - - public Task Execute(IJobExecutionContext context) - { - return Task.Run(() => - { - var jobData = context.JobDetail.JobDataMap; - string method= jobData[Common.Const.JobConst.method].ToString(); - string url = jobData[Common.Const.JobConst.url].ToString(); - string data="异常!"; - switch (method) - { - case "post": - data = Common.Helper.HttpHelper.HttpPost(url); - break; - case "get": - data = Common.Helper.HttpHelper.HttpGet(url); - break; - } - - - _logger.LogWarning("定时任务开始调度:" + nameof(HttpJob) + ":" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + $":访问地址为:{url},结果为:{data}"); - Console.WriteLine($"结果:{data}"); - }); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.Task/VisitJob.cs b/Yi.Framework.Net5/Yi.Framework.Task/VisitJob.cs deleted file mode 100644 index 2c95b7cf..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Task/VisitJob.cs +++ /dev/null @@ -1,43 +0,0 @@ - -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Quartz; -using System; -using System.IO; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; -using Yi.Framework.Model.ModelFactory; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.Job -{ - public class VisitJob : IJob - { - private ILogger _logger; - private DbContext _DBWrite; - public VisitJob(ILogger logger, IDbContextFactory DbFactory) - { - _logger = logger; - _DBWrite = DbFactory.ConnWriteOrRead(Common.Enum.WriteAndReadEnum.Write); - } - - /// - /// 应该将拜访清零,并且写入数据库中的拜访表中 - /// - /// - /// - public Task Execute(IJobExecutionContext context) - { - return Task.Run(() => - { - _DBWrite.Set().Add(new visit() { num = JobModel.visitNum, time = DateTime.Now }); - _DBWrite.SaveChanges(); - _logger.LogWarning("定时任务开始调度:" + nameof(VisitJob) + ":" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + $":访问总数为:{JobModel.visitNum}"); - JobModel.visitNum = 0; - } - ); - } - } -} - diff --git a/Yi.Framework.Net5/Yi.Framework.Task/Yi.Framework.Job.csproj b/Yi.Framework.Net5/Yi.Framework.Task/Yi.Framework.Job.csproj deleted file mode 100644 index 7b71cf06..00000000 --- a/Yi.Framework.Net5/Yi.Framework.Task/Yi.Framework.Job.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/Appsettings.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/Appsettings.cs deleted file mode 100644 index ae8963cb..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/Appsettings.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Configuration.Json; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Yi.Framework.WebCore -{ - /// - /// appsettings.json操作类 - /// - public class Appsettings - { - static IConfiguration Configuration { get; set; } - static string contentPath { get; set; } - - public Appsettings(string contentPath) - { - string Path = "appsettings.json"; - - //如果你把配置文件 是 根据环境变量来分开了,可以这样写 - //Path = $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json"; - - Configuration = new ConfigurationBuilder() - .SetBasePath(contentPath) - .Add(new JsonConfigurationSource { Path = Path, Optional = false, ReloadOnChange = true })//这样的话,可以直接读目录里的json文件,而不是 bin 文件夹下的,所以不用修改复制属性 - .Build(); - } - - public Appsettings(IConfiguration configuration) - { - Configuration = configuration; - } - - /// - /// 封装要操作的字符 - /// - /// 节点配置 - /// - public static string app(params string[] sections) - { - try - { - - if (sections.Any()) - { - return Configuration[string.Join(":", sections)]; - } - } - catch (Exception) { } - - return ""; - } - - public static bool appBool(params string[] sections) - { - - return Bool(app(sections)); - - } - - public static bool Bool(object thisValue) - { - bool reval = false; - if (thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out reval)) - { - return reval; - } - return reval; - } - - /// - /// 递归获取配置信息数组 - /// - /// - /// - /// - public static T app(params string[] sections) - { - T app = Activator.CreateInstance(); - // 引用 Microsoft.Extensions.Configuration.Binder 包 - Configuration.Bind(string.Join(":", sections), app); - return app; - } - - - public static IConfiguration appConfiguration(params string[] sections) - { - return Configuration.GetSection(string.Join(":", sections)); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs deleted file mode 100644 index 313fce11..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Com.Ctrip.Framework.Apollo; -using Microsoft.Extensions.Configuration; -using System; -using System.Collections.Generic; -using System.Linq; -using Com.Ctrip.Framework.Apollo.Enums; -using Com.Ctrip.Framework.Apollo.Logging; -using Microsoft.Extensions.Primitives; -using System.Reflection; - -namespace Yi.Framework.WebCore.BuilderExtend -{ - public static class ApolloExtension - { - /// - /// 接入Apollo - /// - /// - /// apollo配置文件路径 如果写入appsettings.json中 则jsonPath传null即可 - public static void AddApolloService(this IConfigurationBuilder builder, params string[] NameSpace) - { - //阿波罗的日志级别调整 - LogManager.UseConsoleLogging(LogLevel.Warn); - var root = builder.Build(); - - if (Appsettings.Bool(root["Apollo_Enabled"])) - { - var apolloBuilder = builder.AddApollo(root.GetSection("apollo")).AddDefault(); - - foreach (var item in NameSpace) - { - apolloBuilder.AddNamespace(item, ConfigFileFormat.Json); - } - //监听apollo配置 - Monitor(builder.Build()); - } - - } - #region private - /// - /// 监听配置 - /// - private static void Monitor(IConfigurationRoot root) - { - //TODO 需要根据改变执行特定的操作 如 mq redis 等其他跟配置相关的中间件 - //TODO 初步思路:将需要执行特定的操作key和value放入内存字典中,在赋值操作时通过标准事件来执行特定的操作。 - - //要重新Build 此时才将Apollo provider加入到ConfigurationBuilder中 - ChangeToken.OnChange(() => root.GetReloadToken(), () => - { - foreach (var apolloProvider in root.Providers.Where(p => p is ApolloConfigurationProvider)) - { - var property = apolloProvider.GetType().BaseType.GetProperty("Data", BindingFlags.Instance | BindingFlags.NonPublic); - var data = property.GetValue(apolloProvider) as IDictionary; - foreach (var item in data) - { - Console.WriteLine($"key {item.Key} value {item.Value}"); - } - } - }); - } - #endregion - } -} \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/JsonExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/JsonExtension.cs deleted file mode 100644 index ccf52354..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/JsonExtension.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.BuilderExtend -{ - public static class JsonExtension - { - public static void AddJsonFileService(this IMvcBuilder builder) - { - builder.AddNewtonsoftJson(options => - { - options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; - options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm"; - }); - - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/JsonFileExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/JsonFileExtension.cs deleted file mode 100644 index 0f00c052..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/BuilderExtend/JsonFileExtension.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.Extensions.Configuration; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.BuilderExtend -{ - public static class JsonFileExtension - { - public static void AddJsonFileService(this IConfigurationBuilder builder, params string[] JsonFile) - { - if (JsonFile==null) - { - string[] myJsonFile = new string[] { "appsettings.json", "configuration.json" }; - foreach (var item in myJsonFile) - { - builder.AddJsonFile(item, optional: true, reloadOnChange: false); - } - } - else - { - foreach (var item in JsonFile) - { - builder.AddJsonFile(item, optional: true, reloadOnChange: false); - } - } - - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/CommonExtend.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/CommonExtend.cs deleted file mode 100644 index 35bf7cda..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/CommonExtend.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Yi.Framework.Model; -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.WebCore -{ - public static class CommonExtend - { - /// - /// 判断是否为异步请求 - /// - /// - /// - public static bool IsAjaxRequest(this HttpRequest request) - { - string header = request.Headers["X-Requested-With"]; - return "XMLHttpRequest".Equals(header); - } - - /// - /// 基于HttpContext,当前鉴权方式解析,获取用户信息 - /// - /// - /// - public static user GetCurrentUserInfo(this HttpContext httpContext, out List menuIds) - { - IEnumerable claimlist = httpContext.AuthenticateAsync().Result.Principal.Claims; - - Int32.TryParse(claimlist.FirstOrDefault(u => u.Type == ClaimTypes.Sid).Value, out int resId); - - - menuIds = claimlist.Where(u => u.Type == "menuIds").ToList().Select(u => Convert.ToInt32(u.Value)).ToList(); - - - return new user() - { - id = resId, - username = claimlist.FirstOrDefault(u => u.Type == ClaimTypes.Name).Value ?? "匿名" - }; - } - public static user GetCurrentUserInfo(this HttpContext httpContext) - { - IEnumerable claimlist = httpContext.AuthenticateAsync().Result.Principal.Claims; - - Int32.TryParse(claimlist.FirstOrDefault(u => u.Type == ClaimTypes.Sid).Value, out int resId); - - return new user() - { - id = resId, - username = claimlist.FirstOrDefault(u => u.Type == ClaimTypes.Name).Value ?? "匿名" - }; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CORSFilter.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CORSFilter.cs deleted file mode 100644 index d697230a..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CORSFilter.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.AspNetCore.Mvc.Filters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.FilterExtend -{ - /// - /// 跨域过滤器 - /// - public class CORSFilter : ActionFilterAttribute - { - public override void OnActionExecuting(ActionExecutingContext context) - { - context.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*"); - context.HttpContext.Response.Headers.Add("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE,PUT"); - context.HttpContext.Response.Headers.Add("Access-Control-Allow-Credentials", "true"); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomAction2CommitFilterAttribute.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomAction2CommitFilterAttribute.cs deleted file mode 100644 index 49fe510c..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomAction2CommitFilterAttribute.cs +++ /dev/null @@ -1,83 +0,0 @@ -using Yi.Framework.Common.Models; -using Yi.Framework.Core; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.ViewFeatures; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Helper; - -namespace Yi.Framework.WebCore.FilterExtend -{ - /// - /// 重复提交过滤器 - /// - public class CustomAction2CommitFilterAttribute : ActionFilterAttribute - { - /// - /// 防重复提交周期 单位秒 - /// - //public int TimeOut = 1; - - //#region Identity - //private readonly ILogger _logger; - //private readonly CacheClientDB _cacheClientDB; - //private static string KeyPrefix = "2CommitFilter"; - - // public CustomAction2CommitFilterAttribute(ILogger logger, CacheClientDB cacheClientDB) - // { - // this._logger = logger; - // this._cacheClientDB = cacheClientDB; - // } - // #endregion - - - //if (this.IsAjaxRequest(context.HttpContext.Request)) - // //{ } - // context.Result = new RedirectResult("~/Fourth/Login"); - //} - //else - //{ - // this._logger.LogDebug($"{currentUser.Name} 访问系统"); - //} - //} public override void OnActionExecuting(ActionExecutingContext context) - //{ - // string url = context.HttpContext.Request.Path.Value; - // string argument = JsonConvert.SerializeObject(context.ActionArguments); - // string ip = context.HttpContext.Connection.RemoteIpAddress.ToString(); - // string agent = context.HttpContext.Request.Headers["User-Agent"]; - // string sInfo = $"{url}-{argument}-{ip}-{agent}"; - // string summary = MD5Helper.MD5EncodingOnly(sInfo); - - // string totalKey = $"{KeyPrefix}-{summary}"; - - // string result = this._cacheClientDB.Get(totalKey); - // if (string.IsNullOrEmpty(result)) - // { - // this._cacheClientDB.Add(totalKey, "1", TimeSpan.FromSeconds(3));//3秒有效期 - // this._logger.LogInformation($"CustomAction2CommitFilterAttribute:{sInfo}"); - // } - // else - // { - // //已存在 - // this._logger.LogWarning($"CustomAction2CommitFilterAttribute重复请求:{sInfo}"); - // context.Result = new JsonResult(Result.Error("请勿重复提交")); - // } - - // //CurrentUser currentUser = context.HttpContext.GetCurrentUserBySession(); - // //if (currentUser == null) - // //{ - // // // - //private bool IsAjaxRequest(HttpRequest request) - //{ - // string header = request.Headers["X-Requested-With"]; - // return "XMLHttpRequest".Equals(header); - //} - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomActionCacheFilterAttribute.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomActionCacheFilterAttribute.cs deleted file mode 100644 index cf976d29..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomActionCacheFilterAttribute.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc.Filters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.FilterExtend -{ - /// - /// 缓存过滤器 - /// - public class CustomActionCacheFilterAttribute : ActionFilterAttribute - { - public override void OnActionExecuted(ActionExecutedContext context) - { - context.HttpContext.Response.Headers.Add("Cache-Control", "public,max-age=6000"); - Console.WriteLine($"This {nameof(CustomActionCacheFilterAttribute)} OnActionExecuted{this.Order}"); - } - public override void OnActionExecuting(ActionExecutingContext context) - { - Console.WriteLine($"This {nameof(CustomActionCacheFilterAttribute)} OnActionExecuting{this.Order}"); - } - public override void OnResultExecuting(ResultExecutingContext context) - { - Console.WriteLine($"This {nameof(CustomActionCacheFilterAttribute)} OnResultExecuting{this.Order}"); - } - public override void OnResultExecuted(ResultExecutedContext context) - { - Console.WriteLine($"This {nameof(CustomActionCacheFilterAttribute)} OnResultExecuted{this.Order}"); - } - } - -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomActionCheckFilterAttribute.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomActionCheckFilterAttribute.cs deleted file mode 100644 index a328775d..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomActionCheckFilterAttribute.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.AspNetCore.Mvc.ViewFeatures; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.FilterExtend -{ - /// - /// 控制器检查过滤器 - /// - public class CustomActionCheckFilterAttribute : ActionFilterAttribute - { - #region Identity - private readonly ILogger _logger; - public CustomActionCheckFilterAttribute(ILogger logger) - { - this._logger = logger; - } - #endregion - - public override void OnActionExecuting(ActionExecutingContext context) - { - //CurrentUser currentUser = context.HttpContext.GetCurrentUserBySession(); - //if (currentUser == null) - //{ - // //if (this.IsAjaxRequest(context.HttpContext.Request)) - // //{ } - // context.Result = new RedirectResult("~/Fourth/Login"); - //} - //else - //{ - // this._logger.LogDebug($"{currentUser.Name} 访问系统"); - //} - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs deleted file mode 100644 index 0af7e9f8..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using Yi.Framework.Common.Models; - -namespace Yi.Framework.WebCore.FilterExtend -{ - /// - /// 异常抓取过滤器 - /// - public class CustomExceptionFilterAttribute : IExceptionFilter - { - private ILogger _logger = null; - public CustomExceptionFilterAttribute(ILogger logger) - { - this._logger = logger; - } - - public void OnException(ExceptionContext context) - { - if (context.ExceptionHandled == false) - { - context.Result = new JsonResult( - Result.Error("操作失败").SetData(context.Exception.Message)); - string url = context.HttpContext.Request.Path.Value; - string actionName = context.ActionDescriptor.DisplayName; - - var logModel = new LogModel() - { - OriginalClassName = "", - OriginalMethodName = actionName, - Remark = $"来源于{nameof(CustomExceptionFilterAttribute)}.{nameof(OnException)}" - }; - this._logger.LogError(context.Exception, $"{url}----->actionName={actionName} Message={context.Exception.Message}", JsonConvert.SerializeObject(logModel)); - } - context.ExceptionHandled = true; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs deleted file mode 100644 index 77a08bcf..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.AspNetCore.Mvc.Filters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.FilterExtend -{ - /// - /// 依赖注入工厂过滤器 - /// - public class CustomIOCFilterFactoryAttribute : Attribute, IFilterFactory - { - private readonly Type _FilterType = null; - - public CustomIOCFilterFactoryAttribute(Type type) - { - this._FilterType = type; - } - public bool IsReusable => true; - - public IFilterMetadata CreateInstance(IServiceProvider serviceProvider) - { - //return (IFilterMetadata)serviceProvider.GetService(typeof(CustomExceptionFilterAttribute)); - - return (IFilterMetadata)serviceProvider.GetService(this._FilterType); - } - } - - -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomResourceFilterAttribute.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomResourceFilterAttribute.cs deleted file mode 100644 index c8640ef7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/CustomResourceFilterAttribute.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.FilterExtend -{ - /// - /// 资源过滤器 - /// - public class CustomResourceFilterAttribute : Attribute, IResourceFilter, IFilterMetadata - { - private static Dictionary CustomCache = new Dictionary(); - /// - /// 发生在其他动作之前 - /// - /// - public void OnResourceExecuting(ResourceExecutingContext context) - { - Console.WriteLine($"This is {nameof(CustomResourceFilterAttribute) }OnResourceExecuting"); - //if 有缓存,直接返回缓存 - string key = context.HttpContext.Request.Path; - if (CustomCache.ContainsKey(key)) - { - context.Result = CustomCache[key];//断路器--到Result生成了,但是Result还需要转换成Html - } - } - /// - /// 发生在其他动作之后 - /// - /// - public void OnResourceExecuted(ResourceExecutedContext context) - { - Console.WriteLine($"This is {nameof(CustomResourceFilterAttribute) }OnResourceExecuted"); - //这个应该缓存起来 - string key = context.HttpContext.Request.Path; - if (!CustomCache.ContainsKey(key)) - { - CustomCache.Add(key, context.Result); - } - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/LogActionFilterAttribute.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/LogActionFilterAttribute.cs deleted file mode 100644 index 50cbca85..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/FilterExtend/LogActionFilterAttribute.cs +++ /dev/null @@ -1,83 +0,0 @@ -using Yi.Framework.Common.Models; -using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.FilterExtend -{ - /// - /// 日志处理过滤器 - /// - public class LogActionFilterAttribute : ActionFilterAttribute - { - private ILogger _logger = null; - public LogActionFilterAttribute(ILogger logger) - { - this._logger = logger; - } - - public override void OnActionExecuting(ActionExecutingContext context) - { - string url = context.HttpContext.Request.Path.Value; - string argument = JsonConvert.SerializeObject(context.ActionArguments); - - string controllerName = context.Controller.GetType().FullName; - string actionName = context.ActionDescriptor.DisplayName; - - LogModel logModel = new LogModel() - { - OriginalClassName = controllerName, - OriginalMethodName = actionName, - Remark = $"来源于{nameof(LogActionFilterAttribute)}.{nameof(OnActionExecuting)}" - }; - - //this._logger.LogInformation($"url={url}---argument={argument}",new object[] { JsonConvert.SerializeObject(logModel) } ); - this._logger.LogInformation($"url={url}---argument={argument}"); - } - } - - public class CustomActionFilterAttribute : ActionFilterAttribute - { - public override void OnActionExecuted(ActionExecutedContext context) - { - Console.WriteLine($"This {nameof(LogActionFilterAttribute)} OnActionExecuted{this.Order}"); - } - public override void OnActionExecuting(ActionExecutingContext context) - { - Console.WriteLine($"This {nameof(LogActionFilterAttribute)} OnActionExecuting{this.Order}"); - } - public override void OnResultExecuting(ResultExecutingContext context) - { - Console.WriteLine($"This {nameof(LogActionFilterAttribute)} OnResultExecuting{this.Order}"); - } - public override void OnResultExecuted(ResultExecutedContext context) - { - Console.WriteLine($"This {nameof(LogActionFilterAttribute)} OnResultExecuted{this.Order}"); - } - } - - public class CustomControllerFilterAttribute : ActionFilterAttribute - { - public override void OnActionExecuted(ActionExecutedContext context) - { - Console.WriteLine($"This {nameof(CustomControllerFilterAttribute)} OnActionExecuted {this.Order}"); - } - public override void OnActionExecuting(ActionExecutingContext context) - { - Console.WriteLine($"This {nameof(CustomControllerFilterAttribute)} OnActionExecuting{this.Order}"); - } - public override void OnResultExecuting(ResultExecutingContext context) - { - Console.WriteLine($"This {nameof(CustomControllerFilterAttribute)} OnResultExecuting{this.Order}"); - } - public override void OnResultExecuted(ResultExecutedContext context) - { - Console.WriteLine($"This {nameof(CustomControllerFilterAttribute)} OnResultExecuted{this.Order}"); - } - } - -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/Init/DataSeed.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/Init/DataSeed.cs deleted file mode 100644 index 0129b67e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/Init/DataSeed.cs +++ /dev/null @@ -1,258 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.ModelFactory; -using Yi.Framework.Model.Models; - -namespace Yi.Framework.WebCore.Init -{ - public class DataSeed - { - public async static Task SeedAsync(IDbContextFactory _DbFactory) - { - var _Db = _DbFactory.ConnWriteOrRead(Common.Enum.WriteAndReadEnum.Write); - if (!_Db.Set().Any()) - { - await _Db.Set().AddAsync(new user - { - username = "admin", - password = "123", - roles = new List() - { - new role(){ role_name="普通用户"}, - - new role() - { - role_name="管理员", - menus = new List() - { - new menu() - { - menu_name="根",is_show=1,is_top=1, children=new List(){ - new menu() - { - menu_name="首页",is_show=1,router="/" - }, - - new menu() - { - menu_name="用户角色管理",is_show=1, children=new List() - { - new menu() - { - menu_name="用户管理",router="/AdmUser/", is_show=1,children=new List() - { - new menu() - { - menu_name="get",is_show=0, - mould=new mould() - { - mould_name="get",url="/user/getuser" - } - }, - new menu() - { - menu_name="update",is_show=0, - mould=new mould() - { - mould_name="update",url="/user/updateuser" - } - }, - new menu() - { - menu_name="del",is_show=0, - mould=new mould() - { - mould_name="del",url="/user/dellistUser" - } - }, - new menu() - { - menu_name="add",is_show=0, - mould=new mould() - { - mould_name="add",url="/user/adduser" - } - } - } - }, - new menu() - { - menu_name="角色管理",router="/admrole/", is_show=1,children=new List() - { - new menu() - { - menu_name="get",is_show=0, - mould=new mould() - { - mould_name="get",url="/role/getrole" - } - }, - new menu() - { - menu_name="update",is_show=0, - mould=new mould() - { - mould_name="update",url="/role/updaterole" - } - }, - new menu() - { - menu_name="del",is_show=0, - mould=new mould() - { - mould_name="del",url="/role/dellistrole" - } - }, - new menu() - { - menu_name="add",is_show=0, - mould=new mould() - { - mould_name="add",url="/role/addrole" - } - } - } - } - } - - }, - new menu() - { - menu_name="角色接口管理",is_show=1, children=new List() - { - new menu() - { - menu_name="菜单管理",router="/AdmMenu/", is_show=1,children=new List() - { - new menu() - { - menu_name="get",is_show=0, - mould=new mould() - { - mould_name="get",url="/Menu/getMenu" - } - }, - new menu() - { - menu_name="update",is_show=0, - mould=new mould() - { - mould_name="update",url="/Menu/updateMenu" - } - }, - new menu() - { - menu_name="del",is_show=0, - mould=new mould() - { - mould_name="del",url="/Menu/dellistMenu" - } - }, - new menu() - { - menu_name="add",is_show=0, - mould=new mould() - { - mould_name="add",url="/Menu/addMenu" - } - } - } - }, - new menu() - { - menu_name="接口管理",router="/admMould/", is_show=1,children=new List() - { - new menu() - { - menu_name="get",is_show=0, - mould=new mould() - { - mould_name="get",url="/Mould/getMould" - } - }, - new menu() - { - menu_name="update",is_show=0, - mould=new mould() - { - mould_name="update",url="/Mould/updateMould" - } - }, - new menu() - { - menu_name="del",is_show=0, - mould=new mould() - { - mould_name="del",url="/Mould/dellistMould" - } - }, - new menu() - { - menu_name="add",is_show=0, - mould=new mould() - { - mould_name="add",url="/Mould/addMould" - } - } - } - }, - new menu() - { - menu_name="角色菜单分配管理",router="/admRoleMenu/", is_show=1, children=null - } - } - - }, - new menu() - { - menu_name="路由管理",is_show=1,children=new List() - { - new menu() - { - menu_name="用户信息",router="/userinfo/", is_show=1,children=null - - } - } - - } - - - - - - - - - - - - - - - - - - - - - - - - } - } - - } - } - } - }); - } - await _Db.SaveChangesAsync(); - - Console.WriteLine(nameof(DbContext) + ":数据库初始成功!"); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/Init/RedisInit.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/Init/RedisInit.cs deleted file mode 100644 index 7856785c..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/Init/RedisInit.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.Const; -using Yi.Framework.Core; -using Yi.Framework.DTOModel; - -namespace Yi.Framework.WebCore.Init -{ - public class RedisInit - { - public static void Seed(CacheClientDB _cacheClientDB) - { - var setDto = Common.Helper.JsonHelper.ObjToStr(new SettingDto() - { - ImageList =new List { "默认图片", "默认图片" }, - InitRole = "普通用户", - Title = "YiFramework", - InitIcon = "默认头像" - }); - if (_cacheClientDB.Get(RedisConst.key)==null) - { - _cacheClientDB.Add(RedisConst.key,setDto) ; - } - - Console.WriteLine(nameof(RedisInit) + ":Redis初始成功!"); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/CAPExtend.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/CAPExtend.cs deleted file mode 100644 index b7014130..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/CAPExtend.cs +++ /dev/null @@ -1,59 +0,0 @@ -using DotNetCore.CAP.Dashboard.NodeDiscovery; -using DotNetCore.CAP.Messages; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - public static class CAPExtend - { - public static IServiceCollection AddCAPService(this IServiceCollection services) - { - if (Appsettings.appBool("CAP_Enabled")) - { - services.AddCap(x => - { - x.UseMySql(Appsettings.app("DbConn", "WriteUrl")); - - x.UseRabbitMQ(optios => { - optios.HostName = Appsettings.app("RabbitConn", "HostName"); - optios.Port =Convert.ToInt32(Appsettings.app("RabbitConn", "Port")); - optios.UserName = Appsettings.app("RabbitConn", "UserName"); - optios.Password = Appsettings.app("RabbitConn", "Password"); - - }); - x.FailedRetryCount = 30; - x.FailedRetryInterval = 60;//second - x.FailedThresholdCallback = failed => - { - var logger = failed.ServiceProvider.GetService>(); - logger.LogError($@"MessageType {failed.MessageType} 失败了, 重试了 {x.FailedRetryCount} 次, - 消息名称: {failed.Message.GetName()}");//do anything - }; - if (Appsettings.appBool("CAPDashboard_Enabled")) - { - x.UseDashboard(); - var discoveryOptions = Appsettings.app(); - x.UseDiscovery(d => - { - d.DiscoveryServerHostName = discoveryOptions.DiscoveryServerHostName; - d.DiscoveryServerPort = discoveryOptions.DiscoveryServerPort; - d.CurrentNodeHostName = discoveryOptions.CurrentNodeHostName; - d.CurrentNodePort = discoveryOptions.CurrentNodePort; - d.NodeId = discoveryOptions.NodeId; - d.NodeName = discoveryOptions.NodeName; - d.MatchPath = discoveryOptions.MatchPath; - }); - } - }); - - } - return services; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ConsulRegiterExtend.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ConsulRegiterExtend.cs deleted file mode 100644 index 7c8ab310..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ConsulRegiterExtend.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Consul; -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// HTTP模式 - /// - public static class ConsulRegiterExtend - { - /// - /// 基于提供信息完成注册 - /// - /// - /// - /// - public static void UseConsulService(this IApplicationBuilder app) - { - - if (Appsettings.appBool("Consul_Enabled")) - { - var consulRegisterOption = Appsettings.app("ConsulRegisterOption"); - - var consulClientOption = Appsettings.app("ConsulClientOption"); - using (ConsulClient client = new ConsulClient(c => - { - c.Address = new Uri($"http://{consulClientOption.IP}:{consulClientOption.Port}/"); - c.Datacenter = consulClientOption.Datacenter; - })) - { - client.Agent.ServiceRegister(new AgentServiceRegistration() - { - ID = $"{consulRegisterOption.IP}-{consulRegisterOption.Port}-{Guid.NewGuid()}",//唯一Id - Name = consulRegisterOption.GroupName,//组名称-Group - Address = consulRegisterOption.IP, - Port = consulRegisterOption.Port, - Tags = new string[] { consulRegisterOption.Tag }, - Check = new AgentServiceCheck() - { - Interval = TimeSpan.FromSeconds(consulRegisterOption.Interval), - HTTP = $"http://{consulRegisterOption.IP}:{consulRegisterOption.Port}{consulRegisterOption.HealthCheckUrl}", - Timeout = TimeSpan.FromSeconds(consulRegisterOption.Timeout), - DeregisterCriticalServiceAfter = TimeSpan.FromSeconds(consulRegisterOption.DeregisterCriticalServiceAfter) - } - }).Wait(); - Console.WriteLine($"{JsonConvert.SerializeObject(consulRegisterOption)} 完成注册"); - } - } - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/CorsExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/CorsExtension.cs deleted file mode 100644 index cdfd12fe..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/CorsExtension.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.IO; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// 通用跨域扩展 - /// - public static class CorsExtension - { - public static IServiceCollection AddCorsService(this IServiceCollection services) - { - - if (Appsettings.appBool("Cors_Enabled")) - { - services.AddCors(options => options.AddPolicy("CorsPolicy",//解决跨域问题 - builder => - { - builder.AllowAnyMethod() - .SetIsOriginAllowed(_ => true) - .AllowAnyHeader() - .AllowCredentials(); - })); - } - return services; - } - - public static void UseCorsService(this IApplicationBuilder app) - { - if (Appsettings.appBool("Cors_Enabled")) - { - app.UseCors("CorsPolicy"); - } - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/DbExtend.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/DbExtend.cs deleted file mode 100644 index afc20ff6..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/DbExtend.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Model; -using Yi.Framework.Model.ModelFactory; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - public static class DbExtend - { - public static IServiceCollection AddDbService(this IServiceCollection services) - { - DbContextFactory.MutiDB_Enabled = Appsettings.appBool("MutiDB_Enabled"); - DataContext.DbSelect = Appsettings.app("DbSelect"); - DataContext._connStr = Appsettings.app("DbConn", "WriteUrl"); - services.Configure(Appsettings.appConfiguration("DbConn")); - return services; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/DbSeedInitExtend.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/DbSeedInitExtend.cs deleted file mode 100644 index d43e2913..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/DbSeedInitExtend.cs +++ /dev/null @@ -1,36 +0,0 @@ -using log4net; -using Microsoft.AspNetCore.Builder; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Model.ModelFactory; -using Yi.Framework.WebCore.Init; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - public static class DbSeedInitExtend - { - private static readonly ILog log = LogManager.GetLogger(typeof(DbSeedInitExtend)); - public static void UseDbSeedInitService(this IApplicationBuilder app, IDbContextFactory _DbFactory) - { - - if (Appsettings.appBool("DbSeed_Enabled")) - { - if (app == null) throw new ArgumentNullException(nameof(app)); - - try - { - DataSeed.SeedAsync(_DbFactory).Wait(); - } - catch (Exception e) - { - log.Error($"Error occured seeding the Database.\n{e.Message}"); - throw; - } - } - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ElasticSeachExtend.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ElasticSeachExtend.cs deleted file mode 100644 index cfdaff61..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ElasticSeachExtend.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; -using System; -using System.IO; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Core; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// Redis扩展 - /// - public static class ElasticSeachExtend - { - public static IServiceCollection AddElasticSeachService(this IServiceCollection services) - { - if (Appsettings.appBool("ElasticSeach_Enabled")) - { - services.Configure(Appsettings.appConfiguration("ElasticSeachConn")); - services.AddTransient(); - } - return services; - - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ErrorHandExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ErrorHandExtension.cs deleted file mode 100644 index eed13c4c..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/ErrorHandExtension.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Common.Models; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// 异常抓取反馈扩展 - /// - public class ErrorHandExtension - { - private readonly RequestDelegate next; - - public ErrorHandExtension(RequestDelegate next) - { - this.next = next; - } - - public async Task Invoke(HttpContext context) - { - try - { - await next(context); - } - catch (Exception ex) - { - var statusCode = context.Response.StatusCode; - if (ex is ArgumentException) - { - statusCode = 200; - } - await HandleExceptionAsync(context, statusCode, ex.Message); - } - finally - { - var statusCode = context.Response.StatusCode; - var msg = ""; - - switch (statusCode) - { - case 401: msg = "未授权";break; - case 403: msg = "未授权"; break; - case 404: msg = "未找到服务"; break; - case 502: msg = "请求错误"; break; - } - if (!string.IsNullOrWhiteSpace(msg)) - { - await HandleExceptionAsync(context, statusCode, msg); - } - } - } - //异常错误信息捕获,将错误信息用Json方式返回 - private static Task HandleExceptionAsync(HttpContext context, int statusCode, string msg) - { - Result resp; - if (statusCode == 401) - { - resp = Result.UnAuthorize(msg); - } - else - { - resp = Result.Error(msg); - } - var result = JsonConvert.SerializeObject(resp); - context.Response.ContentType = "application/json;charset=utf-8"; - return context.Response.WriteAsync(result); - } - } - //扩展方法 - public static class ErrorHandlingExtensions - { - public static IApplicationBuilder UseErrorHandlingService(this IApplicationBuilder builder) - { - return builder.UseMiddleware(); - } - } -} \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/HealthCheckExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/HealthCheckExtension.cs deleted file mode 100644 index 0a489f8a..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/HealthCheckExtension.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// 健康检测扩展 - /// - public static class HealthCheckExtension - { - /// - /// 设置心跳响应 - /// - /// - /// 默认是/Health - /// - public static void UseHealthCheckMiddleware(this IApplicationBuilder app, string checkPath = "/Health") - { - if (Appsettings.appBool("HealthCheck_Enabled")) - { - app.Map(checkPath, applicationBuilder => applicationBuilder.Run(async context => - { - Console.WriteLine($"This is Health Check"); - context.Response.StatusCode = (int)HttpStatusCode.OK; - await context.Response.WriteAsync("OK"); - })); - } - - - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/IocExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/IocExtension.cs deleted file mode 100644 index b7d73f4f..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/IocExtension.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.IO; -using Yi.Framework.Model; -using Yi.Framework.Model.ModelFactory; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// 通用跨域扩展 - /// - public static class IocExtension - { - public static IServiceCollection AddIocService(this IServiceCollection services, IConfiguration configuration) - { - #region - //配置文件使用配置 - #endregion - services.AddSingleton(new Appsettings(configuration)); - #region - //数据库配置 - #endregion - services.AddTransient(); - return services; - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/JwtExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/JwtExtension.cs deleted file mode 100644 index eb8b04a4..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/JwtExtension.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; -using System; -using System.IO; -using System.Text; -using Yi.Framework.Common.Const; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// 通用跨域扩展 - /// - public static class JwtExtension - { - public static IServiceCollection AddJwtService(this IServiceCollection services) - { - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.TokenValidationParameters = new TokenValidationParameters - { - ValidateIssuer = true,//是否验证Issuer - ValidateAudience = true,//是否验证Audience - ValidateLifetime = true,//是否验证失效时间 - ClockSkew = TimeSpan.FromDays(1), - - ValidateIssuerSigningKey = true,//是否验证SecurityKey - ValidAudience = JwtConst.Domain,//Audience - ValidIssuer = JwtConst.Domain,//Issuer,这两项和前面签发jwt的设置一致 - IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConst.SecurityKey))//拿到SecurityKey - }; - }); - - return services; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/PreOptionRequestExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/PreOptionRequestExtension.cs deleted file mode 100644 index c8d4a251..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/PreOptionRequestExtension.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// 预检请求扩展 - /// - public class PreOptionRequestExtension - { - private readonly RequestDelegate _next; - - public PreOptionRequestExtension(RequestDelegate next) - { - _next = next; - } - - public async Task Invoke(HttpContext context) - { - if (context.Request.Method.ToUpper() == "OPTIONS") - { - //context.Response.Headers.Add("Access-Control-Allow-Origin", "http://localhost:8070"); - //context.Response.Headers.Add("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,PATCH,OPTIONS"); - //context.Response.Headers.Add("Access-Control-Allow-Headers", "*"); - context.Response.StatusCode = 200; - return; - } - await _next.Invoke(context); - } - } - - /// - /// 扩展中间件 - /// - public static class PreOptionsRequestMiddlewareExtensions - { - public static IApplicationBuilder UsePreOptionsRequest(this IApplicationBuilder app) - { - return app.UseMiddleware(); - } - } - -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/QuartzExtensions.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/QuartzExtensions.cs deleted file mode 100644 index 4dca1fd7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/QuartzExtensions.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Autofac.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection; -using Quartz; -using Quartz.Impl; -using Quartz.Spi; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Yi.Framework.Core; -using Yi.Framework.Core.Quartz; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// 启动定时器服务,后台服务 - /// - public static class QuartzExtensions - { - /// - /// 使用定时器 - /// - /// - /// - public static IServiceCollection AddQuartzService(this IServiceCollection services) - { - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - return services; - } - } - -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RabbitMQExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RabbitMQExtension.cs deleted file mode 100644 index e98b49c8..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RabbitMQExtension.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; -using System; -using System.IO; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Core; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// Redis扩展 - /// - public static class RabbitMQExtension - { - public static IServiceCollection AddRabbitMQService(this IServiceCollection services) - { - if (Appsettings.appBool("RabbitMQ_Enabled")) - { - services.Configure(Appsettings.appConfiguration("RabbitConn")); - services.AddTransient(); - } - return services; - - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs deleted file mode 100644 index 2d17b857..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RedisExtension.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; -using System; -using System.IO; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Core; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// Redis扩展 - /// - public static class RedisExtension - { - public static IServiceCollection AddRedisService(this IServiceCollection services) - { - if (Appsettings.appBool("Redis_Enabled")) - { - services.Configure(Appsettings.appConfiguration("RedisConnOptions")); - services.AddTransient(); - } - return services; - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RedisInitExtend.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RedisInitExtend.cs deleted file mode 100644 index 010bb42e..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/RedisInitExtend.cs +++ /dev/null @@ -1,37 +0,0 @@ -using log4net; -using Microsoft.AspNetCore.Builder; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core; -using Yi.Framework.Model.ModelFactory; -using Yi.Framework.WebCore.Init; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - public static class RedisInitExtend - { - private static readonly ILog log = LogManager.GetLogger(typeof(RedisInitExtend)); - public static void UseRedisSeedInitService(this IApplicationBuilder app, CacheClientDB _cacheClientDB) - { - - if (Appsettings.appBool("RedisSeed_Enabled")) - { - if (app == null) throw new ArgumentNullException(nameof(app)); - - try - { - RedisInit.Seed(_cacheClientDB); - } - catch (Exception e) - { - log.Error($"Error occured seeding the RedisInit.\n{e.Message}"); - throw; - } - } - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/SMSExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/SMSExtension.cs deleted file mode 100644 index 487f02d4..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/SMSExtension.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; -using System; -using System.IO; -using Yi.Framework.Common.IOCOptions; -using Yi.Framework.Core; -using Yi.Framework.Core.SMS; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// Redis扩展 - /// - public static class SMSExtension - { - public static IServiceCollection AddSMSService(this IServiceCollection services) - { - if (Appsettings.appBool("SMS_Enabled")) - { - - services.Configure(Appsettings.appConfiguration("SMS")); - services.AddTransient(); - } - return services; - - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs deleted file mode 100644 index 429fdce7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs +++ /dev/null @@ -1,156 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// 静态化页面处理扩展 - /// - public class StaticPageExtension - { - private readonly RequestDelegate _next; - private string _directoryPath = @"D:/cc-yi/"; - private bool _supportDelete = false; - private bool _supportWarmup = false; - - public StaticPageExtension(RequestDelegate next, string directoryPath, bool supportDelete, bool supportWarmup) - { - this._next = next; - this._directoryPath = directoryPath; - this._supportDelete = supportDelete; - this._supportWarmup = supportWarmup; - } - - public async Task InvokeAsync(HttpContext context) - { - if (this._supportDelete && "Delete".Equals(context.Request.Query["ActionHeader"])) - { - this.DeleteHmtl(context.Request.Path.Value); - context.Response.StatusCode = 200; - } - else if (this._supportWarmup && "ClearAll".Equals(context.Request.Query["ActionHeader"])) - { - this.ClearDirectory(10);//考虑数据量 - context.Response.StatusCode = 200; - } - else if (!context.Request.IsAjaxRequest()) - { - Console.WriteLine($"This is StaticPageMiddleware InvokeAsync {context.Request.Path.Value}"); - #region context.Response.Body - var originalStream = context.Response.Body; - using (var copyStream = new MemoryStream()) - { - context.Response.Body = copyStream; - await _next(context); - - copyStream.Position = 0; - var reader = new StreamReader(copyStream); - var content = await reader.ReadToEndAsync(); - string url = context.Request.Path.Value; - - this.SaveHmtl(url, content); - - copyStream.Position = 0; - await copyStream.CopyToAsync(originalStream); - context.Response.Body = originalStream; - } - #endregion - } - else - { - await _next(context); - } - } - - private void SaveHmtl(string url, string html) - { - try - { - //Console.WriteLine($"Response: {html}"); - if (string.IsNullOrWhiteSpace(html)) - return; - if (!url.EndsWith(".html")) - return; - - if (Directory.Exists(_directoryPath) == false) - Directory.CreateDirectory(_directoryPath); - - var totalPath = Path.Combine(_directoryPath, url.Split("/").Last()); - File.WriteAllText(totalPath, html);//直接覆盖 - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - } - - /// - /// 删除某个页面 - /// - /// - /// - private void DeleteHmtl(string url) - { - try - { - if (!url.EndsWith(".html")) - return; - var totalPath = Path.Combine(_directoryPath, url.Split("/").Last()); - File.Delete(totalPath);//直接删除 - } - catch (Exception ex) - { - Console.WriteLine($"Delete {url} 异常,{ex.Message}"); - } - } - - /// - /// 清理文件,支持重试 - /// - /// 最多重试次数 - private void ClearDirectory(int index) - { - if (index > 0)//简陋版---重试index次 - { - try - { - var files = Directory.GetFiles(_directoryPath); - foreach (var file in files) - { - File.Delete(file); - } - } - catch (Exception ex) - { - Console.WriteLine($"ClearDirectory failed {ex.Message}"); - ClearDirectory(index--); - } - } - } - } - - /// - /// 扩展中间件 - /// - public static class StaticPageMiddlewareExtensions - { - /// - /// - /// - /// - /// 文件写入地址,文件夹目录 - /// 是否支持删除 - /// 是否支持全量删除 - /// - public static IApplicationBuilder UseStaticPageMiddleware(this IApplicationBuilder app, string directoryPath, bool supportDelete, bool supportClear) - { - return app.UseMiddleware(directoryPath, supportDelete, supportClear); - } - } -} \ No newline at end of file diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs deleted file mode 100644 index 5eb04bca..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/MiddlewareExtend/SwaggerExtension.cs +++ /dev/null @@ -1,124 +0,0 @@ -using IGeekFan.AspNetCore.Knife4jUI; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Mvc.Controllers; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Models; -using System; -using System.IO; -using Yi.Framework.Common.Models; - -namespace Yi.Framework.WebCore.MiddlewareExtend -{ - /// - /// Swagger扩展 - /// - public static class SwaggerExtension - { - public static IServiceCollection AddSwaggerService(this IServiceCollection services, string title = "Yi意框架-API接口") - { - var apiInfo = new OpenApiInfo - { - Title = title, - Version = "v1", - Contact = new OpenApiContact { Name = "橙子", Email = "454313500@qq.com", Url = new System.Uri("https://ccnetcore.com") } - }; - #region 注册Swagger服务 - services.AddSwaggerGen(c => - { - c.SwaggerDoc("v1", apiInfo); - - //添加注释服务 - //为 Swagger JSON and UI设置xml文档注释路径 - //获取应用程序所在目录(绝对路径,不受工作目录影响,建议采用此方法获取路径使用windwos&Linux) - var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location); - var apiXmlPath = Path.Combine(basePath, @"SwaggerDoc.xml");//控制器层注释 - //var entityXmlPath = Path.Combine(basePath, @"SwaggerDoc.xml");//实体注释 - //c.IncludeXmlComments(apiXmlPath, true);//true表示显示控制器注释 - c.IncludeXmlComments(apiXmlPath,true); - - //添加控制器注释 - //c.DocumentFilter(); - - //添加header验证信息 - //c.OperationFilter(); - //var security = new Dictionary> { { "Bearer", new string[] { } }, }; - - c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme() - { - Description = "文本框里输入从服务器获取的Token。格式为:Bearer + 空格+token",//JWT授权(数据将在请求头中进行传输) 参数结构: \"Authorization: Bearer {token}\" - Name = "Authorization",////jwt默认的参数名称 - In = ParameterLocation.Header,////jwt默认存放Authorization信息的位置(请求头中) - Type = SecuritySchemeType.ApiKey, - }); - c.AddSecurityRequirement(new OpenApiSecurityRequirement - { - { new OpenApiSecurityScheme - { - Reference = new OpenApiReference() - { - Id = "Bearer", - Type = ReferenceType.SecurityScheme - } - }, Array.Empty() } - }); - - c.AddServer(new OpenApiServer() - { - Url = "https://ccnetcore.com", - Description = "Yi-Framework" - }); - c.CustomOperationIds(apiDesc => - { - var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor; - return controllerAction.ActionName; - }); - }); - #endregion - - return services; - } - - public static void UseSwaggerService(this IApplicationBuilder app, params SwaggerModel[] swaggerModels) - { - //在 Startup.Configure 方法中,启用中间件为生成的 JSON 文档和 Swagger UI 提供服务: - // Enable middleware to serve generated Swagger as a JSON endpoint. - app.UseSwagger(); - - - app.UseKnife4UI(c => - { - c.RoutePrefix = "swagger"; // serve the UI at root - if (swaggerModels.Length == 0) - { - c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework"); - } - else - { - foreach (var k in swaggerModels) - { - c.SwaggerEndpoint(k.url, k.name); - } - } - }); - - //app.UseSwaggerUI(c => - //{ - // if (swaggerModels.Length == 0) - // { - // c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework"); - // } - // else - // { - // foreach (var k in swaggerModels) - // { - // c.SwaggerEndpoint(k.url, k.name); - // } - // } - - //} - - //); - } - - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomAutofacAop.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomAutofacAop.cs deleted file mode 100644 index 85b0c251..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomAutofacAop.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Castle.DynamicProxy; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Yi.Framework.WebCore.Utility -{ - public class CustomAutofacAop : IInterceptor - { - public void Intercept(IInvocation invocation) - { - Console.WriteLine($"invocation.Methond={invocation.Method}"); - Console.WriteLine($"invocation.Arguments={string.Join(",", invocation.Arguments)}"); - - invocation.Proceed(); //继续执行 - - Console.WriteLine($"方法{invocation.Method}执行完成了"); - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomAutofacModule.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomAutofacModule.cs deleted file mode 100644 index f39b0d8d..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomAutofacModule.cs +++ /dev/null @@ -1,88 +0,0 @@ -using Autofac; -using Autofac.Extras.DynamicProxy; -using Castle.DynamicProxy; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc.ApplicationParts; -using Microsoft.AspNetCore.Mvc.Controllers; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; -using Yi.Framework.Job; -using Yi.Framework.Model.ModelFactory; -using Yi.Framework.WebCore.Utility; -using Module = Autofac.Module; - -namespace Yi.Framework.WebCore.Utility -{ - public class CustomAutofacModule : Module - { - private Assembly GetDll(string ass) - { - var basePath = AppContext.BaseDirectory; - var servicesDllFile = Path.Combine(basePath, ass); - if (!(File.Exists(servicesDllFile))) - { - var msg = "service.dll 丢失,请编译后重新生成。"; - throw new Exception(msg); - } - return Assembly.LoadFrom(servicesDllFile); ; - } - - protected override void Load(ContainerBuilder containerBuilder) - { - - containerBuilder.RegisterType().As().InstancePerDependency().EnableInterfaceInterceptors(); - - containerBuilder.RegisterType< HttpContextAccessor>().As().SingleInstance(); - - - - ///反射注入服务层及接口层 - var assemblysServices = GetDll( "Yi.Framework.Service.dll"); - containerBuilder.RegisterAssemblyTypes(assemblysServices) - .AsImplementedInterfaces() - .InstancePerDependency() - .EnableInterfaceInterceptors(); - -///反射注册任务调度层 - var assemblysJob = GetDll("Yi.Framework.Job.dll"); - containerBuilder.RegisterAssemblyTypes(assemblysJob) - .InstancePerDependency(); - - - - containerBuilder.Register(c => new CustomAutofacAop());//AOP注册 - - - //containerBuilder.RegisterType().As().EnableInterfaceInterceptors();开启Aop - - //将数据库对象注入 - //containerBuilder.RegisterType().As().InstancePerLifetimeScope().EnableInterfaceInterceptors(); - - //containerBuilder.RegisterGeneric(typeof(BaseService<>)).As(typeof(IBaseService<>)).InstancePerDependency().EnableInterfaceInterceptors(); - - - - } - - } -} - - -public interface IAutofacTest -{ - void Show(int id, string name); -} - -[Intercept(typeof(CustomAutofacAop))] -public class AutofacTest : IAutofacTest -{ - public void Show(int id, string name) - { - Console.WriteLine($"This is {id} _ {name}"); - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomHostingStartup.cs b/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomHostingStartup.cs deleted file mode 100644 index 58fcabb7..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/Utility/CustomHostingStartup.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -[assembly: HostingStartup(typeof(Yi.Framework.WebCore.Utility.CustomHostingStartup))] -namespace Yi.Framework.WebCore.Utility -{ - /// - /// 必须实现IHostingStartup接口 - /// 必须标记HostingStartup特性 - /// - /// 就像木马一样 - /// - public class CustomHostingStartup : IHostingStartup - { - public void Configure(IWebHostBuilder builder) - { - Console.WriteLine("This is CustomHostingStartup Invoke"); - - //有IWebHostBuilder,一切都可以做。。 - #region MyRegion - //builder.ConfigureAppConfiguration(configurationBuilder => - //{ - // configurationBuilder.AddXmlFile("appsettings1.xml", optional: false, reloadOnChange: true); - //});//添加配置 - - //builder.ConfigureServices(services => - //{ - // services.AddTransient(); - //});//IOC注册 - - //builder.Configure(app => - //{ - // app.Use(next => - // { - // Console.WriteLine("This is CustomHostingStartup-Middleware Init"); - // return new RequestDelegate( - // async context => - // { - // Console.WriteLine("This is CustomHostingStartup-Middleware start"); - // await next.Invoke(context); - // Console.WriteLine("This is CustomHostingStartup-Middleware end"); - // }); - // }); - //});//甚至来个中间件 - #endregion - } - } -} diff --git a/Yi.Framework.Net5/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj b/Yi.Framework.Net5/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj deleted file mode 100644 index 789419be..00000000 --- a/Yi.Framework.Net5/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - net5.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Yi.Framework.Net5/Yi.Framework.sln b/Yi.Framework.Net5/Yi.Framework.sln deleted file mode 100644 index c22c9c20..00000000 --- a/Yi.Framework.Net5/Yi.Framework.sln +++ /dev/null @@ -1,143 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31515.178 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BackGround", "BackGround", "{D6B44435-EAFA-4D55-90D0-3AF80485FB83}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{C90E38FB-69EA-4997-8B3A-2C71EFA65B2B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Domain", "Domain", "{DB2506F5-05FD-4E76-940E-41D7AA148550}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{9ABAF6B1-6C02-498A-90A2-ABC1140CF89A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MicroServiceInstance", "MicroServiceInstance", "{026D2797-07D1-4BA5-8070-50CDE0258C59}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.DTOModel", "Yi.Framework.DTOModel\Yi.Framework.DTOModel.csproj", "{5B6C87F0-CEBA-4A0A-8C30-02E927AB4AEF}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Interface", "Yi.Framework.Interface\Yi.Framework.Interface.csproj", "{5935EC64-7414-47D8-B934-E5896DD89E4E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Model", "Yi.Framework.Model\Yi.Framework.Model.csproj", "{F0EE03CF-30C9-4C48-BF32-FED6F3BCFB4C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Service", "Yi.Framework.Service\Yi.Framework.Service.csproj", "{C5E41276-A30F-4098-BA79-2E8920BBD02A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Common", "Yi.Framework.Common\Yi.Framework.Common.csproj", "{4816AA7B-7222-4B3B-A178-C2A70713E9D1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Core", "Yi.Framework.Core\Yi.Framework.Core.csproj", "{07A80C17-E03E-475D-9BBF-98E3B1393652}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.WebCore", "Yi.Framework.WebCore\Yi.Framework.WebCore.csproj", "{E4734315-158C-4D35-AF01-1122C22F2955}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.ApiMicroservice", "Yi.Framework.ApiMicroservice\Yi.Framework.ApiMicroservice.csproj", "{A95157D2-907F-411E-BA1D-A17F48C54A0E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.OcelotGateway", "Yi.Framework.OcelotGateway\Yi.Framework.OcelotGateway.csproj", "{671E38D8-ECAF-484B-A2AE-63DDC469C315}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.AuthenticationCenter", "Yi.Framework.AuthenticationCenter\Yi.Framework.AuthenticationCenter.csproj", "{694C0EC0-ED32-4E5D-8EA1-FB82E1303EAB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.StaticPageProcessor", "Yi.Framework.StaticPageProcessor\Yi.Framework.StaticPageProcessor.csproj", "{D2BC3EBE-7F08-476E-9BB5-58A6F27AB31A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.ElasticSearchProcessor", "Yi.Framework.ElasticSearchProcessor\Yi.Framework.ElasticSearchProcessor.csproj", "{EEF89893-A6A9-4C02-818C-D116C8EAE0EF}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.MSUnitTest", "Yi.Framework.MSUnitTest\Yi.Framework.MSUnitTest.csproj", "{531255B3-9669-4BC1-B4E5-A0C6E0540F0D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.PageDetail", "Yi.Framework.PageDetail\Yi.Framework.PageDetail.csproj", "{637501E2-A32E-485C-8680-ED863D1793C2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Job", "Yi.Framework.Task\Yi.Framework.Job.csproj", "{F1C990DD-32C3-4F02-83B0-6E52B18B0B17}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.SMSProcessor", "Yi.Framework.SMSProcessor\Yi.Framework.SMSProcessor.csproj", "{7C58FB7C-9AB5-47CF-ACEB-B784CF820E7E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5B6C87F0-CEBA-4A0A-8C30-02E927AB4AEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5B6C87F0-CEBA-4A0A-8C30-02E927AB4AEF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5B6C87F0-CEBA-4A0A-8C30-02E927AB4AEF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5B6C87F0-CEBA-4A0A-8C30-02E927AB4AEF}.Release|Any CPU.Build.0 = Release|Any CPU - {5935EC64-7414-47D8-B934-E5896DD89E4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5935EC64-7414-47D8-B934-E5896DD89E4E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5935EC64-7414-47D8-B934-E5896DD89E4E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5935EC64-7414-47D8-B934-E5896DD89E4E}.Release|Any CPU.Build.0 = Release|Any CPU - {F0EE03CF-30C9-4C48-BF32-FED6F3BCFB4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F0EE03CF-30C9-4C48-BF32-FED6F3BCFB4C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F0EE03CF-30C9-4C48-BF32-FED6F3BCFB4C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F0EE03CF-30C9-4C48-BF32-FED6F3BCFB4C}.Release|Any CPU.Build.0 = Release|Any CPU - {C5E41276-A30F-4098-BA79-2E8920BBD02A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C5E41276-A30F-4098-BA79-2E8920BBD02A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C5E41276-A30F-4098-BA79-2E8920BBD02A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C5E41276-A30F-4098-BA79-2E8920BBD02A}.Release|Any CPU.Build.0 = Release|Any CPU - {4816AA7B-7222-4B3B-A178-C2A70713E9D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4816AA7B-7222-4B3B-A178-C2A70713E9D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4816AA7B-7222-4B3B-A178-C2A70713E9D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4816AA7B-7222-4B3B-A178-C2A70713E9D1}.Release|Any CPU.Build.0 = Release|Any CPU - {07A80C17-E03E-475D-9BBF-98E3B1393652}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07A80C17-E03E-475D-9BBF-98E3B1393652}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07A80C17-E03E-475D-9BBF-98E3B1393652}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07A80C17-E03E-475D-9BBF-98E3B1393652}.Release|Any CPU.Build.0 = Release|Any CPU - {E4734315-158C-4D35-AF01-1122C22F2955}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E4734315-158C-4D35-AF01-1122C22F2955}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E4734315-158C-4D35-AF01-1122C22F2955}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E4734315-158C-4D35-AF01-1122C22F2955}.Release|Any CPU.Build.0 = Release|Any CPU - {A95157D2-907F-411E-BA1D-A17F48C54A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A95157D2-907F-411E-BA1D-A17F48C54A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A95157D2-907F-411E-BA1D-A17F48C54A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A95157D2-907F-411E-BA1D-A17F48C54A0E}.Release|Any CPU.Build.0 = Release|Any CPU - {671E38D8-ECAF-484B-A2AE-63DDC469C315}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {671E38D8-ECAF-484B-A2AE-63DDC469C315}.Debug|Any CPU.Build.0 = Debug|Any CPU - {671E38D8-ECAF-484B-A2AE-63DDC469C315}.Release|Any CPU.ActiveCfg = Release|Any CPU - {671E38D8-ECAF-484B-A2AE-63DDC469C315}.Release|Any CPU.Build.0 = Release|Any CPU - {694C0EC0-ED32-4E5D-8EA1-FB82E1303EAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {694C0EC0-ED32-4E5D-8EA1-FB82E1303EAB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {694C0EC0-ED32-4E5D-8EA1-FB82E1303EAB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {694C0EC0-ED32-4E5D-8EA1-FB82E1303EAB}.Release|Any CPU.Build.0 = Release|Any CPU - {D2BC3EBE-7F08-476E-9BB5-58A6F27AB31A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2BC3EBE-7F08-476E-9BB5-58A6F27AB31A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2BC3EBE-7F08-476E-9BB5-58A6F27AB31A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2BC3EBE-7F08-476E-9BB5-58A6F27AB31A}.Release|Any CPU.Build.0 = Release|Any CPU - {EEF89893-A6A9-4C02-818C-D116C8EAE0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EEF89893-A6A9-4C02-818C-D116C8EAE0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EEF89893-A6A9-4C02-818C-D116C8EAE0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EEF89893-A6A9-4C02-818C-D116C8EAE0EF}.Release|Any CPU.Build.0 = Release|Any CPU - {531255B3-9669-4BC1-B4E5-A0C6E0540F0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {531255B3-9669-4BC1-B4E5-A0C6E0540F0D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {531255B3-9669-4BC1-B4E5-A0C6E0540F0D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {531255B3-9669-4BC1-B4E5-A0C6E0540F0D}.Release|Any CPU.Build.0 = Release|Any CPU - {637501E2-A32E-485C-8680-ED863D1793C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {637501E2-A32E-485C-8680-ED863D1793C2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {637501E2-A32E-485C-8680-ED863D1793C2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {637501E2-A32E-485C-8680-ED863D1793C2}.Release|Any CPU.Build.0 = Release|Any CPU - {F1C990DD-32C3-4F02-83B0-6E52B18B0B17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F1C990DD-32C3-4F02-83B0-6E52B18B0B17}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F1C990DD-32C3-4F02-83B0-6E52B18B0B17}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F1C990DD-32C3-4F02-83B0-6E52B18B0B17}.Release|Any CPU.Build.0 = Release|Any CPU - {7C58FB7C-9AB5-47CF-ACEB-B784CF820E7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7C58FB7C-9AB5-47CF-ACEB-B784CF820E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7C58FB7C-9AB5-47CF-ACEB-B784CF820E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7C58FB7C-9AB5-47CF-ACEB-B784CF820E7E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {5B6C87F0-CEBA-4A0A-8C30-02E927AB4AEF} = {DB2506F5-05FD-4E76-940E-41D7AA148550} - {5935EC64-7414-47D8-B934-E5896DD89E4E} = {DB2506F5-05FD-4E76-940E-41D7AA148550} - {F0EE03CF-30C9-4C48-BF32-FED6F3BCFB4C} = {DB2506F5-05FD-4E76-940E-41D7AA148550} - {C5E41276-A30F-4098-BA79-2E8920BBD02A} = {DB2506F5-05FD-4E76-940E-41D7AA148550} - {4816AA7B-7222-4B3B-A178-C2A70713E9D1} = {9ABAF6B1-6C02-498A-90A2-ABC1140CF89A} - {07A80C17-E03E-475D-9BBF-98E3B1393652} = {9ABAF6B1-6C02-498A-90A2-ABC1140CF89A} - {E4734315-158C-4D35-AF01-1122C22F2955} = {9ABAF6B1-6C02-498A-90A2-ABC1140CF89A} - {A95157D2-907F-411E-BA1D-A17F48C54A0E} = {026D2797-07D1-4BA5-8070-50CDE0258C59} - {671E38D8-ECAF-484B-A2AE-63DDC469C315} = {D6B44435-EAFA-4D55-90D0-3AF80485FB83} - {694C0EC0-ED32-4E5D-8EA1-FB82E1303EAB} = {D6B44435-EAFA-4D55-90D0-3AF80485FB83} - {D2BC3EBE-7F08-476E-9BB5-58A6F27AB31A} = {D6B44435-EAFA-4D55-90D0-3AF80485FB83} - {EEF89893-A6A9-4C02-818C-D116C8EAE0EF} = {D6B44435-EAFA-4D55-90D0-3AF80485FB83} - {531255B3-9669-4BC1-B4E5-A0C6E0540F0D} = {C90E38FB-69EA-4997-8B3A-2C71EFA65B2B} - {637501E2-A32E-485C-8680-ED863D1793C2} = {026D2797-07D1-4BA5-8070-50CDE0258C59} - {F1C990DD-32C3-4F02-83B0-6E52B18B0B17} = {9ABAF6B1-6C02-498A-90A2-ABC1140CF89A} - {7C58FB7C-9AB5-47CF-ACEB-B784CF820E7E} = {D6B44435-EAFA-4D55-90D0-3AF80485FB83} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1ED77A6E-377F-4EEF-A3D0-D65C94657DAF} - EndGlobalSection -EndGlobal