From 3f4572dd1f5b3c542900fcde4b15baf3a2ce20b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=82=9C=E7=BF=94?= <2307953404@qq.com> Date: Thu, 10 Oct 2024 09:59:47 +0800 Subject: [PATCH] change --- .../Controllers/Budget/BgCountController.cs | 2 +- asg_form/Controllers/Dbset.cs | 2 ++ asg_form/Controllers/InviteReferee.cs | 21 ++++++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/asg_form/Controllers/Budget/BgCountController.cs b/asg_form/Controllers/Budget/BgCountController.cs index f8dec5b..880f5ef 100644 --- a/asg_form/Controllers/Budget/BgCountController.cs +++ b/asg_form/Controllers/Budget/BgCountController.cs @@ -173,7 +173,7 @@ namespace asg_form.Controllers.Budget var budget = await db.budgetDetails.FindAsync(request.BudgetId); if (budget == null) { - return NotFound(new { code = 404, message = "预算记录未找到" }); + return Ok(new { code = 404, message = "预算记录未找到" }); } budget.use_status = "1"; budget.use_person = request.UsePerson; diff --git a/asg_form/Controllers/Dbset.cs b/asg_form/Controllers/Dbset.cs index 9a04b86..b1f3a90 100644 --- a/asg_form/Controllers/Dbset.cs +++ b/asg_form/Controllers/Dbset.cs @@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; using System.Security.Cryptography; using System.Text; using static asg_form.Controllers.Budget.BgCountController; +using static asg_form.Controllers.InviteReferee; namespace asg_form.Controllers { @@ -244,6 +245,7 @@ namespace asg_form.Controllers public DbSet T_Comform { get; set; } public DbSet budgetDetails { get; set; } + public DbSet T_Invitation { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string connStr = @"Host=localhost;Port=2345;Database=asg;Username=postgres;Password=luolan12323;"; diff --git a/asg_form/Controllers/InviteReferee.cs b/asg_form/Controllers/InviteReferee.cs index 2ac7b37..03c2a92 100644 --- a/asg_form/Controllers/InviteReferee.cs +++ b/asg_form/Controllers/InviteReferee.cs @@ -19,6 +19,14 @@ namespace asg_form.Controllers this.userManager = userManager; } + public class InviteBg + { + public int id { get; set; } + public int userId { get; set; } + public List myRequest { get; set; } + + } + [Route("api/v1/Invite")] [HttpGet] [Authorize] @@ -26,10 +34,21 @@ namespace asg_form.Controllers { string Invitorid = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value; var user = await userManager.FindByIdAsync(Invitorid); + long userId = user.Id; using (TestDbContext sb = new TestDbContext()) { - + try + { + //var userInvited = await userManager.Users.FirstOrDefaultAsync(x => x.Id == Inviteeid); + //if (userInvited != null) return Ok(new { code = 404, message = "用户未找到" }); + var query = await sb.T_Invitation.FindAsync(Inviteeid); + + + }catch (Exception ex) + { + return Ok(new { code = 500, message = "服务器错误", details = ex.Message }); + } return Ok(); } }