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
1a397e90
Commit
1a397e90
authored
Jun 06, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
5b43e96f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
33 additions
and
18 deletions
+33
-18
EduSpider.sln
EduSpider.sln
+0
-6
MindService.cs
EduSpider/MindService.cs
+1
-1
Program.cs
EduSpider/Program.cs
+5
-5
ClassInAccountManager.cs
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
+1
-1
ClassInFlow.cs
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
+9
-3
CourseManager.cs
EduSpider/Spiders/ClassInRule/CourseManager.cs
+7
-0
HomeWorkManager.cs
EduSpider/Spiders/ClassInRule/HomeWorkManager.cs
+6
-2
StudentManager.cs
EduSpider/Spiders/ClassInRule/StudentManager.cs
+3
-0
TeacherManager.cs
EduSpider/Spiders/ClassInRule/TeacherManager.cs
+1
-0
No files found.
EduSpider.sln
View file @
1a397e90
...
...
@@ -25,8 +25,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EduSpider", "EduSpider\EduS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EduSpider.Cache", "EduSpider.Cache\EduSpider.Cache.csproj", "{6D059BFB-A071-4856-A35D-38EB893FED74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EduSpiderWorkerService", "EduSpiderWorkerService\EduSpiderWorkerService.csproj", "{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -69,10 +67,6 @@ Global
{6D059BFB-A071-4856-A35D-38EB893FED74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D059BFB-A071-4856-A35D-38EB893FED74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D059BFB-A071-4856-A35D-38EB893FED74}.Release|Any CPU.Build.0 = Release|Any CPU
{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
EduSpider/MindService.cs
View file @
1a397e90
...
...
@@ -41,7 +41,7 @@ namespace EduSpider
if
(
Interlocked
.
Exchange
(
ref
inTimer
,
1
)
==
0
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunClassInData"
,
"开始ClassIn数据"
);
//
ClassInFlow.StartAsync();
//
ClassInFlow.StartAsync();
Interlocked
.
Exchange
(
ref
inTimer
,
0
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunClassInData"
,
"结束ClassIn数据"
);
}
...
...
EduSpider/Program.cs
View file @
1a397e90
...
...
@@ -11,17 +11,17 @@ namespace EduSpider
{
//ClassIn数据
//ClassInFlow
.StartAsync();
new
ClassInFlow
()
.
StartAsync
();
////校管家数据
//SchoolTaskHelper.RunTask();
//
Console.ReadLine();
Console
.
ReadLine
();
//
Environment.Exit(0);
Environment
.
Exit
(
0
);
ServiceBase
[]
services
=
new
ServiceBase
[]
{
new
MindService
()
};
ServiceBase
.
Run
(
services
);
//
ServiceBase[] services = new ServiceBase[] { new MindService() };
//
ServiceBase.Run(services);
}
}
}
\ No newline at end of file
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
View file @
1a397e90
...
...
@@ -73,7 +73,7 @@ namespace TicketSpider.Spiders.ClassInRule
service
.
HideCommandPromptWindow
=
true
;
option
.
PageLoadStrategy
=
PageLoadStrategy
.
Eager
;
IWebDriver
driver
=
new
ChromeDriver
(
service
,
option
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
"开始登录"
);
try
{
...
...
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
View file @
1a397e90
using
EduSpider.Spiders.ClassInRule
;
using
System
;
using
System.Threading
;
namespace
TicketSpider.Spiders.ClassInRule
{
...
...
@@ -8,17 +9,18 @@ namespace TicketSpider.Spiders.ClassInRule
/// <summary>
/// 导入ClassIn数据
/// </summary>
public
static
void
StartAsync
()
public
void
StartAsync
()
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunClassInData"
,
"开始ClassIn数据"
);
Console
.
WriteLine
(
"开始模拟登录信息......."
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"StartAsync"
,
"开始模拟登录信息......."
);
string
loginCookies
;
//自定获取Cookie
loginCookies
=
ClassInAccountManager
.
GetInstance
();
loginCookies
=
ClassInAccountManager
.
GetInstance
();
//loginCookies = "_eeos_uid=12780052; _eeos_useraccount=18140082327; _eeos_userlogo=%2Fupload%2Fimages%2F20200126%2F709df9532bee722f2268_70.jpg; _eeos_domain=.eeo.cn; _eeos_remember=1; _eeos_sid=12780052; _eeos_nsid=kspGu2gfMu%2BU2EFgLpSGyg%3D%3D; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2212780052%22%2C%22first_id%22%3A%22180f59907abbed-081e4952c5b26f-12333272-2073600-180f59907acbc8%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%22180f59907abbed-081e4952c5b26f-12333272-2073600-180f59907acbc8%22%7D; _eeos_traffic=EqlIOFq4S2hz5FTTtHzNUViBYcWCixrJYMCF6Y5yJuD8eq8ZwPvVSHMvUkLFA5lzNoaTrDBpGhFOuRmo3R6CQ5GeSsJx1IEakyt2K%2B3ifco%3D; PHPSESSID=3etqs18ka2s425omq6uqsus8s2; __tk_id=7a20b97a04709afc3137ec211e756d5f";
Console
.
WriteLine
(
"cookies:"
+
loginCookies
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"StartAsync"
,
"cookies:"
+
loginCookies
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"StartAsync"
,
"cookies:"
+
loginCookies
);
Console
.
WriteLine
(
"开始获取老师信息"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"StartAsync"
,
"开始获取老师信息"
);
...
...
@@ -43,6 +45,10 @@ namespace TicketSpider.Spiders.ClassInRule
HomeWorkManager
.
RunHomeWork
(
loginCookies
);
Console
.
WriteLine
(
"作业信息更新结束"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"StartAsync"
,
"作业信息更新结束"
);
}
}
}
EduSpider/Spiders/ClassInRule/CourseManager.cs
View file @
1a397e90
...
...
@@ -31,6 +31,7 @@ namespace EduSpider.Spiders.ClassInRule
ICourseRepository
courseRepository
=
new
CourseRepository
();
int
totalCount
=
0
;
Console
.
WriteLine
(
string
.
Format
(
"开始第{0}次获取课程数据"
,
pageCount
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunCourse"
,
string
.
Format
(
"开始第{0}次获取课程数据"
,
pageCount
));
string
url
=
"https://console.eeo.cn/saasajax/course.ajax.php?action=getCourseList"
;
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
result
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
...
...
@@ -47,6 +48,7 @@ namespace EduSpider.Spiders.ClassInRule
courseRepository
.
BatchSetCourseRepository
(
tempList
);
totalCount
+=
tempList
.
Count
;
Console
.
WriteLine
(
string
.
Format
(
"第{0}次,导入完成{1}条."
,
pageCount
,
totalCount
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunCourse"
,
string
.
Format
(
"第{0}次,导入完成{1}条."
,
pageCount
,
totalCount
));
foreach
(
var
item
in
tempList
)
{
RunCourseStudent
(
cookie
,
item
.
CourseId
);
...
...
@@ -68,6 +70,7 @@ namespace EduSpider.Spiders.ClassInRule
{
Thread
.
Sleep
(
1000
*
2
);
Console
.
WriteLine
(
string
.
Format
(
"第{0}/{1}次获取课程数据"
,
i
,
pageCount
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunCourse"
,
string
.
Format
(
"第{0}/{1}次获取课程数据"
,
i
,
pageCount
));
paramStr
=
string
.
Format
(
queryStr
,
i
,
perpage
);
var
sub_content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
var
sub_response
=
await
request
.
PostAsync
(
url
,
sub_content
);
...
...
@@ -84,6 +87,7 @@ namespace EduSpider.Spiders.ClassInRule
courseRepository
.
BatchSetCourseRepository
(
subtempList
);
totalCount
+=
subtempList
.
Count
;
Console
.
WriteLine
(
string
.
Format
(
"第{0}次,导入完成{1}条."
,
i
,
totalCount
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunCourse"
,
string
.
Format
(
"第{0}次,导入完成{1}条."
,
i
,
totalCount
));
foreach
(
var
sItem
in
subtempList
)
{
RunCourseStudent
(
cookie
,
sItem
.
CourseId
);
...
...
@@ -160,6 +164,7 @@ namespace EduSpider.Spiders.ClassInRule
ICourseStudentRepository
courseStudentRepository
=
new
CourseStudentRepository
();
Console
.
WriteLine
(
string
.
Format
(
"开始获取{0}课程学员数据"
,
courseId
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunCourseStudent"
,
string
.
Format
(
"开始获取{0}课程学员数据"
,
courseId
));
string
url
=
"https://console.eeo.cn/saasajax/student.ajax.php?action=getCourseStudentList"
;
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
sutResult
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
...
...
@@ -208,6 +213,7 @@ namespace EduSpider.Spiders.ClassInRule
ICourseTeacherRepository
courseTeacherRepository
=
new
CourseTeacherRepository
();
Console
.
WriteLine
(
string
.
Format
(
"开始获取{0}课程老师数据"
,
courseId
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunCourseTeacher"
,
string
.
Format
(
"开始获取{0}课程老师数据"
,
courseId
));
string
url
=
"https://console.eeo.cn/saasajax/course.ajax.php?action=getCourseTeacherList"
;
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
teacherResult
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
...
...
@@ -262,6 +268,7 @@ namespace EduSpider.Spiders.ClassInRule
ICourseRepository
courseRepository
=
new
CourseRepository
();
Console
.
WriteLine
(
string
.
Format
(
"开始获取{0}课程详情数据"
,
courseId
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunCourseInfo"
,
string
.
Format
(
"开始获取{0}课程详情数据"
,
courseId
));
string
url
=
"https://console.eeo.cn/saasajax/course.ajax.php?action=getCourseInfo"
;
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
courseInfoResult
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
...
...
EduSpider/Spiders/ClassInRule/HomeWorkManager.cs
View file @
1a397e90
...
...
@@ -33,7 +33,7 @@ namespace EduSpider.Spiders.ClassInRule
IStuHomeWorkRepository
stuHomeWorkRepository
=
new
StuHomeWorkRepository
();
int
totalCount
=
0
;
Console
.
WriteLine
(
string
.
Format
(
"开始第{0}次获取家庭作业"
,
pageCount
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunHomeWork"
,
string
.
Format
(
"开始第{0}次获取家庭作业"
,
pageCount
));
string
url
=
"https://console.eeo.cn/saasajax/homework.ajax.php?action=getHomeworkList"
;
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
result
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
...
...
@@ -50,6 +50,7 @@ namespace EduSpider.Spiders.ClassInRule
homeWorkRepository
.
BatchSetHomeWorkRepository
(
tempList
);
totalCount
+=
tempList
.
Count
;
Console
.
WriteLine
(
string
.
Format
(
"第{0}次,导入完成{1}条."
,
pageCount
,
totalCount
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunHomeWork"
,
string
.
Format
(
"第{0}次,导入完成{1}条."
,
pageCount
,
totalCount
));
foreach
(
var
item
in
tempList
)
{
RunStuHomeWork
(
cookie
,
item
.
Homework_id
,
item
.
Course_id
);
...
...
@@ -70,6 +71,7 @@ namespace EduSpider.Spiders.ClassInRule
{
Thread
.
Sleep
(
1000
*
2
);
Console
.
WriteLine
(
string
.
Format
(
"第{0}/{1}次获取课程数据"
,
i
,
pageCount
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunHomeWork"
,
string
.
Format
(
"第{0}/{1}次获取课程数据"
,
i
,
pageCount
));
paramStr
=
string
.
Format
(
queryStr
,
i
,
perpage
);
var
sub_content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
var
sub_response
=
await
request
.
PostAsync
(
url
,
sub_content
);
...
...
@@ -87,13 +89,14 @@ namespace EduSpider.Spiders.ClassInRule
homeWorkRepository
.
BatchSetHomeWorkRepository
(
subtempList
);
totalCount
+=
subtempList
.
Count
;
Console
.
WriteLine
(
string
.
Format
(
"第{0}次,导入完成{1}条."
,
i
,
totalCount
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunHomeWork"
,
string
.
Format
(
"第{0}次,导入完成{1}条."
,
i
,
totalCount
));
foreach
(
var
sItem
in
subtempList
)
{
RunStuHomeWork
(
cookie
,
sItem
.
Homework_id
,
sItem
.
Course_id
);
}
if
(
i
==
totalCount
)
{
stuHomeWorkRepository
.
CreateHomeWorkCommentRepository
(
0
);
//
stuHomeWorkRepository.CreateHomeWorkCommentRepository(0);
}
}
}
...
...
@@ -181,6 +184,7 @@ namespace EduSpider.Spiders.ClassInRule
string
paramStr
=
string
.
Format
(
queryStr
,
homework_id
,
courseId
,
stuIds
);
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
Console
.
WriteLine
(
string
.
Format
(
"开始获取{0}作业学员数据"
,
homework_id
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunStuHomeWork"
,
string
.
Format
(
"开始获取{0}作业学员数据"
,
homework_id
));
string
url
=
"https://console.eeo.cn/saasajax/homework.ajax.php?action=getStudentsHomeworkList"
;
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
sutHomeWorkResult
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
...
...
EduSpider/Spiders/ClassInRule/StudentManager.cs
View file @
1a397e90
...
...
@@ -33,6 +33,7 @@ namespace EduSpider.Spiders.ClassInRule
while
(
pageIndex
<=
pageCount
)
{
Console
.
WriteLine
(
$"正在查询第
{
pageIndex
}
-
{
pageSize
}
页学员信息"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"正在查询第
{
pageIndex
}
-
{
pageSize
}
页学员信息"
);
var
paramStr
=
$"page=
{
pageIndex
}
&perpage=
{
pageSize
}
&isdel=0"
;
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
var
response
=
await
request
.
PostAsync
(
"https://console.eeo.cn/saasajax/student.ajax.php?action=getSchoolStudentListByPage"
,
content
);
...
...
@@ -76,6 +77,7 @@ namespace EduSpider.Spiders.ClassInRule
}
courseRepository
.
BatchSetStudent
(
stus
);
Console
.
WriteLine
(
$"已导入第
{
pageIndex
}
-
{
pageSize
}
页学员信息"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"已导入第
{
pageIndex
}
-
{
pageSize
}
页学员信息"
);
#
endregion
#
region
写入账号
...
...
@@ -110,6 +112,7 @@ namespace EduSpider.Spiders.ClassInRule
#
endregion
Console
.
WriteLine
(
"学员同步完成"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"学员同步完成"
);
}
...
...
EduSpider/Spiders/ClassInRule/TeacherManager.cs
View file @
1a397e90
...
...
@@ -62,6 +62,7 @@ namespace EduSpider.Spiders.ClassInRule
else
{
Console
.
WriteLine
(
"result"
,
result
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunTeacher"
,
$"result:
{
result
}
"
);
}
if
(
pageIndex
==
pageCount
)
{
...
...
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