From b854fd36b348bb5a11b21fe06d9dddcce4f962f9 Mon Sep 17 00:00:00 2001 From: luolangaga <2667210109@qq.com> Date: Sun, 25 Aug 2024 00:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E6=8A=A5=E5=90=8D=EF=BC=88?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asg_form/Controllers/Champion.cs | 2 +- asg_form/Controllers/Dbset.cs | 42 +++++++++++++++++++++++++---- asg_form/Controllers/Events.cs | 27 ++++++++++--------- asg_form/Controllers/Team/TeamDB.cs | 35 ++++++++++++++++++++++++ asg_form/Controllers/form_cs.cs | 2 +- 5 files changed, 89 insertions(+), 19 deletions(-) create mode 100644 asg_form/Controllers/Team/TeamDB.cs diff --git a/asg_form/Controllers/Champion.cs b/asg_form/Controllers/Champion.cs index 3699c68..ee133c1 100644 --- a/asg_form/Controllers/Champion.cs +++ b/asg_form/Controllers/Champion.cs @@ -110,7 +110,7 @@ namespace asg_form.Controllers { public long Id { get; set; } public form form { get; set; } - public Events.T_events events { get; set; } + public T_events events { get; set; } public string msg { get; set; } } diff --git a/asg_form/Controllers/Dbset.cs b/asg_form/Controllers/Dbset.cs index ddeed1e..c2d6be3 100644 --- a/asg_form/Controllers/Dbset.cs +++ b/asg_form/Controllers/Dbset.cs @@ -1,5 +1,6 @@  using asg_form.Controllers.Store; +using asg_form.Controllers.Team; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DataEncryption; @@ -27,6 +28,9 @@ namespace asg_form.Controllers builder.Property(a => a.Status).IsRequired(); } } + + + public void Configure(EntityTypeBuilder
builder) { builder.ToTable("F_form"); @@ -35,11 +39,38 @@ namespace asg_form.Controllers builder.Property(e => e.team_password).IsRequired(); builder.Property(e => e.time).IsRequired(); builder.Property(e => e.piaoshu).IsRequired(); - builder.HasOne(c => c.events).WithMany(a => a.forms).IsRequired(); + builder.HasOne(c => c.events).WithMany(a => a.forms).IsRequired(); } } + + class TeamConfig : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("F_Team"); + builder.Property(e => e.team_name).IsRequired(); + builder.Property(e => e.team_tel).IsRequired(); + builder.Property(e => e.team_password).IsRequired(); + builder.Property(e => e.time).IsRequired(); + builder.Property(e => e.piaoshu).IsRequired(); + builder.HasMany(a => a.Events).WithMany(a => a.Teams).UsingEntity(j => j.ToTable("T_Teams_Player")); + + } + } + + class PlayerConfig : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("F_Player"); + + } + } + + + class RoleConfig : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) @@ -129,9 +160,9 @@ namespace asg_form.Controllers builder.HasOne(e => e.team).WithMany(o=>o.logs).IsRequired(); } } - class EventsConfig : IEntityTypeConfiguration + class EventsConfig : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { builder.ToTable("F_events"); builder.Property(e => e.Id).IsRequired(); @@ -189,15 +220,16 @@ namespace asg_form.Controllers class TestDbContext : DbContext { + public DbSet Teams { get; set; } + public DbSet Players { get; set; } - public DbSet Forms { get; set; } public DbSet Roles { get; set; } public DbSet news { get; set; } public DbSet blogs { get; set; } public DbSet schlogs { get; set; } public DbSet team_Games { get; set; } - public DbSet events { get; set; } + public DbSet events { get; set; } public DbSet Champions { get; set; } public DbSet com_Forms { get; set; } public DbSet T_Friends { get; set; } diff --git a/asg_form/Controllers/Events.cs b/asg_form/Controllers/Events.cs index 32d533b..979c8b0 100644 --- a/asg_form/Controllers/Events.cs +++ b/asg_form/Controllers/Events.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authorization; +using asg_form.Controllers.Team; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; @@ -162,17 +163,7 @@ namespace asg_form.Controllers } - public class T_events - { - public int Id { get; set; } - public string? name { get; set; } - public bool? is_over { get; set; } - public DateTime? opentime { get; set; } - public List? forms { get; set; } - public Uri? events_rule_uri { get; set; } - public string? promChart { get; set; } - - } + public class events_get { public int Id { get; set; } @@ -183,4 +174,16 @@ namespace asg_form.Controllers } } + public class T_events + { + public int Id { get; set; } + public string? name { get; set; } + public bool? is_over { get; set; } + public DateTime? opentime { get; set; } + public List Teams { get; set; }=new List(); + public List? forms { get; set; } + public Uri? events_rule_uri { get; set; } + public string? promChart { get; set; } + + } } diff --git a/asg_form/Controllers/Team/TeamDB.cs b/asg_form/Controllers/Team/TeamDB.cs new file mode 100644 index 0000000..6aeb00a --- /dev/null +++ b/asg_form/Controllers/Team/TeamDB.cs @@ -0,0 +1,35 @@ +namespace asg_form.Controllers.Team +{ + public class T_Team + { + + public List Events { get; set; }=new List(); + public long Id { get; set; } + public int piaoshu { get; set; } + public DateTime time { get; set; } = DateTime.Now; + public string team_name { get; set; } + public string team_password { get; set; } + public string team_tel { get; set; } + public string logo_uri { get; set; } + public T_events events { get; set; } + + // public string? belong { get; set; } + public List role { get; set; } = new List(); + } + public class T_Player + { + public long Id { get; set; } + + public T_Team Team { get; set; }//属于哪个队伍 + + public string role_id { get; set; } = "无"; + public string role_name { get; set; } = "无";//阵容 + public string? Game_Name { get; set; } = "未知"; + public string role_lin { get; set; } + public string? Id_Card { get; set; } = "未知"; + public string? Common_Roles { get; set; } = "未知"; + public string? Phone_Number { get; set; } = "未知"; + public string? Id_Card_Name { get; set; } = "未知"; + public int? Historical_Ranks { get; set; } = 0; + } +} diff --git a/asg_form/Controllers/form_cs.cs b/asg_form/Controllers/form_cs.cs index 77f2e9b..d134c52 100644 --- a/asg_form/Controllers/form_cs.cs +++ b/asg_form/Controllers/form_cs.cs @@ -518,7 +518,7 @@ namespace asg_form.Controllers public string team_password { get; set; } public string team_tel { get; set; } public string logo_uri { get; set; } - public Events.T_events events { get; set; } + public T_events events { get; set; } // public string? belong { get; set; } public List role { get; set; } = new List();