diff --git a/asg_form/Controllers/AssignmentController.cs b/asg_form/Controllers/AssignmentController.cs index 4fdf82d..7495cf4 100644 --- a/asg_form/Controllers/AssignmentController.cs +++ b/asg_form/Controllers/AssignmentController.cs @@ -297,12 +297,12 @@ namespace asg_form.Controllers .Take(limit) .ToListAsync(); - var result = new + var data = new { rows = Tasks , total = TotalRecords, }; - return Ok(result); + return Ok(new { code = 200, message = " ", data }); } } diff --git a/asg_form/Controllers/BlackController.cs b/asg_form/Controllers/BlackController.cs new file mode 100644 index 0000000..d045600 --- /dev/null +++ b/asg_form/Controllers/BlackController.cs @@ -0,0 +1,30 @@ +using AsmResolver.PE.DotNet.Cil; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Security.Claims; +using static asg_form.Controllers.AssignmentController; + +namespace asg_form.Controllers +{ + public class BlackDB + { + public int id { get; set; } + public string user_name { get; set; } + //..... + } + public class BlackController : ControllerBase + { + [Route("api/v1/blackTable")] + [HttpGet] + public async Task> blackAdd ([FromQuery] string userName) + { + if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "nbadmin")||!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin")) + { + return Ok(new error_mb { code = 401, message = "无权访问" }); + } + TestDbContext sub = new TestDbContext(); + + return Ok(new { code = 200, message = "" }); + } + } +} diff --git a/asg_form/Controllers/Dbset.cs b/asg_form/Controllers/Dbset.cs index d9763c0..a882f06 100644 --- a/asg_form/Controllers/Dbset.cs +++ b/asg_form/Controllers/Dbset.cs @@ -289,6 +289,7 @@ namespace asg_form.Controllers public DbSet T_Invitation { get; set; } public DbSet mainMenu { get; set; } public DbSet T_captcha_check { get; set; } + public DbSet T_blacks { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string connStr = @"Host=localhost;Port=2345;Database=asg;Username=postgres;Password=luolan12323;";