change
This commit is contained in:
		
							parent
							
								
									fe397cafbc
								
							
						
					
					
						commit
						3f4572dd1f
					
				@ -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;
 | 
			
		||||
 | 
			
		||||
@ -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<ComformDB> T_Comform { get; set; }
 | 
			
		||||
        public DbSet<BgDB> budgetDetails { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DbSet<InviteBg> T_Invitation { get; set; }
 | 
			
		||||
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 | 
			
		||||
        {
 | 
			
		||||
            string connStr = @"Host=localhost;Port=2345;Database=asg;Username=postgres;Password=luolan12323;";
 | 
			
		||||
 | 
			
		||||
@ -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<int> 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();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user