This commit is contained in:
@@ -62,7 +62,7 @@ namespace TechHelper.Server.Controllers
|
||||
|
||||
var result = await _classService.GetClassStudents(classDto);
|
||||
var css = result.Result as ICollection<ClassStudent>;
|
||||
if(css == null) return BadRequest("你还没有学生");
|
||||
if (css == null) return BadRequest("你还没有学生");
|
||||
|
||||
|
||||
List<StudentDto> sts = new List<StudentDto>();
|
||||
@@ -93,5 +93,15 @@ namespace TechHelper.Server.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPost("GetGradeClasses")]
|
||||
public async Task<IActionResult> GetGradeClasses(
|
||||
[FromBody] byte classDto)
|
||||
{
|
||||
var result = await _classService.GetGradeClasses(classDto);
|
||||
if (!result.Status) return BadRequest(result.Message);
|
||||
|
||||
return Ok(result.Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ using TechHelper.Services;
|
||||
|
||||
namespace TechHelper.Server.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[Route("api/exam")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class ExamController : ControllerBase
|
||||
@@ -54,7 +54,6 @@ namespace TechHelper.Server.Controllers
|
||||
/// <param name="submissionDto">提交的数据传输对象。</param>
|
||||
/// <returns>提交结果或错误信息。</returns>
|
||||
[HttpPost("submission")]
|
||||
[Authorize(Roles = "Student")]
|
||||
public async Task<IActionResult> SubmissionAssignment([FromBody] SubmissionDto submissionDto)
|
||||
{
|
||||
var result = await _examService.SubmissionAssignment(submissionDto);
|
||||
|
@@ -1,12 +1,15 @@
|
||||
# 请参阅 https://aka.ms/customizecontainer 以了解如何自定义调试容器,以及 Visual Studio 如何使用此 Dockerfile 生成映像以更快地进行调试。
|
||||
|
||||
# 此阶段用于在快速模式(默认为调试配置)下从 VS 运行时
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS server
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
COPY --from=entitieslib:latest /publish /publish/entities
|
||||
COPY --from=emaillib:latest /publish /publish/emaillib
|
||||
|
||||
|
||||
# 此阶段用于生成服务项目
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
@@ -16,15 +19,17 @@ COPY ["TechHelper.Server/TechHelper.Server.csproj", "TechHelper.Server/"]
|
||||
RUN dotnet restore "./TechHelper.Server/TechHelper.Server.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/TechHelper.Server"
|
||||
RUN dotnet nuget locals all --clear
|
||||
RUN dotnet build "./TechHelper.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
# 此阶段用于发布要复制到最终阶段的服务项目
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet nuget locals all --clear
|
||||
RUN dotnet publish "./TechHelper.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# 此阶段在生产中使用,或在常规模式下从 VS 运行时使用(在不使用调试配置时为默认值)
|
||||
FROM base AS final
|
||||
FROM server AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "TechHelper.Server.dll"]
|
1263
TechHelper.Server/Migrations/20250828025055_score_in_submission.Designer.cs
generated
Normal file
1263
TechHelper.Server/Migrations/20250828025055_score_in_submission.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace TechHelper.Server.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class score_in_submission : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("379143a2-8d7f-4ef7-b7c0-14701b710f87"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6d49bb08-97d6-4a38-88a7-8080925b589b"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("e330c745-f422-43e3-bcdf-1439ace3c52f"));
|
||||
|
||||
migrationBuilder.AddColumn<byte>(
|
||||
name: "ErrorQuesNum",
|
||||
table: "submissions",
|
||||
type: "tinyint unsigned",
|
||||
nullable: false,
|
||||
defaultValue: (byte)0);
|
||||
|
||||
migrationBuilder.AddColumn<byte>(
|
||||
name: "TotalQuesNum",
|
||||
table: "submissions",
|
||||
type: "tinyint unsigned",
|
||||
nullable: false,
|
||||
defaultValue: (byte)0);
|
||||
|
||||
migrationBuilder.AddColumn<byte>(
|
||||
name: "TotalScore",
|
||||
table: "submissions",
|
||||
type: "tinyint unsigned",
|
||||
nullable: false,
|
||||
defaultValue: (byte)0);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetRoles",
|
||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("53307917-63c4-468a-ab05-a03882a69ef8"), null, "Teacher", "TEACHER" },
|
||||
{ new Guid("789b7819-685f-4a2b-9adf-463f397f24d1"), null, "Administrator", "ADMINISTRATOR" },
|
||||
{ new Guid("bbea7915-e27c-4ddc-b06c-1f579fc8104e"), null, "Student", "STUDENT" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("53307917-63c4-468a-ab05-a03882a69ef8"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("789b7819-685f-4a2b-9adf-463f397f24d1"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("bbea7915-e27c-4ddc-b06c-1f579fc8104e"));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ErrorQuesNum",
|
||||
table: "submissions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TotalQuesNum",
|
||||
table: "submissions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TotalScore",
|
||||
table: "submissions");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetRoles",
|
||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("379143a2-8d7f-4ef7-b7c0-14701b710f87"), null, "Administrator", "ADMINISTRATOR" },
|
||||
{ new Guid("6d49bb08-97d6-4a38-88a7-8080925b589b"), null, "Student", "STUDENT" },
|
||||
{ new Guid("e330c745-f422-43e3-bcdf-1439ace3c52f"), null, "Teacher", "TEACHER" }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
1270
TechHelper.Server/Migrations/20250829043403_up_assign_data.Designer.cs
generated
Normal file
1270
TechHelper.Server/Migrations/20250829043403_up_assign_data.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace TechHelper.Server.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class up_assign_data : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("53307917-63c4-468a-ab05-a03882a69ef8"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("789b7819-685f-4a2b-9adf-463f397f24d1"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("bbea7915-e27c-4ddc-b06c-1f579fc8104e"));
|
||||
|
||||
migrationBuilder.AddColumn<byte>(
|
||||
name: "ExamType",
|
||||
table: "assignments",
|
||||
type: "tinyint unsigned",
|
||||
nullable: false,
|
||||
defaultValue: (byte)0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Name",
|
||||
table: "assignments",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetRoles",
|
||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("0775702a-5db7-4747-94d0-4376fad2b58b"), null, "Teacher", "TEACHER" },
|
||||
{ new Guid("37f41430-0cb7-44e5-988b-976200bd602d"), null, "Administrator", "ADMINISTRATOR" },
|
||||
{ new Guid("df89b9a0-65ef-42dd-b2cb-e59997a72e70"), null, "Student", "STUDENT" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("0775702a-5db7-4747-94d0-4376fad2b58b"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("37f41430-0cb7-44e5-988b-976200bd602d"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "AspNetRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("df89b9a0-65ef-42dd-b2cb-e59997a72e70"));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ExamType",
|
||||
table: "assignments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Name",
|
||||
table: "assignments");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetRoles",
|
||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("53307917-63c4-468a-ab05-a03882a69ef8"), null, "Teacher", "TEACHER" },
|
||||
{ new Guid("789b7819-685f-4a2b-9adf-463f397f24d1"), null, "Administrator", "ADMINISTRATOR" },
|
||||
{ new Guid("bbea7915-e27c-4ddc-b06c-1f579fc8104e"), null, "Student", "STUDENT" }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -50,10 +50,17 @@ namespace TechHelper.Server.Migrations
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("exam_struct_id");
|
||||
|
||||
b.Property<byte>("ExamType")
|
||||
.HasColumnType("tinyint unsigned");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnName("deleted");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("Score")
|
||||
.HasColumnType("float")
|
||||
.HasColumnName("score");
|
||||
@@ -504,6 +511,9 @@ namespace TechHelper.Server.Migrations
|
||||
.HasColumnType("tinyint unsigned")
|
||||
.HasColumnName("attempt_number");
|
||||
|
||||
b.Property<byte>("ErrorQuesNum")
|
||||
.HasColumnType("tinyint unsigned");
|
||||
|
||||
b.Property<DateTime?>("GradedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnName("graded_at");
|
||||
@@ -540,6 +550,12 @@ namespace TechHelper.Server.Migrations
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnName("submission_time");
|
||||
|
||||
b.Property<byte>("TotalQuesNum")
|
||||
.HasColumnType("tinyint unsigned");
|
||||
|
||||
b.Property<byte>("TotalScore")
|
||||
.HasColumnType("tinyint unsigned");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AssignmentId");
|
||||
@@ -755,19 +771,19 @@ namespace TechHelper.Server.Migrations
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("6d49bb08-97d6-4a38-88a7-8080925b589b"),
|
||||
Id = new Guid("df89b9a0-65ef-42dd-b2cb-e59997a72e70"),
|
||||
Name = "Student",
|
||||
NormalizedName = "STUDENT"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("e330c745-f422-43e3-bcdf-1439ace3c52f"),
|
||||
Id = new Guid("0775702a-5db7-4747-94d0-4376fad2b58b"),
|
||||
Name = "Teacher",
|
||||
NormalizedName = "TEACHER"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("379143a2-8d7f-4ef7-b7c0-14701b710f87"),
|
||||
Id = new Guid("37f41430-0cb7-44e5-988b-976200bd602d"),
|
||||
Name = "Administrator",
|
||||
NormalizedName = "ADMINISTRATOR"
|
||||
});
|
||||
|
@@ -128,7 +128,7 @@ builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowSpecificOrigin",
|
||||
builder => builder
|
||||
.WithOrigins("https://localhost:7047", "http://localhost:5190")
|
||||
.WithOrigins("https://localhost:7047", "http://localhost:7047")
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials());
|
||||
@@ -137,7 +137,7 @@ builder.Services.AddCors(options =>
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
if (/*app.Environment.IsDevelopment()*/true)
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
@@ -8,7 +8,7 @@
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5099"
|
||||
"applicationUrl": "http://localhost:8080"
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
@@ -18,7 +18,7 @@
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:7037;http://localhost:5062"
|
||||
"applicationUrl": "https://localhost:8080"
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
|
@@ -143,6 +143,22 @@ namespace TechHelper.Services
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ApiResponse> GetGradeClasses(byte Grade)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await _work.GetRepository<Class>().GetAllAsync(predicate:
|
||||
c => c.Grade == Grade);
|
||||
|
||||
var classes = result.Select(x => x.Number).ToList();
|
||||
return ApiResponse.Success(result: classes);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ApiResponse.Error($"年级班级列表失败, {ex.Message}, {ex.InnerException}");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ApiResponse> GetUserClass(Guid id)
|
||||
{
|
||||
var tch = await _work.GetRepository<ClassTeacher>().GetAllAsync(predicate: user => user.TeacherId == id, include: i => i
|
||||
|
@@ -10,5 +10,7 @@ namespace TechHelper.Services
|
||||
public Task<ApiResponse> GetUserClass(Guid user); // List<Class>
|
||||
public Task<ApiResponse> GetUserClassRole(Guid user); // List<UserClassRoleDto>
|
||||
public Task<ApiResponse> GetClassStudents(ClassDto classDto); // Class
|
||||
public Task<ApiResponse> GetGradeClasses(byte Grade); // Class
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user