backend/ExamKing.Application/Services/StuanswerdetailService.cs
(开头部分) 15KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ExamKing.Application.Consts;
using ExamKing.Application.ErrorCodes;
using ExamKing.Application.Mappers;
using ExamKing.Core.Entites;
using Furion.DatabaseAccessor;
using Furion.DependencyInjection;
using Furion.FriendlyException;
using Mapster;
using Microsoft.EntityFrameworkCore;
namespace ExamKing.Application.Services
{
/// <summary>
/// 答题服务
/// </summary>
public class StuanswerdetailService : IStuanswerdetailService, ITransient
{
private readonly IRepository<TbStuanswerdetail> _answerRepository;
private readonly IRepository<TbExamquestion> _examquestionRepository;
private readonly ISelectService _selectService;
private readonly IJudgeService _judgeService;
/// <summary>
/// 依赖注入
/// </summary>
public StuanswerdetailService(
IRepository<TbStuanswerdetail> answerRepository,
IRepository<TbExamquestion> examquestionRepository,
ISelectService selectService,
IJudgeService judgeService)
{
_answerRepository = answerRepository;
_examquestionRepository = examquestionRepository;
_selectService = selectService;
_judgeService = judgeService;
}
/// <summary>
/// 获取学生全部错题数量
/// </summary>
/// <param name="studentId">学生Id</param>
/// <returns></returns>
public async Task<int> GetWrongAnswerByStudent(int studentId)
{
var count = await _answerRepository
.Where(x => x.StuId == studentId && x.Isright == "0")
.CountAsync();
return count;
}
/// <summary>
/// 获取学生今日错题数
/// </summary>
/// <param name="studentId"></param>
/// <returns></returns>
public async Task<int> GetWrongAnswerTodayByStudent(int studentId)
后面还有 336 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。