This commit is contained in:
王炜翔 2024-08-17 18:27:08 +08:00
commit c043da88b7
23 changed files with 2691 additions and 172 deletions

View File

@ -19,7 +19,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build

View File

@ -1,5 +1,4 @@
using asg_form.Model;
using Manganese.Array;
using Manganese.Array;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@ -111,7 +110,7 @@ namespace asg_form.Controllers
{
public long Id { get; set; }
public form form { get; set; }
public T_events events { get; set; }
public Events.T_events events { get; set; }
public string msg { get; set; }
}

View File

@ -1,4 +1,5 @@
using asg_form.Migrations;
using Manganese.Text;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
@ -36,7 +37,7 @@ namespace asg_form.Controllers
{
TestDbContext testDb = new TestDbContext();
string chinaname = user.chinaname;
var teamgame = testDb.team_Games.Where(a => a.commentary.IndexOf(chinaname) >= 0).Select(a => new { a.id, a.team1_name, a.team2_name, a.bilibiliuri, a.commentary, a.referee ,a.opentime,a.team1_piaoshu,a.team2_piaoshu}).OrderByDescending(a => a.opentime).ToList();
var teamgame = testDb.team_Games.Where(a => a.commentary.IndexOf(chinaname) >= 0).Select(a => new { a.id, a.team1_name, a.team2_name, a.bilibiliuri, a.commentary, a.referee ,a.opentime}).ToList();
return JsonConvert.SerializeObject(teamgame);
}
@ -55,25 +56,16 @@ namespace asg_form.Controllers
var user = await userManager.FindByIdAsync(id);
if (user.officium == "Commentator")
{
TestDbContext testDb = new TestDbContext();
string chinaname = user.chinaname;
var teamgame = await testDb.team_Games.FirstAsync(a => a.id == gameid);
if (teamgame.commentary == "待公布")
{
List<string> strings = new List<string>
{
chinaname
};
teamgame.commentary = string.Join(",", strings.ToArray());
await testDb.SaveChangesAsync();
}
else
{
var team_game = teamgame.commentary.Split(",").ToList();
team_game.Add(chinaname);
teamgame.commentary = string.Join(",", team_game.ToArray());
await testDb.SaveChangesAsync();
}
var com = JsonConvert.DeserializeObject<List<com_json>>(teamgame.commentary);
com.Add(new com_json { id = id.ToInt32(), chinaname = chinaname });
teamgame.commentary = JsonConvert.SerializeObject(com);
await testDb.SaveChangesAsync();
user.Integral = user.Integral+10;
await userManager.UpdateAsync(user);
try
{
await MessageManager.SendGroupMessageAsync("870248618", $"解说:\r\n{chinaname}\r\n选择了比赛:\r\n{teamgame.team1_name} VS {teamgame.team2_name}");
@ -87,6 +79,21 @@ namespace asg_form.Controllers
return BadRequest(new error_mb { code = 400, message = $"你是{user.officium},你不是解说,无法操作" });
}
public class com_json
{
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
/// 老恐龙
/// </summary>
public string chinaname { get; set; }
}
/// <summary>
/// 取消选班
@ -105,14 +112,17 @@ namespace asg_form.Controllers
TestDbContext testDb = new TestDbContext();
string chinaname = user.chinaname;
var teamgame = await testDb.team_Games.FirstAsync(a => a.id == gameid);
var team_game = teamgame.commentary.Split(",").ToList();
team_game.Remove(chinaname);
teamgame.commentary = string.Join(",", team_game.ToArray());
if (teamgame.commentary=="")
{
teamgame.commentary = "待公布";
var com = JsonConvert.DeserializeObject<List<com_json>>(teamgame.commentary);
com.Remove(com.First(a => a.id == id.ToInt32()));
try{
user.Integral = cut_value((long)user.Integral);
await userManager.UpdateAsync(user);
}
catch{
return BadRequest(new error_mb { code = 400, message = $"你的金钱无法满足你完成以下操作" });
}
teamgame.commentary = JsonConvert.SerializeObject(com);
await testDb.SaveChangesAsync();
return "成功";
}
@ -125,12 +135,34 @@ namespace asg_form.Controllers
public async Task<ActionResult<string>> Search()
{
TestDbContext testDb = new TestDbContext();
var team= await testDb.team_Games.Select(a => new {a.id,a.commentary,a.opentime,a.team1_name,a.team2_name,a.belong}).ToListAsync();
var team = await testDb.team_Games.Select(a => new { a.id, a.commentary, a.opentime, a.team1_name, a.team2_name, a.belong }).ToListAsync();
var team1 = team.Where(a => a.commentary.Split(",").Length <= 1);
return JsonConvert.SerializeObject(team1);
return JsonConvert.SerializeObject(team1);
}
[Route("api/v1/com/Integral/ranking")]
[HttpPost]
[Authorize]
[ResponseCache(Duration = 60)]
public async Task<ActionResult<object>> ranking()
{
object user= await userManager.Users.OrderByDescending(a => a.Integral).Select(a=>new{a.Id,a.chinaname,a.Integral}).Take(10).ToListAsync();
return user;
}
public long cut_value(long value)
{
long _value = value;
value = value - 10;
if (value < 0)
{
throw new ArgumentException("你已经没钱啦!");
}
return value;
}
[Route("api/v1/com/")]
[HttpGet]
[Authorize]
@ -141,8 +173,8 @@ namespace asg_form.Controllers
if (user.officium == "Commentator")
{
var chinaname = user.chinaname;
TestDbContext testDb=new TestDbContext();
int a= await testDb.team_Games.CountAsync(a => a.commentary.IndexOf(chinaname) >= 0);
TestDbContext testDb = new TestDbContext();
int a = await testDb.team_Games.CountAsync(a => a.commentary.IndexOf(id) >= 0);
return a;
}
return BadRequest(new error_mb { code = 400, message = $"你是{user.officium},你不是解说,无法操作" });
@ -150,5 +182,5 @@ namespace asg_form.Controllers
}
}

View File

@ -1,5 +1,5 @@

using asg_form.Model;
using asg_form.Controllers.Store;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.DataEncryption;
@ -35,7 +35,7 @@ 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<T_events>(c => c.events).WithMany(a => a.forms).IsRequired();
builder.HasOne<Events.T_events>(c => c.events).WithMany(a => a.forms).IsRequired();
}
}
@ -52,7 +52,32 @@ namespace asg_form.Controllers
}
}
public static class QueryableExtensions
{
public static IQueryable<T> Paginate<T>(this IQueryable<T> query, int pageIndex, int pageSize)
{
return query.Skip(pageIndex * pageSize).Take(pageSize);
}
}
class STOREConfig : IEntityTypeConfiguration<StoreinfoDB>
{
public void Configure(EntityTypeBuilder<StoreinfoDB> builder)
{
builder.ToTable("T_Storeinfo");
builder.HasOne<StoreDB>(c => c.Store).WithMany(a => a.buyer).IsRequired();
}
}
class STORConfig : IEntityTypeConfiguration<StoreDB>
{
public void Configure(EntityTypeBuilder<StoreDB> builder)
{
builder.ToTable("T_Store");
}
}
class newsConfig : IEntityTypeConfiguration<T_news>
{
public void Configure(EntityTypeBuilder<T_news> builder)
@ -103,9 +128,9 @@ namespace asg_form.Controllers
builder.HasOne<schedule.team_game>(e => e.team).WithMany(o=>o.logs).IsRequired();
}
}
class EventsConfig : IEntityTypeConfiguration<T_events>
class EventsConfig : IEntityTypeConfiguration<Events.T_events>
{
public void Configure(EntityTypeBuilder<T_events> builder)
public void Configure(EntityTypeBuilder<Events.T_events> builder)
{
builder.ToTable("F_events");
builder.Property(e => e.Id).IsRequired();
@ -145,10 +170,22 @@ namespace asg_form.Controllers
}
}
class configConfig : IEntityTypeConfiguration<T_config>
{
public void Configure(EntityTypeBuilder<T_config> builder)
{
builder.ToTable("T_Config");
builder.Property(e => e.Id).IsRequired();
builder.Property(a => a.Title);
builder.Property(a => a.msg);
builder.Property(e => e.Substance);
}
}
class TestDbContext : DbContext
{
@ -159,11 +196,15 @@ namespace asg_form.Controllers
public DbSet<blog.blog_db> blogs { get; set; }
public DbSet<schedule.schedule_log> schlogs { get; set; }
public DbSet<schedule.team_game> team_Games { get; set; }
public DbSet<T_events> events { get; set; }
public DbSet<Events.T_events> events { get; set; }
public DbSet<Champion.T_Champion> Champions { get; set; }
public DbSet<comform.com_form> com_Forms { get; set; }
public DbSet<T_Friend> T_Friends { get; set; }
public DbSet<StoreDB> T_Store { get; set; }
public DbSet<StoreinfoDB> T_Storeinfo { get; set; }
public DbSet<T_config> T_config { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
string connStr = @"Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;TrustServerCertificate=true";
@ -178,6 +219,7 @@ namespace asg_form.Controllers
}
public class IDBcontext : IdentityDbContext<User, Role, long>
{
public DbSet<User> users { get; set; }

View File

@ -1,5 +1,4 @@
using asg_form.Model;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
@ -7,8 +6,7 @@ using static asg_form.Controllers.excel;
namespace asg_form.Controllers
{
public class Events:ControllerBase
public class Events : ControllerBase
{
private readonly RoleManager<Role> roleManager;
private readonly UserManager<User> userManager;
@ -25,16 +23,26 @@ namespace asg_form.Controllers
/// </summary>
/// <returns></returns>
// [Authorize]
[Route("api/v1/Events")]
[HttpGet]
// [ResponseCache(Duration = 260)]
public async Task<ActionResult<List<T_events>>> Getallevent()
// [ResponseCache(Duration = 260)]
public async Task<ActionResult<object>> Getallevent(bool get_poem = false)
{
TestDbContext testDbContext = new TestDbContext();
var Event= testDbContext.events.ToList();
return Event;
object Event = new object();
if (get_poem)
{
Event = testDbContext.events.Select(a => new { a.Id, a.is_over, a.opentime, a.name, a.promChart }).ToList();
}
else
{
Event = testDbContext.events.Select(a => new { a.Id, a.is_over, a.opentime, a.name }).ToList();
}
return Event;
}
/// <summary>
/// 发布新赛事
@ -43,16 +51,16 @@ namespace asg_form.Controllers
[Authorize]
[Route("api/v1/admin/Events")]
[HttpPost]
public async Task<ActionResult<List<T_events>>> Postevent(T_events events, [FromBody]string rule_markdown)
public async Task<ActionResult<List<T_events>>> Postevent([FromBody] events_get events)
{
TestDbContext testDbContext = new TestDbContext();
await testDbContext.events.AddAsync(new T_events { name = events.name, is_over = events.is_over, opentime = events.opentime ,events_rule_uri= new Uri($"https://124.223.35.239/doc/rule/{events.name}.md") });
await testDbContext.events.AddAsync(new T_events { name = events.name, is_over = events.is_over, opentime = events.opentime, events_rule_uri = new Uri($"https://124.223.35.239/doc/rule/{events.name}.md") });
System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + $"loge/{events.name}");
System.IO.File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory+ $"doc/rule/{events.name}.md", rule_markdown);
System.IO.File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + $"doc/rule/{events.name}.md", events.rule_markdown);
await testDbContext.SaveChangesAsync();
return Ok("添加成功!");
}
/// <summary>
@ -62,40 +70,40 @@ namespace asg_form.Controllers
[Authorize]
[Route("api/v1/admin/Events")]
[HttpPut]
public async Task<ActionResult<List<T_events>>> putevent(string event_name, [FromBody]T_events events)
public async Task<ActionResult<List<T_events>>> putevent(string event_name, [FromBody] T_events events)
{
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
TestDbContext testDb=new TestDbContext();
var eve= testDb.events.FirstOrDefault(a => a.name == event_name);
eve.name=events.name;
eve.opentime=events.opentime;
eve.is_over=events.is_over;
{
TestDbContext testDb = new TestDbContext();
var eve = testDb.events.FirstOrDefault(a => a.name == event_name);
eve.name = events.name;
eve.opentime = events.opentime;
eve.is_over = events.is_over;
await testDb.SaveChangesAsync();
return Ok(eve);
}
return BadRequest(new error_mb { code = 400, message = "没管理员改个P" });
}
}
/// <summary>
/// 删除新赛事
/// </summary>
/// <returns></returns>
[Authorize]
/// <summary>
/// 删除新赛事
/// </summary>
/// <returns></returns>
[Authorize]
[Route("api/v1/admin/Events")]
[HttpDelete]
public async Task<ActionResult<List<T_events>>> Delevent(string event_name)
{
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
TestDbContext test=new TestDbContext();
var evernt= test.events.FirstOrDefault(a => a.name == event_name);
TestDbContext test = new TestDbContext();
var evernt = test.events.FirstOrDefault(a => a.name == event_name);
test.Remove(evernt);
await test.SaveChangesAsync();
await test.SaveChangesAsync();
return Ok("删掉了呢");
}
else
@ -103,7 +111,7 @@ namespace asg_form.Controllers
return BadRequest(new error_mb { code = 400, message = "没P管理员隔着装尼玛呢" });
}
}
}
/// <summary>
/// 修改赛事
@ -112,7 +120,7 @@ namespace asg_form.Controllers
[Authorize]
[Route("api/v1/admin/Events_rule")]
[HttpDelete]
public async Task<ActionResult<List<T_events>>> event_rule(string event_name, [FromBody]string rule_markdown)
public async Task<ActionResult<List<T_events>>> event_rule(string event_name, [FromBody] string rule_markdown)
{
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
@ -129,7 +137,50 @@ namespace asg_form.Controllers
}
/// <summary>
/// 修改赛程图
/// </summary>
/// <returns></returns>
[Authorize]
[Route("api/v1/admin/poem")]
[HttpPost]
public async Task<ActionResult<List<T_events>>> event_poem(string event_name, [FromBody] string poem_json)
{
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
TestDbContext test = new TestDbContext();
var evernt = test.events.FirstOrDefault(a => a.name == event_name);
evernt.promChart = poem_json;
await test.SaveChangesAsync();
return Ok("修改了呢");
}
else
{
return BadRequest(new error_mb { code = 400, message = "没P管理员隔着装尼玛呢" });
}
}
}
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<form>? forms { get; set; }
public Uri? events_rule_uri { get; set; }
public string? promChart { get; set; }
}
public class events_get
{
public int Id { get; set; }
public string? name { get; set; }
public bool? is_over { get; set; }
public DateTime? opentime { get; set; }
public string rule_markdown { get; set; }
}
}
}

View File

@ -0,0 +1,25 @@
namespace asg_form.Controllers.Store
{
public class StoreDB
{
public long id { get; set; }
public string Name { get; set; }
public long Price { get; set; }
public string description { get; set; }
public string information { get; set; }
public string Type { get; set; }
public List<StoreinfoDB>? buyer { get; set; }=new List<StoreinfoDB>();
}
public class StoreinfoDB
{
public long id { get; set; }
public long buyerid { get; set; }
public StoreDB Store { get; set; }
public bool isVerification { get; set; }
}
}

View File

@ -0,0 +1,214 @@
using Masuit.Tools;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Security.Claims;
namespace asg_form.Controllers.Store
{
public class Storehttp : ControllerBase
{
private readonly RoleManager<Role> roleManager;
private readonly UserManager<User> userManager;
public Storehttp(
RoleManager<Role> roleManager, UserManager<User> userManager)
{
this.roleManager = roleManager;
this.userManager = userManager;
}
[Route("api/v1/admin/Store")]
[HttpPost]
[Authorize]
public async Task<ActionResult<object>> AddStore([FromBody]StoreDB storeinfo)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
using (TestDbContext sb = new TestDbContext()) {
sb.T_Store.Add(storeinfo);
await sb.SaveChangesAsync();
return Ok(storeinfo);
}
}
[Route("api/v1/admin/Store")]
[HttpDelete]
[Authorize]
public async Task<ActionResult<object>> DelStore(long id)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
using (TestDbContext sb = new TestDbContext())
{
sb.T_Store.Remove(sb.T_Store.Find(id));
await sb.SaveChangesAsync();
return Ok("ok");
}
}
[Route("api/v1/admin/Store")]
[HttpPut]
[Authorize]
public async Task<ActionResult<object>> putStore([FromBody] StoreDB storeinfo)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
using (TestDbContext sb = new TestDbContext())
{
var a= await sb.T_Store.FindAsync(storeinfo.id);
a.Name=storeinfo.Name;
a.description=storeinfo.description;
a.information=storeinfo.information;
a.Price=storeinfo.Price;
await sb.SaveChangesAsync();
return Ok(storeinfo);
}
}
public long cut_value(long value,long money)
{
long _value = value;
value = value - money;
if (value < 0)
{
throw new ArgumentException("你已经没钱啦!");
}
return value;
}
[Route("api/v1/Store")]
[HttpGet]
[Authorize]
public async Task<ActionResult<object>> GetStore()
{
using (TestDbContext sb = new TestDbContext())
{
var a= sb.T_Store.ToList();
return Ok(a);
}
}
[Route("api/v1/Store/Verification")]
[HttpGet]
[Authorize]
public async Task<ActionResult<object>> Verification(long storeinfoid)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
using (TestDbContext sb = new TestDbContext())
{
var a = sb.T_Storeinfo.Find(storeinfoid);
a.isVerification = true;
await sb.SaveChangesAsync();
return Ok(a);
}
}
/// <summary>
///
/// </summary>
/// <param name="search"></param>
/// <param name="pageindex"></param>
/// <param name="pagesize"></param>
/// <param name="showVerification">是否展示以及核销过的</param>
/// <returns></returns>
[Route("api/v1/admin/Storeinfo")]
[HttpGet]
[Authorize]
public async Task<ActionResult<object>> GetStoreinfo(bool showVerification,long? search_id,int pageindex=0,int pagesize=10)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
using (TestDbContext sb = new TestDbContext())
{
var a = new all_record();
IQueryable<StoreinfoDB> b;
if (showVerification)
{
b = sb.T_Storeinfo.Include(a=>a.Store);
}
else
{
b = sb.T_Storeinfo.Include(a => a.Store).Where(a => a.isVerification == false);
}
if (search_id == null)
{
a.cout = b.Count();
a.msg = await b.Paginate(pageindex, pagesize).Select(a => new { a.id, a.buyerid, a.Store.Price, a.Store.description, a.isVerification, a.Store.information, a.Store.Name }).ToListAsync();
}
else
{
a.cout = b.Where(a => a.buyerid == search_id).Count();
a.msg = await b.Where(a => a.buyerid == search_id).Paginate(pageindex, pagesize).Select(a => new { a.id, a.buyerid, a.Store.Price, a.Store.description, a.isVerification, a.Store.information, a.Store.Name }).ToListAsync();
}
return Ok(a);
}
}
public record buyreq_record(bool iserror, string msg);
public record all_record()
{
public long? cout { get; set; }
public object msg { get; set; }
}
[Route("api/v1/Store/Buy")]
[HttpPost]
[Authorize]
public async Task<ActionResult<object>> BuyStore([FromBody]long[] storeid)
{
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var user = await userManager.FindByIdAsync(id);
if (user.officium != "Commentator")
{
return BadRequest(new error_mb { code = 400, message = $"你是{user.officium},你不是解说,无法操作" });
}
using (TestDbContext sb = new TestDbContext())
{
List<buyreq_record> bureq = new List<buyreq_record>();
foreach (var item in storeid)
{
var stort = await sb.T_Store.FindAsync(item);
try
{
user.Integral = cut_value((long)user.Integral, stort.Price);
await userManager.UpdateAsync(user);
await sb.T_Storeinfo.AddAsync(new StoreinfoDB { buyerid = id.ToInt64(), Store = stort });
await sb.SaveChangesAsync();
bureq.Add(new buyreq_record(false, $"购买{stort.Name}成功"));
}
catch
{
bureq.Add(new buyreq_record(true, $"购买失败,因为余额不足"));
}
}
return Ok(bureq);
}
}
}
}

View File

@ -21,6 +21,9 @@ using MimeKit;
using MailKit.Net.Smtp;
using Mirai.Net.Utils.Scaffolds;
using Mirai.Net.Sessions.Http.Managers;
using asg_form.Controllers.Store;
using NPOI.SS.Formula.Functions;
using static asg_form.Controllers.Store.Storehttp;
namespace asg_form.Controllers
{
@ -90,7 +93,17 @@ namespace asg_form.Controllers
return Ok("Image file uploaded successfully.");
}
[Route("api/v1/admin/dbgu")]
[HttpPost]
public async Task<ActionResult<object>> dbgu()
{
using(TestDbContext db=new TestDbContext())
{
await db.Database.MigrateAsync();
}
return Ok("successfully.");
}
[Route("api/v1/admin/Privacy_Policy")]
[HttpPost]
@ -205,11 +218,24 @@ else{
}
[Route("api/v1/admin/userfind/{userid}")]
[HttpGet]
[Authorize]
public async Task<ActionResult<object>> getuser(long userid)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
return await userManager.Users.Select(a => new { a.Id, a.Email, a.chinaname, a.UserName, a.Integral, a.officium }).FirstAsync(a=>a.Id==userid);
}
/// <summary>
/// 获取所有用户-支持分页(整合api:allperson_c)
@ -221,55 +247,24 @@ else{
[Route("api/v2/admin/allperson")]
[HttpGet]
[Authorize]
public async Task<ActionResult<post_user_v2>> getalladmin_v2(string? keyword, short page, short page_long = 10)
public async Task<ActionResult<post_user_v2>> getalladmin_v2(string? keyword, short pageindex=1, short pagesize = 10)
{
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
List<User> users = new List<User>();
post_user_v2 user = new post_user_v2();
var a = new all_record();
if (keyword == null)
{
int a = userManager.Users.Count();
user.Count = a;
int b = page_long * page;
if (page_long * page > a)
{
b = a;
}
users = userManager.Users.Skip(page_long * page - page_long).Take(page_long).ToList();
a.cout = userManager.Users.Count();
a.msg = await userManager.Users.Paginate(pageindex, pagesize).Select(a => new {a.Id,a.Email,a.chinaname,a.UserName,a.Integral,a.officium}).ToListAsync();
}
else
{
int a = userManager.Users.Where(a => a.UserName.IndexOf(keyword) >= 0 || a.chinaname.IndexOf(keyword) >= 0 || a.Email.IndexOf(keyword) >= 0).Count();
user.Count = a;
int b = page_long * page;
if (page_long * page > a)
{
b = a;
}
users = userManager.Users.Where(a => a.UserName.IndexOf(keyword) >= 0 || a.chinaname.IndexOf(keyword) >= 0 || a.Email.IndexOf(keyword) >= 0).Skip(page_long * page - page_long).Take(page_long).ToList();
a.cout = userManager.Users.Where(a=>a.chinaname==keyword||a.UserName==keyword||a.Email==keyword).Count();
a.msg = await userManager.Users.Where(a => a.chinaname == keyword || a.UserName == keyword || a.Email == keyword).Paginate(pageindex, pagesize).Select(a => new { a.Id, a.Email, a.chinaname, a.UserName, a.Integral, a.officium }).ToListAsync();
}
foreach (var auser in users)
{
bool isadmin = await userManager.IsInRoleAsync(auser, "admin");
var roles = await userManager.GetRolesAsync(auser);
try
{
// user.user.Add(new post_user { id = auser.Id, chinaname = auser.chinaname, name = auser.UserName, isadmin = isadmin, email = auser.Email, Roles = (List<string>)roles, officium = auser.officium, Integral = auser.Integral });
}
catch
{
}
}
return user;
return Ok(a);
}
else

View File

@ -0,0 +1,129 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace asg_form.Controllers;
public class T_config
{
public int Id { set; get; }
public string Title{ set; get; }
public string Substance{ set; get;}
public string? msg{ set; get; }
}
[ApiController]
[Route("api/[controller]")]
public class config : ControllerBase
{
[Route("api/v1/admin/config")]
[HttpPost]
[Authorize]
public async Task<ActionResult<object>> config_post([FromBody] T_config config)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
using(TestDbContext db=new TestDbContext()){
var config__ = db.T_config.FirstOrDefault(a => a.Id == config.Id);
if (config__==null)
{
db.T_config.Add(config);
await db.SaveChangesAsync();
}
else
{
var config_ = db.T_config.FirstOrDefault(a => a.Id == config.Id);
config_.msg=config.msg;
config_.Substance = config.Substance;
config_.Title = config.Title;
await db.SaveChangesAsync();
}
}
return Ok("添加成功!");
}
[Route("api/v1/admin/config/byTitle")]
[HttpPost]
[Authorize]
public async Task<ActionResult<object>> config_get_title([FromBody] string title)
{
using (TestDbContext db = new TestDbContext())
{
var config = db.T_config.FirstOrDefault(a => a.Title == title);
return Ok(config.Substance);
}
}
[Route("api/v1/admin/config")]
[HttpDelete]
[Authorize]
public async Task<ActionResult<object>> config_get_title(int Id)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
using (TestDbContext db = new TestDbContext())
{
var config = db.T_config.FirstOrDefault(a => a.Id==Id);
db.Remove(config);
await db.SaveChangesAsync();
return Ok("成功!");
}
}
[Route("api/v1/admin/config/all")]
[HttpGet]
[Authorize]
public async Task<ActionResult<object>> config_get_all(short page, short page_long = 10)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
return BadRequest(new error_mb { code = 400, message = "无权访问" });
}
using (TestDbContext db = new TestDbContext())
{
int a = db.T_config.Count();
int b = page_long * page;
if (page_long * page > a)
{
b = a;
}
object config = db.T_config.Skip(page_long * page - page_long).Take(page_long).ToList();
return Ok(config);
}
}
}

View File

@ -1,6 +1,7 @@
using System.Security.Cryptography;
using System.Runtime.InteropServices.ComTypes;
using asg_form.Controllers.Hubs;
using asg_form.Model;
using Manganese.Text;
using Masuit.Tools;
using Masuit.Tools.Win32.AntiVirus;
@ -21,6 +22,7 @@ using System.Text;
using System.Web;
using static asg_form.Controllers.excel;
using static ;
using Manganese.Array;
namespace asg_form.Controllers
{
@ -162,7 +164,7 @@ namespace asg_form.Controllers
}
/// <summary>
/// <summary>
/// 提交表单
/// </summary>
/// <param name="for1">表单信息</param>
@ -244,6 +246,81 @@ namespace asg_form.Controllers
/// <summary>
/// 提交表单
/// </summary>
/// <param name="imageFile"></param>
/// <param name="for1">表单信息</param>
/// <param name="captoken">谷歌人机验证验证码</param>
/// <returns></returns>
[Route("api/v2/form/")]
[HttpPost]
public async Task<ActionResult<string>> PostAsync(IFormFile imageFile,[FromForm] form_get_new for1)
{
TestDbContext ctx = new TestDbContext();
if (ctx.Forms.Include(a=>a.events).Where(a=>a.events.name==for1.events_name).Any(e => e.team_name == for1.team_name))
{
return BadRequest(new error_mb { code = 400, message = "有重名队伍" });
}
else
{
if (imageFile == null || imageFile.Length == 0)
return BadRequest("Invalid image file.");
// 将文件保存到磁盘
var filePath = Path.Combine(Directory.GetCurrentDirectory(), $"loge/{for1.events_name}/", $"{imageFile.FileName}");
using (var stream = new FileStream(filePath, FileMode.Create))
{
await imageFile.CopyToAsync(stream);
} // 返回成功响应
// base64toimg(for1.logo_base64, $@"{AppDomain.CurrentDomain.BaseDirectory}loge\{for1.events_name}\{for1.team_name}.png");
var events= await ctx.events.FirstAsync(ctx => ctx.name == for1.events_name);
form form1 = new form();
form1.logo_uri = $"https://124.223.35.239/loge/{for1.events_name}/{for1.team_name}.png";
form1.team_name = for1.team_name;
form1.team_password = for1.team_password;
form1.team_tel = for1.team_tel;
form1.events = events;
List<role> role = new List<role>();
foreach (role_get a in for1.role_get)
{
role.Add(new role { role_id = a.role_id, role_lin = a.role_lin, role_name = a.role_name,Common_Roles=a.Common_Roles,Historical_Ranks=a.Historical_Ranks,Id_Card=a.Id_Card,Game_Name=a.Game_Name,Phone_Number=a.Phone_Number,Id_Card_Name=a.Id_Card_Name });
}
form1.role = role;
ctx.Forms.Add(form1);
await ctx.SaveChangesAsync();
int nownumber = ctx.Forms.Count();
//ChatRoomHub chat = new ChatRoomHub();
// await chat.formok(nownumber, for1.team_name);
try
{
await hubContext.Clients.All.SendAsync("formok", $"队伍{for1.team_name}已经成功报名,剩余队伍名额:{ctx.Forms.Count()}/32");
}
catch
{
}
logger.Info($"有新队伍报名!队伍名称:{for1.team_name} ");
}
return "ok!";
}
public void base64toimg(string base64,string path)
{
@ -394,6 +471,7 @@ namespace asg_form.Controllers
public async Task<ActionResult<List<string>>> search_name(string team_name,string events_name)
{
var ctx = new TestDbContext();
var data = ctx.Forms.Where(a => a.team_name.IndexOf(team_name) >= 0&&a.events.name==events_name).Select(a => a.team_name).ToList();
return data;
}
@ -440,7 +518,8 @@ namespace asg_form.Controllers
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 Events.T_events events { get; set; }
// public string? belong { get; set; }
public List<role> role { get; set; } = new List<role>();
}
@ -448,11 +527,24 @@ namespace asg_form.Controllers
public class form_get
{
// 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_base64 { get; set; }
public string events_name { get; set; }
// public string? belong { get; set; }
public List<role_get> role_get { get; set; }
}
public class form_get_new
{
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_base64 { get; set; }
// public string logo_base64 { get; set; }
public string events_name { get; set; }
// public string? belong { get; set; }
public List<role_get> role_get { get; set; }
@ -465,7 +557,7 @@ namespace asg_form.Controllers
{
public long Id { get; set; }
public string team_name { get; set; }
public string Team_name { get; set; }
public string team_password { get; set; }
public string team_tel { get; set; }

View File

@ -259,13 +259,20 @@ namespace asg_form.Controllers
[Authorize]
[Route("api/v1/user/")]
[HttpGet]
public async Task<ActionResult<post_user>> getuser()
public async Task<ActionResult<post_user>> getuser(bool showbase64=true)
{
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var user = await userManager.FindByIdAsync(id);
var isadmin = await userManager.IsInRoleAsync(user, "admin");
List<string> roles = (List<string>)await userManager.GetRolesAsync(user);
return new post_user { id = id.ToInt64(), Base64 = user.UserBase64, name = user.UserName, chinaname = user.chinaname, email = user.Email, isadmin = isadmin, Roles = roles, officium = user.officium };
if (showbase64) {
return new post_user { id = id.ToInt64(), money = user.Integral, Base64 = user.UserBase64, name = user.UserName, chinaname = user.chinaname, email = user.Email, isadmin = isadmin, Roles = roles, officium = user.officium };
}
else
{
return new post_user { id = id.ToInt64(), money = user.Integral, name = user.UserName, chinaname = user.chinaname, email = user.Email, isadmin = isadmin, Roles = roles, officium = user.officium };
}
}
@ -279,6 +286,7 @@ namespace asg_form.Controllers
public string? email { get; set; }
public bool isadmin { get; set; }
public string? officium { get; set; }
public long? money { get; set; }
public List<string>? Roles { get; set; }

View File

@ -120,9 +120,51 @@ namespace asg_form.Controllers
}
/// <summary>
/// 修改新闻
/// </summary>
/// <param name="req_News">新闻内容</param>
/// <returns></returns>
[Authorize]
[Route("api/v1/admin/news/")]
[HttpPut]
public async Task<ActionResult<string>> Put([FromBody] req_news req_News,long newsid)
{
string id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
var user = await userManager.FindByIdAsync(id);
bool a = await userManager.IsInRoleAsync(user, "admin");
if (a)
{
using (TestDbContext ctx = new TestDbContext())
{
var qwq= await ctx.news.FindAsync(newsid);
qwq.msg=req_News.msg;
qwq.Title=req_News.Title;
qwq.FormName = user.UserName;
await ctx.SaveChangesAsync();
}
return "ok!";
}
else
{
return "无权访问";
}
}
}
public class T_news
}
public class T_news
{
public long Id { get; set; }
public string Title { get; set; }
@ -144,4 +186,3 @@ namespace asg_form.Controllers
}
}

View File

@ -0,0 +1,818 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using asg_form.Controllers;
#nullable disable
namespace asg_form.Migrations
{
[DbContext(typeof(IDBcontext))]
[Migration("20240810113800_stort")]
partial class stort
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<long>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<long>("RoleId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<long>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<long>("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<long>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<long>("UserId")
.HasColumnType("bigint");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<long>", b =>
{
b.Property<long>("UserId")
.HasColumnType("bigint");
b.Property<long>("RoleId")
.HasColumnType("bigint");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<long>", b =>
{
b.Property<long>("UserId")
.HasColumnType("bigint");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<int>("eventsId")
.HasColumnType("int");
b.Property<long>("formId")
.HasColumnType("bigint");
b.Property<string>("msg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("eventsId");
b.HasIndex("formId");
b.ToTable("F_Champion", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<long>("Price")
.HasColumnType("bigint");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("information")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("id");
b.ToTable("StoreDB");
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreinfoDB", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("Storeid")
.HasColumnType("bigint");
b.Property<long>("buyerid")
.HasColumnType("bigint");
b.Property<bool>("isVerification")
.HasColumnType("bit");
b.HasKey("id");
b.HasIndex("Storeid");
b.ToTable("F_Store", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.T_Friend", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<string>("account")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("comMsg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("comTime")
.HasColumnType("datetime2");
b.Property<string>("comType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("degree")
.HasColumnType("int");
b.Property<string>("headName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("headTel")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("orgName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("id");
b.ToTable("F_Friend", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.T_news", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("FormName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("msg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("time")
.IsRequired()
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("F_news", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.comform+com_form", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("Com_Cocial_media")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Com_Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Com_qq")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("idv_id")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("introduction")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("F_ComForm", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.form", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<int>("eventsId")
.HasColumnType("int");
b.Property<string>("logo_uri")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("piaoshu")
.HasColumnType("int");
b.Property<string>("team_name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("team_password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("team_tel")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("time")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("eventsId");
b.ToTable("F_form", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.role", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("Common_Roles")
.HasColumnType("nvarchar(max)");
b.Property<string>("Game_Name")
.HasColumnType("nvarchar(max)");
b.Property<int?>("Historical_Ranks")
.HasColumnType("int");
b.Property<string>("Id_Card")
.HasColumnType("nvarchar(max)");
b.Property<string>("Id_Card_Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("Phone_Number")
.HasColumnType("nvarchar(max)");
b.Property<long>("formId")
.HasColumnType("bigint");
b.Property<string>("role_id")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("role_lin")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("role_name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("formId");
b.ToTable("F_role", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.schedule+schedule_log", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("chickteam")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<long>("teamid")
.HasColumnType("bigint");
b.Property<string>("userid")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool?>("win")
.HasColumnType("bit");
b.HasKey("Id");
b.HasIndex("teamid");
b.ToTable("F_achlog", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.schedule+team_game", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<string>("belong")
.HasColumnType("nvarchar(max)");
b.Property<string>("bilibiliuri")
.HasColumnType("nvarchar(max)");
b.Property<string>("commentary")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("opentime")
.HasColumnType("datetime2");
b.Property<string>("referee")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("tag")
.HasColumnType("nvarchar(max)");
b.Property<string>("team1_name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("team1_piaoshu")
.HasColumnType("int");
b.Property<string>("team2_name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("team2_piaoshu")
.HasColumnType("int");
b.Property<string>("winteam")
.HasColumnType("nvarchar(max)");
b.HasKey("id");
b.ToTable("F_game", (string)null);
});
modelBuilder.Entity("asg_form.Model.T_events", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("events_rule_uri")
.HasColumnType("nvarchar(max)");
b.Property<bool?>("is_over")
.HasColumnType("bit");
b.Property<string>("name")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("opentime")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("F_events", (string)null);
});
modelBuilder.Entity("asg_form.Role", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("msg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("asg_form.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<long?>("Integral")
.HasColumnType("bigint");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserBase64")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("chinaname")
.HasColumnType("nvarchar(max)");
b.Property<long?>("haveformId")
.HasColumnType("bigint");
b.Property<bool?>("isbooking")
.HasColumnType("bit");
b.Property<string>("officium")
.HasColumnType("nvarchar(max)");
b.Property<int>("point")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.HasIndex("haveformId");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("asg_form.blog+blog_db", b =>
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("ID"));
b.Property<string>("formuser")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("msg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("pushtime")
.HasColumnType("datetime2");
b.Property<string>("title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("ID");
b.ToTable("F_blog", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<long>", b =>
{
b.HasOne("asg_form.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<long>", b =>
{
b.HasOne("asg_form.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<long>", b =>
{
b.HasOne("asg_form.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<long>", b =>
{
b.HasOne("asg_form.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("asg_form.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<long>", b =>
{
b.HasOne("asg_form.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b =>
{
b.HasOne("asg_form.Model.T_events", "events")
.WithMany()
.HasForeignKey("eventsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("asg_form.Controllers.form", "form")
.WithMany()
.HasForeignKey("formId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("events");
b.Navigation("form");
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreinfoDB", b =>
{
b.HasOne("asg_form.Controllers.Store.StoreDB", "Store")
.WithMany("buyer")
.HasForeignKey("Storeid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Store");
});
modelBuilder.Entity("asg_form.Controllers.form", b =>
{
b.HasOne("asg_form.Model.T_events", "events")
.WithMany("forms")
.HasForeignKey("eventsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("events");
});
modelBuilder.Entity("asg_form.Controllers.role", b =>
{
b.HasOne("asg_form.Controllers.form", "form")
.WithMany("role")
.HasForeignKey("formId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("form");
});
modelBuilder.Entity("asg_form.Controllers.schedule+schedule_log", b =>
{
b.HasOne("asg_form.Controllers.schedule+team_game", "team")
.WithMany("logs")
.HasForeignKey("teamid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("team");
});
modelBuilder.Entity("asg_form.User", b =>
{
b.HasOne("asg_form.Controllers.form", "haveform")
.WithMany()
.HasForeignKey("haveformId");
b.Navigation("haveform");
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b =>
{
b.Navigation("buyer");
});
modelBuilder.Entity("asg_form.Controllers.form", b =>
{
b.Navigation("role");
});
modelBuilder.Entity("asg_form.Controllers.schedule+team_game", b =>
{
b.Navigation("logs");
});
modelBuilder.Entity("asg_form.Model.T_events", b =>
{
b.Navigation("forms");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,88 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace asg_form.Migrations
{
/// <inheritdoc />
public partial class stort : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "Integral",
table: "AspNetUsers",
type: "bigint",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "point",
table: "AspNetUsers",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "StoreDB",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<long>(type: "bigint", nullable: false),
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
information = table.Column<string>(type: "nvarchar(max)", nullable: false),
Type = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StoreDB", x => x.id);
});
migrationBuilder.CreateTable(
name: "F_Store",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
buyerid = table.Column<long>(type: "bigint", nullable: false),
Storeid = table.Column<long>(type: "bigint", nullable: false),
isVerification = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_F_Store", x => x.id);
table.ForeignKey(
name: "FK_F_Store_StoreDB_Storeid",
column: x => x.Storeid,
principalTable: "StoreDB",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_F_Store_Storeid",
table: "F_Store",
column: "Storeid");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "F_Store");
migrationBuilder.DropTable(
name: "StoreDB");
migrationBuilder.DropColumn(
name: "Integral",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "point",
table: "AspNetUsers");
}
}
}

View File

@ -0,0 +1,818 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using asg_form.Controllers;
#nullable disable
namespace asg_form.Migrations
{
[DbContext(typeof(IDBcontext))]
[Migration("20240810122803_newstore")]
partial class newstore
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<long>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<long>("RoleId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<long>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<long>("UserId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<long>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<long>("UserId")
.HasColumnType("bigint");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<long>", b =>
{
b.Property<long>("UserId")
.HasColumnType("bigint");
b.Property<long>("RoleId")
.HasColumnType("bigint");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<long>", b =>
{
b.Property<long>("UserId")
.HasColumnType("bigint");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<int>("eventsId")
.HasColumnType("int");
b.Property<long>("formId")
.HasColumnType("bigint");
b.Property<string>("msg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("eventsId");
b.HasIndex("formId");
b.ToTable("F_Champion", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<long>("Price")
.HasColumnType("bigint");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("information")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("id");
b.ToTable("T_Store", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreinfoDB", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("Storeid")
.HasColumnType("bigint");
b.Property<long>("buyerid")
.HasColumnType("bigint");
b.Property<bool>("isVerification")
.HasColumnType("bit");
b.HasKey("id");
b.HasIndex("Storeid");
b.ToTable("T_Storeinfo", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.T_Friend", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<string>("account")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("comMsg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("comTime")
.HasColumnType("datetime2");
b.Property<string>("comType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("degree")
.HasColumnType("int");
b.Property<string>("headName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("headTel")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("orgName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("id");
b.ToTable("F_Friend", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.T_news", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("FormName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("msg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("time")
.IsRequired()
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("F_news", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.comform+com_form", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("Com_Cocial_media")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Com_Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Com_qq")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("idv_id")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("introduction")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("F_ComForm", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.form", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<int>("eventsId")
.HasColumnType("int");
b.Property<string>("logo_uri")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("piaoshu")
.HasColumnType("int");
b.Property<string>("team_name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("team_password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("team_tel")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("time")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("eventsId");
b.ToTable("F_form", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.role", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("Common_Roles")
.HasColumnType("nvarchar(max)");
b.Property<string>("Game_Name")
.HasColumnType("nvarchar(max)");
b.Property<int?>("Historical_Ranks")
.HasColumnType("int");
b.Property<string>("Id_Card")
.HasColumnType("nvarchar(max)");
b.Property<string>("Id_Card_Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("Phone_Number")
.HasColumnType("nvarchar(max)");
b.Property<long>("formId")
.HasColumnType("bigint");
b.Property<string>("role_id")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("role_lin")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("role_name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("formId");
b.ToTable("F_role", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.schedule+schedule_log", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("chickteam")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<long>("teamid")
.HasColumnType("bigint");
b.Property<string>("userid")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool?>("win")
.HasColumnType("bit");
b.HasKey("Id");
b.HasIndex("teamid");
b.ToTable("F_achlog", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.schedule+team_game", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<string>("belong")
.HasColumnType("nvarchar(max)");
b.Property<string>("bilibiliuri")
.HasColumnType("nvarchar(max)");
b.Property<string>("commentary")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("opentime")
.HasColumnType("datetime2");
b.Property<string>("referee")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("tag")
.HasColumnType("nvarchar(max)");
b.Property<string>("team1_name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("team1_piaoshu")
.HasColumnType("int");
b.Property<string>("team2_name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("team2_piaoshu")
.HasColumnType("int");
b.Property<string>("winteam")
.HasColumnType("nvarchar(max)");
b.HasKey("id");
b.ToTable("F_game", (string)null);
});
modelBuilder.Entity("asg_form.Model.T_events", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("events_rule_uri")
.HasColumnType("nvarchar(max)");
b.Property<bool?>("is_over")
.HasColumnType("bit");
b.Property<string>("name")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("opentime")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("F_events", (string)null);
});
modelBuilder.Entity("asg_form.Role", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("msg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("asg_form.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<long?>("Integral")
.HasColumnType("bigint");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserBase64")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("chinaname")
.HasColumnType("nvarchar(max)");
b.Property<long?>("haveformId")
.HasColumnType("bigint");
b.Property<bool?>("isbooking")
.HasColumnType("bit");
b.Property<string>("officium")
.HasColumnType("nvarchar(max)");
b.Property<int>("point")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.HasIndex("haveformId");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("asg_form.blog+blog_db", b =>
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("ID"));
b.Property<string>("formuser")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("msg")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("pushtime")
.HasColumnType("datetime2");
b.Property<string>("title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("ID");
b.ToTable("F_blog", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<long>", b =>
{
b.HasOne("asg_form.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<long>", b =>
{
b.HasOne("asg_form.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<long>", b =>
{
b.HasOne("asg_form.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<long>", b =>
{
b.HasOne("asg_form.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("asg_form.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<long>", b =>
{
b.HasOne("asg_form.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b =>
{
b.HasOne("asg_form.Model.T_events", "events")
.WithMany()
.HasForeignKey("eventsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("asg_form.Controllers.form", "form")
.WithMany()
.HasForeignKey("formId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("events");
b.Navigation("form");
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreinfoDB", b =>
{
b.HasOne("asg_form.Controllers.Store.StoreDB", "Store")
.WithMany("buyer")
.HasForeignKey("Storeid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Store");
});
modelBuilder.Entity("asg_form.Controllers.form", b =>
{
b.HasOne("asg_form.Model.T_events", "events")
.WithMany("forms")
.HasForeignKey("eventsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("events");
});
modelBuilder.Entity("asg_form.Controllers.role", b =>
{
b.HasOne("asg_form.Controllers.form", "form")
.WithMany("role")
.HasForeignKey("formId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("form");
});
modelBuilder.Entity("asg_form.Controllers.schedule+schedule_log", b =>
{
b.HasOne("asg_form.Controllers.schedule+team_game", "team")
.WithMany("logs")
.HasForeignKey("teamid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("team");
});
modelBuilder.Entity("asg_form.User", b =>
{
b.HasOne("asg_form.Controllers.form", "haveform")
.WithMany()
.HasForeignKey("haveformId");
b.Navigation("haveform");
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b =>
{
b.Navigation("buyer");
});
modelBuilder.Entity("asg_form.Controllers.form", b =>
{
b.Navigation("role");
});
modelBuilder.Entity("asg_form.Controllers.schedule+team_game", b =>
{
b.Navigation("logs");
});
modelBuilder.Entity("asg_form.Model.T_events", b =>
{
b.Navigation("forms");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,104 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace asg_form.Migrations
{
/// <inheritdoc />
public partial class newstore : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_F_Store_StoreDB_Storeid",
table: "F_Store");
migrationBuilder.DropPrimaryKey(
name: "PK_StoreDB",
table: "StoreDB");
migrationBuilder.DropPrimaryKey(
name: "PK_F_Store",
table: "F_Store");
migrationBuilder.RenameTable(
name: "StoreDB",
newName: "T_Store");
migrationBuilder.RenameTable(
name: "F_Store",
newName: "T_Storeinfo");
migrationBuilder.RenameIndex(
name: "IX_F_Store_Storeid",
table: "T_Storeinfo",
newName: "IX_T_Storeinfo_Storeid");
migrationBuilder.AddPrimaryKey(
name: "PK_T_Store",
table: "T_Store",
column: "id");
migrationBuilder.AddPrimaryKey(
name: "PK_T_Storeinfo",
table: "T_Storeinfo",
column: "id");
migrationBuilder.AddForeignKey(
name: "FK_T_Storeinfo_T_Store_Storeid",
table: "T_Storeinfo",
column: "Storeid",
principalTable: "T_Store",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_T_Storeinfo_T_Store_Storeid",
table: "T_Storeinfo");
migrationBuilder.DropPrimaryKey(
name: "PK_T_Storeinfo",
table: "T_Storeinfo");
migrationBuilder.DropPrimaryKey(
name: "PK_T_Store",
table: "T_Store");
migrationBuilder.RenameTable(
name: "T_Storeinfo",
newName: "F_Store");
migrationBuilder.RenameTable(
name: "T_Store",
newName: "StoreDB");
migrationBuilder.RenameIndex(
name: "IX_T_Storeinfo_Storeid",
table: "F_Store",
newName: "IX_F_Store_Storeid");
migrationBuilder.AddPrimaryKey(
name: "PK_F_Store",
table: "F_Store",
column: "id");
migrationBuilder.AddPrimaryKey(
name: "PK_StoreDB",
table: "StoreDB",
column: "id");
migrationBuilder.AddForeignKey(
name: "FK_F_Store_StoreDB_Storeid",
table: "F_Store",
column: "Storeid",
principalTable: "StoreDB",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -152,29 +152,60 @@ namespace asg_form.Migrations
b.ToTable("F_Champion", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.Events+T_events", b =>
modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b =>
{
b.Property<int>("Id")
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<string>("events_rule_uri")
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool?>("is_over")
b.Property<long>("Price")
.HasColumnType("bigint");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("information")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("id");
b.ToTable("T_Store", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreinfoDB", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("Storeid")
.HasColumnType("bigint");
b.Property<long>("buyerid")
.HasColumnType("bigint");
b.Property<bool>("isVerification")
.HasColumnType("bit");
b.Property<string>("name")
.HasColumnType("nvarchar(max)");
b.HasKey("id");
b.Property<DateTime?>("opentime")
.HasColumnType("datetime2");
b.HasIndex("Storeid");
b.HasKey("Id");
b.ToTable("F_events", (string)null);
b.ToTable("T_Storeinfo", (string)null);
});
modelBuilder.Entity("asg_form.Controllers.T_Friend", b =>
@ -455,6 +486,31 @@ namespace asg_form.Migrations
b.ToTable("F_game", (string)null);
});
modelBuilder.Entity("asg_form.Model.T_events", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("events_rule_uri")
.HasColumnType("nvarchar(max)");
b.Property<bool?>("is_over")
.HasColumnType("bit");
b.Property<string>("name")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("opentime")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("F_events", (string)null);
});
modelBuilder.Entity("asg_form.Role", b =>
{
b.Property<long>("Id")
@ -514,6 +570,9 @@ namespace asg_form.Migrations
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<long?>("Integral")
.HasColumnType("bigint");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
@ -562,6 +621,9 @@ namespace asg_form.Migrations
b.Property<string>("officium")
.HasColumnType("nvarchar(max)");
b.Property<int>("point")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
@ -658,7 +720,7 @@ namespace asg_form.Migrations
modelBuilder.Entity("asg_form.Controllers.Champion+T_Champion", b =>
{
b.HasOne("asg_form.Controllers.Events+T_events", "events")
b.HasOne("asg_form.Model.T_events", "events")
.WithMany()
.HasForeignKey("eventsId")
.OnDelete(DeleteBehavior.Cascade)
@ -675,9 +737,20 @@ namespace asg_form.Migrations
b.Navigation("form");
});
modelBuilder.Entity("asg_form.Controllers.Store.StoreinfoDB", b =>
{
b.HasOne("asg_form.Controllers.Store.StoreDB", "Store")
.WithMany("buyer")
.HasForeignKey("Storeid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Store");
});
modelBuilder.Entity("asg_form.Controllers.form", b =>
{
b.HasOne("asg_form.Controllers.Events+T_events", "events")
b.HasOne("asg_form.Model.T_events", "events")
.WithMany("forms")
.HasForeignKey("eventsId")
.OnDelete(DeleteBehavior.Cascade)
@ -717,9 +790,9 @@ namespace asg_form.Migrations
b.Navigation("haveform");
});
modelBuilder.Entity("asg_form.Controllers.Events+T_events", b =>
modelBuilder.Entity("asg_form.Controllers.Store.StoreDB", b =>
{
b.Navigation("forms");
b.Navigation("buyer");
});
modelBuilder.Entity("asg_form.Controllers.form", b =>
@ -731,6 +804,11 @@ namespace asg_form.Migrations
{
b.Navigation("logs");
});
modelBuilder.Entity("asg_form.Model.T_events", b =>
{
b.Navigation("forms");
});
#pragma warning restore 612, 618
}
}

View File

@ -1,16 +0,0 @@
using asg_form.Controllers;
namespace asg_form.Model
{
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<form>? forms { get; set; }
public Uri? events_rule_uri { get; set; }
}
}

View File

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Mirai.Net.Sessions;
@ -21,7 +22,7 @@ using System.Text;
Console.WriteLine("\n _____ _________ ________ \n / _ \\ / _____// _____/ \n / /_\\ \\ \\_____ \\/ \\ ___ \n/ | \\/ \\ \\_\\ \\\n\\____|__ /_______ /\\______ /\n \\/ \\/ \\/ \n__________ __ ___________ .___\n\\______ \\_____ ____ | | __\\_ _____/ ____ __| _/\n | | _/\\__ \\ _/ ___\\| |/ / | __)_ / \\ / __ | \n | | \\ / __ \\\\ \\___| < | \\ | \\/ /_/ | \n |______ /(____ /\\___ >__|_ \\/_______ /___| /\\____ | \n \\/ \\/ \\/ \\/ \\/ \\/ \\/ ");
var builder = WebApplication.CreateBuilder(args);
//builder.AddServiceDefaults();
builder.AddServiceDefaults();
// Add services to the container.

View File

@ -1,4 +1,5 @@

using System.ComponentModel;
using asg_form.Controllers;
using Microsoft.AspNetCore.Identity;
@ -7,6 +8,9 @@ namespace asg_form
public class User : IdentityUser<long>
{
public string? UserBase64 { get; set; }
[DefaultValue(0)]
public long? Integral { get; set; }
public DateTime CreationTime { get; set; }
public form? haveform { get; set; }
@ -14,7 +18,10 @@ namespace asg_form
public bool? isbooking { get; set; }
public string? chinaname { get; set; }
public string? officium { get; set; }
public string? officium { get; set; }
public int point { get; set; }
}
public class Role : IdentityRole<long>

View File

@ -51,6 +51,7 @@
<ItemGroup>
<Folder Include="Controllers\PlayerC\" />
<Folder Include="Model\" />
</ItemGroup>
</Project>

Binary file not shown.

View File

@ -10,7 +10,7 @@ pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
solution: 'asg_form.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
@ -21,14 +21,6 @@ steps:
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
- task: DotNetCoreCLI@2
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
command: 'build'