Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EduSpider
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
EduSpider
Commits
59e759f7
Commit
59e759f7
authored
May 30, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/viitto/eduspider
parents
8fe222cf
d8357e37
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
33 additions
and
25 deletions
+33
-25
RB_Account.cs
EduSpider.Model/Entity/RB_Account.cs
+2
-2
AccountRepository.cs
EduSpider.Repository/AccountRepository.cs
+3
-3
ExamRepository.cs
EduSpider.Repository/ExamRepository.cs
+1
-1
ExamService.cs
EduSpider.Services/ExamService.cs
+4
-4
Config.cs
EduSpider.Utility/Config.cs
+2
-2
BaseController.cs
EduSpider.WebApi/Controllers/Base/BaseController.cs
+5
-1
ExamController.cs
EduSpider.WebApi/Controllers/Student/ExamController.cs
+1
-0
UploadController.cs
EduSpider.WebApi/Controllers/Upload/UploadController.cs
+2
-2
EduSpider.WebApi.csproj
EduSpider.WebApi/EduSpider.WebApi.csproj
+4
-0
Startup.cs
EduSpider.WebApi/Startup.cs
+5
-6
StudentManager.cs
EduSpider/Spiders/ClassInRule/StudentManager.cs
+2
-2
TeacherManager.cs
EduSpider/Spiders/ClassInRule/TeacherManager.cs
+2
-2
No files found.
EduSpider.Model/Entity/RB_Account.cs
View file @
59e759f7
...
...
@@ -13,7 +13,7 @@ namespace EduSpider.Model.Entity
public
class
RB_Account
{
/// <summary>
/// 对应
U
id
/// 对应id
/// </summary>
public
int
Id
{
get
;
set
;
}
...
...
@@ -33,7 +33,7 @@ namespace EduSpider.Model.Entity
public
AccountTypeEnum
AccountType
{
get
;
set
;
}
/// <summary>
/// 对应 老师/学生ID
/// 对应 老师/学生
U
ID
/// </summary>
public
int
AccountId
{
get
;
set
;
}
...
...
EduSpider.Repository/AccountRepository.cs
View file @
59e759f7
...
...
@@ -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.
Account
Id =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.
Account
Id =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(
Account
Id) 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
);
}
...
...
EduSpider.Repository/ExamRepository.cs
View file @
59e759f7
...
...
@@ -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.E
c
amId desc"
;
where
{
where
}
order by e.E
x
amId desc"
;
return
GetPage
<
RB_Exam_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
,
parameters
).
ToList
();
}
}
...
...
EduSpider.Services/ExamService.cs
View file @
59e759f7
...
...
@@ -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
()
{
Account
Id
=
stuUId
,
AccountType
=
Utility
.
Enum
.
AccountTypeEnum
.
Student
}).
FirstOrDefault
();
if
(
accountModel
==
null
)
{
return
""
;
}
stuId
=
accountModel
.
Account
Id
;
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
),
})
...
...
EduSpider.Utility/Config.cs
View file @
59e759f7
...
...
@@ -163,7 +163,7 @@ namespace EduSpider.Utility
/// </summary>
public
static
string
AppID
{
get
{
return
"wx
38e054ee42b054f4
"
;
}
get
{
return
"wx
10655d8e5b0a67c5
"
;
}
}
/// <summary>
...
...
@@ -171,7 +171,7 @@ namespace EduSpider.Utility
/// </summary>
public
static
string
AppSecret
{
get
{
return
"
d3ad4699265ba885ae2c8b65bf574ea5
"
;
}
get
{
return
"
ba2b81857e4b9c20d3860fb84eca1d79
"
;
}
}
/// <summary>
...
...
EduSpider.WebApi/Controllers/Base/BaseController.cs
View file @
59e759f7
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>
...
...
EduSpider.WebApi/Controllers/Student/ExamController.cs
View file @
59e759f7
...
...
@@ -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
,
...
...
EduSpider.WebApi/Controllers/Upload/UploadController.cs
View file @
59e759f7
...
...
@@ -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
);
...
...
EduSpider.WebApi/EduSpider.WebApi.csproj
View file @
59e759f7
...
...
@@ -3,6 +3,10 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="6.3.0" />
...
...
EduSpider.WebApi/Startup.cs
View file @
59e759f7
...
...
@@ -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>
...
...
EduSpider/Spiders/ClassInRule/StudentManager.cs
View file @
59e759f7
...
...
@@ -84,9 +84,9 @@ namespace EduSpider.Spiders.ClassInRule
{
accountList
.
Add
(
new
RB_Account
()
{
Id
=
item
.
Stud
entUi
d
,
Id
=
item
.
Stud
I
d
,
Account
=
item
.
StudentAccount
,
AccountId
=
item
.
Stud
I
d
,
AccountId
=
item
.
Stud
entUi
d
,
AccountType
=
Utility
.
Enum
.
AccountTypeEnum
.
Student
,
OpenId
=
""
,
Password
=
DESHepler
.
Encrypt
(
item
.
StudentAccount
[^
6.
.]),
...
...
EduSpider/Spiders/ClassInRule/TeacherManager.cs
View file @
59e759f7
...
...
@@ -83,9 +83,9 @@ namespace EduSpider.Spiders.ClassInRule
{
accountList
.
Add
(
new
RB_Account
()
{
Id
=
item
.
Teacher
Ui
d
,
Id
=
item
.
Teacher
I
d
,
Account
=
item
.
TeacherAccount
,
AccountId
=
item
.
Teacher
I
d
,
AccountId
=
item
.
Teacher
Ui
d
,
AccountType
=
AccountTypeEnum
.
Teacher
,
OpenId
=
""
,
Password
=
DESHepler
.
Encrypt
(
item
.
TeacherAccount
[^
6.
.]),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment