From 500202946db0a461960fe19a9d803c83a7f0ff00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=AF=85?= <2667210109@qq.com> Date: Sun, 2 Feb 2025 16:26:04 +0800 Subject: [PATCH] =?UTF-8?q?QQ=E6=9C=BA=E5=99=A8=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asg_form/Controllers/Com.cs | 14 +++++--------- asg_form/Program.cs | 1 - asg_form/asg_form.csproj | 1 - asg_form/qqbot.cs | 34 +++++++++++++++++++++++++++++++--- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/asg_form/Controllers/Com.cs b/asg_form/Controllers/Com.cs index 11abd57..d6f0045 100644 --- a/asg_form/Controllers/Com.cs +++ b/asg_form/Controllers/Com.cs @@ -123,23 +123,19 @@ namespace asg_form.Controllers { using(TestDbContext testDb = new TestDbContext()) { var user = await userManager.FindByNameAsync(this.User.Identity!.Name!); - if (user.officium != "Anchor") - { - return Ok(new error_mb { code = 401, message = $"你是{user.officium},你不是导播,无法操作" }); - } - else - { + //对testDb.team_Games.commentary中出现最多的十个解说名称进行排名 - var ranking = testDb.team_Games.SelectMany(g => JsonConvert.DeserializeObject>(g.commentary).Select(c => c.chinaname)) + var ranking = testDb.team_Games.ToList(); + var ranking1= ranking.SelectMany(g => JsonConvert.DeserializeObject>(g.commentary).Select(c => c.chinaname)) .GroupBy(c => c) .OrderByDescending(g => g.Count()) .Take(10) .Select(g => new { Name = g.Key, Count = g.Count() }) .ToList(); - return ranking; + return ranking1; - } + } } diff --git a/asg_form/Program.cs b/asg_form/Program.cs index 65c92bf..0122461 100644 --- a/asg_form/Program.cs +++ b/asg_form/Program.cs @@ -3,7 +3,6 @@ using asg_form.Controllers; using asg_form.Controllers.Hubs; using Flandre.Adapters.OneBot.Extensions; using Flandre.Framework; -using IGeekFan.AspNetCore.Knife4jUI; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Identity; diff --git a/asg_form/asg_form.csproj b/asg_form/asg_form.csproj index 96f4309..4b43ea8 100644 --- a/asg_form/asg_form.csproj +++ b/asg_form/asg_form.csproj @@ -33,7 +33,6 @@ - diff --git a/asg_form/qqbot.cs b/asg_form/qqbot.cs index 6af0003..c3d3c47 100644 --- a/asg_form/qqbot.cs +++ b/asg_form/qqbot.cs @@ -38,9 +38,6 @@ namespace asg_form [EventName("查询选手")] public class qqbot:Plugin { - - - [Command] public string 查询选手(string name) { @@ -66,6 +63,37 @@ namespace asg_form } + [Command] + public string 查询黑名单() + { + try + { + using (TestDbContext ctx = new TestDbContext()) + { + var blacks= ctx.T_blacks.ToList(); + string msg = "为了良好的赛事环境,我们对以下选手进行禁赛处理"; + foreach (var b in blacks) + { + msg = $"{msg}\r\n{b.record_name} {b.violator} {b.platform_record} {b.offending_details} {b.processing_result} {b.feature_id}"; + } + return msg; + } + + + + } + catch + { + return "出现错误"; + } + + } + + + + + + [Command] public string 近期赛程() {