Commit 58716f5a authored by liudong1993's avatar liudong1993

1

parent a96fb421
......@@ -13,7 +13,7 @@ namespace EduSpider.Model.Entity
public class RB_Account
{
/// <summary>
/// 对应Uid
/// 对应id
/// </summary>
public int Id { get; set; }
......@@ -33,7 +33,7 @@ namespace EduSpider.Model.Entity
public AccountTypeEnum AccountType { get; set; }
/// <summary>
/// 对应 老师/学生ID
/// 对应 老师/学生UID
/// </summary>
public int AccountId { get; set; }
......
......@@ -60,10 +60,10 @@ namespace EduSpider.Repository
string sql = $@"
select * from(
SELECT a.Id,a.Account,a.`Password`,a.AccountType,a.AccountId,t.TeacherName AS AccountName,t.Logo as UserIcon,a.Status FROM rb_account a
INNER JOIN rb_teacher t on a.AccountId =t.TeacherId and a.AccountType =1
INNER JOIN rb_teacher t on a.Id =t.TeacherId and a.AccountType =1
UNION
SELECT a.Id,a.Account,a.`Password`,a.AccountType,a.AccountId,s.StudentName AS AccountName,'' as UserIcon,a.Status FROM rb_account a
INNER JOIN rb_student s on a.AccountId =s.StudId and a.AccountType =2
INNER JOIN rb_student s on a.Id =s.StudId and a.AccountType =2
) t where {where}
";
return Get<RB_Account_Extend>(sql).ToList();
......@@ -76,7 +76,7 @@ INNER JOIN rb_student s on a.AccountId =s.StudId and a.AccountType =2
/// <returns></returns>
public int GetMaxStuTeaId(int type)
{
string sql = $" select max(AccountId) from RB_Account where AccountType ={type}";
string sql = $" select max(Id) from RB_Account where AccountType ={type}";
var obj = ExecuteScalar(sql);
return obj == null ? 0 : Convert.ToInt32(obj);
}
......
......@@ -44,7 +44,7 @@ namespace EduSpider.Repository
LEFT JOIN (
SELECT e.ExamId,COUNT(0) as StuNum,SUM(e.TScore) as TScore FROM rb_exam_score e GROUP BY e.ExamId
) es on e.ExamId = es.ExamId
where {where} order by e.EcamId desc";
where {where} order by e.ExamId desc";
return GetPage<RB_Exam_Extend>(pageIndex, pageSize, out count, sql, parameters).ToList();
}
}
......
......@@ -79,9 +79,9 @@ namespace EduSpider.Services
public object GetExamStuScoreInfo(int examId, int stuId, int stuUId)
{
if (stuUId > 0) {
var accountModel = AccountRepository.GetAccountList(new RB_Account_Extend() { Id = stuUId, AccountType = Utility.Enum.AccountTypeEnum.Student }).FirstOrDefault();
var accountModel = AccountRepository.GetAccountList(new RB_Account_Extend() { AccountId = stuUId, AccountType = Utility.Enum.AccountTypeEnum.Student }).FirstOrDefault();
if (accountModel == null) { return ""; }
stuId = accountModel.AccountId;
stuId = accountModel.Id;
}
var stuModel = StudentRepository.GetEntity(stuId);
if (stuModel == null) { return ""; }
......@@ -131,13 +131,13 @@ namespace EduSpider.Services
}),
DifficultyList = sExamModel?.ScoreList.GroupBy(x => new { x.Difficulty }).Select(x => new
{
x.Key.Difficulty,
Difficulty = x.Key.Difficulty == "易" ? "简单题" : x.Key.Difficulty == "中" ? "中档题" : "难题",
Count = x.Count(),
Score = x.Sum(x => x.QScore)
}),
DifficultyRateList = sExamModel?.ScoreList.GroupBy(x => new { x.Difficulty }).Select(x => new
{
x.Key.Difficulty,
Difficulty = x.Key.Difficulty == "易" ? "简单题" : x.Key.Difficulty == "中" ? "中档题" : "难题",
ScoreRate = Math.Round(x.Sum(y => y.Score) / x.Sum(y => y.QScore), 2, MidpointRounding.AwayFromZero),
AvgScoreRate = Math.Round(x.Sum(y => y.AvgScore) / x.Sum(y => y.QScore), 2, MidpointRounding.AwayFromZero),
})
......
......@@ -163,7 +163,7 @@ namespace EduSpider.Utility
/// </summary>
public static string AppID
{
get { return "wx38e054ee42b054f4"; }
get { return "wx10655d8e5b0a67c5"; }
}
/// <summary>
......@@ -171,7 +171,7 @@ namespace EduSpider.Utility
/// </summary>
public static string AppSecret
{
get { return "d3ad4699265ba885ae2c8b65bf574ea5"; }
get { return "ba2b81857e4b9c20d3860fb84eca1d79"; }
}
/// <summary>
......
using EduSpider.Cache.User;
using Edu.WebApi.Filter;
using EduSpider.Cache.User;
using EduSpider.Model.Cache;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using System;
using VTX.FW.Filter;
using VTX.FW.Helper;
using VTX.FW.VtController;
......@@ -11,6 +13,8 @@ namespace EduSpider.WebApi.Controllers.Base
[EnableCors("AllowCors")]
[Route("api/[controller]/[action]")]
[ApiController]
[ActionFilter]
[ApiExceptionFilter]
public class BaseController : ApiBaseController
{
/// <summary>
......
......@@ -38,6 +38,7 @@ namespace EduSpider.WebApi.Controllers
{
x.ExamId,
x.ExamName,
x.CourseId,
x.StuNum,
x.TScore,
AvgScore = x.StuNum > 0 ? Math.Round(x.TScore / x.StuNum, 2, MidpointRounding.AwayFromZero) : 0,
......
......@@ -17,6 +17,7 @@ using JWT.Algorithms;
using JWT.Serializers;
using System.IO;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
namespace EduSpider.WebApi.Controllers
{
......@@ -56,7 +57,7 @@ namespace EduSpider.WebApi.Controllers
string ExamName = json["ExamName"] != null ? json["ExamName"].ToString() : "";
string filename = files[0].FileName;
string fileExtention = System.IO.Path.GetExtension(files[0].FileName);
string fileExtention = Path.GetExtension(files[0].FileName);
//验证文件格式
List<string> ExtList = new() {
".xls",
......@@ -78,7 +79,6 @@ namespace EduSpider.WebApi.Controllers
string dateStr = DateTime.Now.ToString("yyyyMMdd");
string tempPath = basepath + "upfile\\temporary\\" + dateStr + "\\";
string path_server = tempPath + path;
//string httpPath = "/upfile/temporary/" + dateStr + "/" + path;
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(tempPath);
......
......@@ -3,6 +3,10 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="6.3.0" />
......
......@@ -37,11 +37,11 @@ namespace EduSpider.WebApi
List<string> corsArray = GetCorsArray();
services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray())));
services.AddControllers();
services.AddMvc(options =>
{
options.Filters.Add<ApiExceptionFilterAttribute>();
options.Filters.Add<ActionFilterAttribute>();
});
//services.AddMvc(options =>
//{
// options.Filters.Add<ApiExceptionFilterAttribute>();
// options.Filters.Add<ActionFilterAttribute>();
//});
//处理josn格式
services.AddMvc().AddJsonOptions(options =>
......@@ -49,7 +49,6 @@ namespace EduSpider.WebApi
options.JsonSerializerOptions.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(System.Text.Unicode.UnicodeRanges.All);
options.JsonSerializerOptions.PropertyNamingPolicy = null;
});
}
/// <summary>
......
......@@ -84,9 +84,9 @@ namespace EduSpider.Spiders.ClassInRule
{
accountList.Add(new RB_Account()
{
Id = item.StudentUid,
Id = item.StudId,
Account = item.StudentAccount,
AccountId = item.StudId,
AccountId = item.StudentUid,
AccountType = Utility.Enum.AccountTypeEnum.Student,
OpenId = "",
Password = DESHepler.Encrypt(item.StudentAccount[^6..]),
......
......@@ -83,9 +83,9 @@ namespace EduSpider.Spiders.ClassInRule
{
accountList.Add(new RB_Account()
{
Id = item.TeacherUid,
Id = item.TeacherId,
Account = item.TeacherAccount,
AccountId = item.TeacherId,
AccountId = item.TeacherUid,
AccountType = AccountTypeEnum.Teacher,
OpenId = "",
Password = DESHepler.Encrypt(item.TeacherAccount[^6..]),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment