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
94d5dbd2
Commit
94d5dbd2
authored
Sep 21, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
47041ac9
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
599 additions
and
522 deletions
+599
-522
ClassInFlow.cs
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
+0
-2
CourseManager.cs
EduSpider/Spiders/ClassInRule/CourseManager.cs
+229
-189
HomeWorkManager.cs
EduSpider/Spiders/ClassInRule/HomeWorkManager.cs
+126
-106
QuestionManager.cs
EduSpider/Spiders/ClassInRule/QuestionManager.cs
+152
-131
StudentManager.cs
EduSpider/Spiders/ClassInRule/StudentManager.cs
+64
-59
TeacherManager.cs
EduSpider/Spiders/ClassInRule/TeacherManager.cs
+28
-22
ICookiesManager.cs
EduSpider/Spiders/ICookiesManager.cs
+0
-13
No files found.
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
View file @
94d5dbd2
using
EduSpider.Spiders.ClassInRule
;
using
EduSpider.Utility.Plugin
;
using
System
;
using
System.Threading
;
namespace
TicketSpider.Spiders.ClassInRule
{
...
...
EduSpider/Spiders/ClassInRule/CourseManager.cs
View file @
94d5dbd2
...
...
@@ -33,7 +33,8 @@ namespace EduSpider.Spiders.ClassInRule
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
ICourseRepository
courseRepository
=
new
CourseRepository
();
int
totalCount
=
0
;
try
{
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
;
...
...
@@ -74,6 +75,8 @@ namespace EduSpider.Spiders.ClassInRule
Thread
.
Sleep
(
1000
*
2
);
paramStr
=
string
.
Format
(
queryStr
,
i
,
perpage
);
var
sub_content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
try
{
var
sub_response
=
await
request
.
PostAsync
(
url
,
sub_content
);
var
sub_result
=
sub_response
.
Content
.
ReadAsStringAsync
().
Result
;
if
(!
string
.
IsNullOrWhiteSpace
(
sub_result
))
...
...
@@ -100,10 +103,20 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
catch
(
Exception
ex2
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"CourseManager_RunCourse2"
,
ex
:
ex2
);
}
}
}
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"CourseManager_RunCourse"
,
ex
:
ex
);
}
}
/// <summary>
/// JSON字符串转课程列表
...
...
@@ -171,10 +184,12 @@ namespace EduSpider.Spiders.ClassInRule
InfoHelper
.
WriteLine
(
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
;
List
<
RB_Course_Student
>
list
=
new
();
List
<
RB_Course_Student
>
deleteList
=
new
List
<
RB_Course_Student
>();
try
{
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
sutResult
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
if
(!
string
.
IsNullOrWhiteSpace
(
sutResult
))
{
JObject
stuRootObj
=
JObject
.
Parse
(
sutResult
);
...
...
@@ -215,7 +230,11 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"CourseManager_RunCourseStudent"
,
ex
:
ex
);
}
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
courseStudentRepository
.
BatchSetCourseStudentRepository
(
list
);
...
...
@@ -233,24 +252,25 @@ namespace EduSpider.Spiders.ClassInRule
/// <param name="courseId"></param>
public
static
async
void
RunCourseTeacher
(
string
cookie
,
int
courseId
)
{
List
<
RB_Course_Teacher
>
list
=
new
();
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
string
queryStr
=
"courseId={0}"
;
string
paramStr
=
string
.
Format
(
queryStr
,
courseId
);
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
ICourseTeacherRepository
courseTeacherRepository
=
new
CourseTeacherRepository
();
InfoHelper
.
WriteLine
(
string
.
Format
(
"开始获取{0}课程老师数据"
,
courseId
));
string
url
=
"https://console.eeo.cn/saasajax/course.ajax.php?action=getCourseTeacherList"
;
try
{
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
teacherResult
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
List
<
RB_Course_Teacher
>
list
=
new
();
if
(!
string
.
IsNullOrWhiteSpace
(
teacherResult
))
{
JObject
teacherRootObj
=
JObject
.
Parse
(
teacherResult
);
if
(!
string
.
IsNullOrWhiteSpace
(
teacherRootObj
.
GetString
(
"data"
)))
{
JObject
teacherObj
=
JObject
.
Parse
(
teacherRootObj
.
GetString
(
"data"
));
JObject
teacherObj
=
JObject
.
Parse
(
teacherRootObj
.
GetString
(
"data"
));
if
(!
string
.
IsNullOrWhiteSpace
(
teacherObj
.
GetString
(
"teacherList"
)))
{
JArray
courseTeacherArray
=
JArray
.
Parse
(
teacherObj
.
GetString
(
"teacherList"
));
...
...
@@ -268,13 +288,18 @@ namespace EduSpider.Spiders.ClassInRule
logo
=
infoObj
.
GetString
(
"logo"
),
name
=
infoObj
.
GetString
(
"name"
),
courseId
=
courseId
,
courseTeacherId
=
courseTeacherObj
.
GetInt
(
"courseTeacherId"
)
courseTeacherId
=
courseTeacherObj
.
GetInt
(
"courseTeacherId"
)
});
}
}
}
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"CourseManager_RunCourseTeacher"
,
ex
:
ex
);
}
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
courseTeacherRepository
.
BatchSetCourseTeacherRepository
(
list
);
...
...
@@ -288,6 +313,8 @@ namespace EduSpider.Spiders.ClassInRule
/// <param name="courseId"></param>
public
static
async
void
RunCourseInfo
(
string
cookie
,
int
courseId
)
{
List
<
rb_course_hk
>
list
=
new
();
List
<
RB_Course_Teacher
>
teacherList
=
new
();
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
string
queryStr
=
"courseId={0}"
;
string
paramStr
=
string
.
Format
(
queryStr
,
courseId
);
...
...
@@ -297,10 +324,11 @@ namespace EduSpider.Spiders.ClassInRule
InfoHelper
.
WriteLine
(
string
.
Format
(
"开始获取{0}课程详情数据"
,
courseId
));
string
url
=
"https://console.eeo.cn/saasajax/course.ajax.php?action=getCourseInfo"
;
try
{
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
courseInfoResult
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
List
<
rb_course_hk
>
list
=
new
();
List
<
RB_Course_Teacher
>
teacherList
=
new
();
if
(!
string
.
IsNullOrWhiteSpace
(
courseInfoResult
))
{
JObject
courseRootObj
=
JObject
.
Parse
(
courseInfoResult
);
...
...
@@ -321,7 +349,7 @@ namespace EduSpider.Spiders.ClassInRule
TotalClassNum
=
courseObj
.
GetInt
(
"totalClassNum"
),
ExpiryTime
=
expiryTime
,
LiveNum
=
courseObj
.
GetInt
(
"liveNum"
),
RecordNum
=
0
,
RecordNum
=
0
,
OpenNum
=
courseObj
.
GetInt
(
"openNum"
),
StudentNum
=
courseObj
.
GetInt
(
"studentNum"
),
AuditNum
=
courseObj
.
GetInt
(
"auditNum"
),
...
...
@@ -369,6 +397,11 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"CourseManager_RunCourseInfo"
,
ex
:
ex
);
}
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
courseRepository
.
BatchSetCourseOtherRepository
(
list
);
...
...
@@ -397,18 +430,20 @@ namespace EduSpider.Spiders.ClassInRule
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
string
queryStr
=
$"courseKey=
{
searchKey
}
"
;
var
content
=
new
StringContent
(
queryStr
,
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
var
lessonKeyList
=
new
List
<
string
>();
int
lessonVodCount
=
0
;
string
url
=
"https://live.eeo.cn/saasajax/webcast.ajax.php?action=getLessonList"
;
try
{
var
response
=
request
.
PostAsync
(
url
,
content
).
Result
;
var
result
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
var
lessonKeyList
=
new
List
<
string
>();
int
lessonVodCount
=
0
;
if
(!
string
.
IsNullOrWhiteSpace
(
result
))
{
var
rootObj
=
JObject
.
Parse
(
result
);
if
(
rootObj
.
ContainsKey
(
"data"
))
{
JArray
dataArray
=
JArray
.
Parse
(
rootObj
[
"data"
].
ToString
());
if
(
dataArray
!=
null
&&
dataArray
.
Count
>
0
)
if
(
dataArray
!=
null
&&
dataArray
.
Count
>
0
)
{
foreach
(
var
sItem
in
dataArray
)
{
...
...
@@ -423,7 +458,12 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
if
(
lessonVodCount
>
0
)
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"CourseManager_GetCourseLessionList"
,
ex
:
ex
);
}
if
(
lessonVodCount
>
0
)
{
var
resultList
=
new
List
<
string
>();
//var request2 = Utility.HttpHelper.GenerateHttp(cookie);
...
...
EduSpider/Spiders/ClassInRule/HomeWorkManager.cs
View file @
94d5dbd2
...
...
@@ -33,7 +33,8 @@ namespace EduSpider.Spiders.ClassInRule
IHomeWorkRepository
homeWorkRepository
=
new
HomeWorkRepository
();
IStuHomeWorkRepository
stuHomeWorkRepository
=
new
StuHomeWorkRepository
();
int
totalCount
=
0
;
try
{
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
;
...
...
@@ -71,6 +72,8 @@ namespace EduSpider.Spiders.ClassInRule
{
Thread
.
Sleep
(
1000
*
2
);
paramStr
=
string
.
Format
(
queryStr
,
i
,
perpage
);
try
{
var
sub_content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
var
sub_response
=
await
request
.
PostAsync
(
url
,
sub_content
);
var
sub_result
=
sub_response
.
Content
.
ReadAsStringAsync
().
Result
;
...
...
@@ -99,10 +102,20 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
catch
(
Exception
ex2
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"HomeWorkManager_RunHomeWork2"
,
ex
:
ex2
);
}
}
}
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"HomeWorkManager_RunHomeWork"
,
ex
:
ex
);
}
}
/// <summary>
/// JSON字符串转课程列表
...
...
@@ -165,7 +178,7 @@ namespace EduSpider.Spiders.ClassInRule
/// </summary>
/// <param name="cookie"></param>
/// <param name="homework_id"></param>
public
static
async
void
RunStuHomeWork
(
string
cookie
,
int
homework_id
,
int
courseId
)
public
static
async
void
RunStuHomeWork
(
string
cookie
,
int
homework_id
,
int
courseId
)
{
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
IStuHomeWorkRepository
stuHomeWorkRepository
=
new
StuHomeWorkRepository
();
...
...
@@ -182,9 +195,11 @@ namespace EduSpider.Spiders.ClassInRule
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
InfoHelper
.
WriteLine
(
string
.
Format
(
"开始获取{0}作业学员数据"
,
homework_id
));
string
url
=
"https://console.eeo.cn/saasajax/homework.ajax.php?action=getStudentsHomeworkList"
;
List
<
RB_Stu_HomeWork
>
list
=
new
();
try
{
var
response
=
await
request
.
PostAsync
(
url
,
content
);
var
sutHomeWorkResult
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
List
<
RB_Stu_HomeWork
>
list
=
new
();
if
(!
string
.
IsNullOrWhiteSpace
(
sutHomeWorkResult
))
{
JObject
stuHomeRootObj
=
JObject
.
Parse
(
sutHomeWorkResult
);
...
...
@@ -224,7 +239,7 @@ namespace EduSpider.Spiders.ClassInRule
is_revised
=
lastObj
.
GetInt
(
"is_revised"
),
is_startd
=
lastObj
.
GetInt
(
"is_startd"
),
readover
=
lastObj
.
GetString
(
"readover"
),
ref_time
=
ConvertHelper
.
UnixToDateTime
(
lastObj
.
GetInt
(
"ref_time"
)),
ref_time
=
ConvertHelper
.
UnixToDateTime
(
lastObj
.
GetInt
(
"ref_time"
)),
comment
=
lastObj
.
GetString
(
"comment"
),
reform
=
lastObj
.
GetString
(
"reform"
),
school_uid
=
lastObj
.
GetInt
(
"school_uid"
),
...
...
@@ -233,7 +248,7 @@ namespace EduSpider.Spiders.ClassInRule
score_type
=
lastObj
.
GetInt
(
"score_type"
),
show_time
=
ConvertHelper
.
UnixToDateTime
(
lastObj
.
GetInt
(
"show_time"
)),
status
=
lastObj
.
GetInt
(
"status"
),
stu_homework_share_key
=
lastObj
.
GetString
(
"stu_homework_share_key"
),
stu_homework_share_key
=
lastObj
.
GetString
(
"stu_homework_share_key"
),
student_account
=
lastObj
.
GetString
(
"student_account"
),
student_name
=
lastObj
.
GetString
(
"student_name"
),
student_uid
=
lastObj
.
GetInt
(
"student_uid"
),
...
...
@@ -254,6 +269,11 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"HomeWorkManager_RunStuHomeWork"
,
ex
:
ex
);
}
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
stuHomeWorkRepository
.
BatchSetStuHomeWorkRepository
(
list
);
...
...
EduSpider/Spiders/ClassInRule/QuestionManager.cs
View file @
94d5dbd2
...
...
@@ -10,7 +10,6 @@ using System.Linq;
using
System.Net.Http
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
VTX.FW.Helper
;
namespace
EduSpider.Spiders.ClassInRule
...
...
@@ -27,11 +26,13 @@ namespace EduSpider.Spiders.ClassInRule
var
range
=
$"[1609430400,
{
ConvertHelper
.
DateTimeToUnix
(
DateTime
.
Now
)}
]"
;
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
string
queryStr
=
"page={0}&perpage={1}&examStatus=&paperName=&courseName=&arrangeTime={2}&display=0"
;
string
paramStr
=
string
.
Format
(
queryStr
,
pageCount
,
perpage
,
range
);
string
paramStr
=
string
.
Format
(
queryStr
,
pageCount
,
perpage
,
range
);
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
IHomeWorkRepository
homeWorkRepository
=
new
HomeWorkRepository
();
int
totalCount
=
0
;
string
url
=
"https://console.eeo.cn/saasajax/exam.ajax.php?action=getExamManageList"
;
try
{
var
response
=
request
.
PostAsync
(
url
,
content
);
var
result
=
response
.
Result
.
Content
.
ReadAsStringAsync
().
Result
;
if
(!
string
.
IsNullOrWhiteSpace
(
result
))
...
...
@@ -41,7 +42,7 @@ namespace EduSpider.Spiders.ClassInRule
{
JObject
dataObj
=
JObject
.
Parse
(
rootObj
.
GetString
(
"data"
));
var
totalNum
=
dataObj
.
GetInt
(
"totalSum"
);
var
tempList
=
ParseJson
(
dataObj
.
GetString
(
"examsData"
),
cookie
);
var
tempList
=
ParseJson
(
dataObj
.
GetString
(
"examsData"
),
cookie
);
if
(
tempList
!=
null
&&
tempList
.
Count
>
0
)
{
homeWorkRepository
.
BatchSetHomeWorkRepository
(
tempList
);
...
...
@@ -50,7 +51,7 @@ namespace EduSpider.Spiders.ClassInRule
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"QuestionManager_RunHomeWork"
,
string
.
Format
(
"第{0}次,导入完成{1}条."
,
pageCount
,
totalCount
));
foreach
(
var
item
in
tempList
)
{
RunStuHomeWork
(
cookie
,
item
.
Homework_id
,
item
.
Course_id
,
item
);
RunStuHomeWork
(
cookie
,
item
.
Homework_id
,
item
.
Course_id
,
item
);
}
}
if
(
totalNum
%
perpage
==
0
)
...
...
@@ -67,11 +68,11 @@ namespace EduSpider.Spiders.ClassInRule
for
(
var
i
=
2
;
i
<=
pageCount
;
i
++)
{
Thread
.
Sleep
(
1000
*
2
);
paramStr
=
string
.
Format
(
queryStr
,
i
,
perpage
,
range
);
var
sub_content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
try
{
var
sub_response
=
request
.
PostAsync
(
url
,
sub_content
);
var
sub_result
=
sub_response
.
Result
.
Content
.
ReadAsStringAsync
().
Result
;
if
(!
string
.
IsNullOrWhiteSpace
(
sub_result
))
{
...
...
@@ -79,7 +80,7 @@ namespace EduSpider.Spiders.ClassInRule
if
(!
string
.
IsNullOrWhiteSpace
(
sub_rootObj
.
GetString
(
"data"
)))
{
JObject
sub_dataObj
=
JObject
.
Parse
(
sub_rootObj
.
GetString
(
"data"
));
var
subtempList
=
ParseJson
(
sub_dataObj
.
GetString
(
"list"
),
cookie
);
var
subtempList
=
ParseJson
(
sub_dataObj
.
GetString
(
"list"
),
cookie
);
if
(
subtempList
!=
null
&&
subtempList
.
Count
>
0
)
{
homeWorkRepository
.
BatchSetHomeWorkRepository
(
subtempList
);
...
...
@@ -94,19 +95,30 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
catch
(
Exception
ex2
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"QuestionManager_RunHomeWork2"
,
ex
:
ex2
);
}
}
}
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"QuestionManager_RunHomeWork"
,
ex
:
ex
);
}
}
public
static
void
RequestExamDetail
(
string
cookie
,
int
courseId
,
int
examId
,
int
tid
,
ref
RB_HomeWork
m
)
public
static
void
RequestExamDetail
(
string
cookie
,
int
courseId
,
int
examId
,
int
tid
,
ref
RB_HomeWork
m
)
{
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RequestExamDetail"
,
$"正在查询测验详细信息"
);
var
paramStr
=
$"courseId=
{
courseId
}
&examsId=[
{
examId
}
]&teachersId=[
{
tid
}
]&page=1&perpage=20"
;
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
try
{
var
response
=
request
.
PostAsync
(
"https://console.eeo.cn/saasajax/exam.ajax.php?action=getCourseExamAnalysisList"
,
content
);
var
resultStr
=
response
.
Result
.
Content
.
ReadAsStringAsync
().
Result
??
string
.
Empty
;
var
result
=
resultStr
.
TryToJObject
();
if
(
result
.
flag
)
...
...
@@ -120,11 +132,8 @@ namespace EduSpider.Spiders.ClassInRule
m
.
Revised_num
=
0
;
//未匹配数据;
m
.
Rnum
=
homeObj
.
GetInt
(
"beReviewStSum"
);
m
.
Cnum
=
homeObj
.
GetInt
(
"endStSum"
);
m
.
Score_value
=
homeObj
.
GetDecimal
(
"score_value"
);
m
.
Th_cancel
=
string
.
Empty
;
m
.
Ref_num
=
homeObj
.
GetInt
(
"needReStSum"
);
m
.
Refc_num
=
homeObj
.
GetInt
(
"alreadyReStSum"
);
m
.
Av_score
=
homeObj
.
GetDecimal
(
"averageScore"
)
/
100
;
...
...
@@ -133,13 +142,18 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"QuestionManager_RequestExamDetail"
,
ex
:
ex
);
}
}
/// <summary>
/// JSON字符串转课程列表
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public
static
List
<
RB_HomeWork
>
ParseJson
(
string
data
,
string
cookie
)
public
static
List
<
RB_HomeWork
>
ParseJson
(
string
data
,
string
cookie
)
{
List
<
RB_HomeWork
>
list
=
new
();
if
(!
string
.
IsNullOrWhiteSpace
(
data
))
...
...
@@ -215,9 +229,11 @@ namespace EduSpider.Spiders.ClassInRule
InfoHelper
.
WriteLine
(
string
.
Format
(
"开始获取{0}作业学员数据"
,
homework_id
));
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunStuHomeWork"
,
string
.
Format
(
"开始获取{0}作业学员数据"
,
homework_id
));
string
url
=
"https://console.eeo.cn/saasajax/exam.ajax.php?action=getCourseExamsStDetailList"
;
List
<
RB_Stu_HomeWork
>
list
=
new
();
try
{
var
response
=
request
.
PostAsync
(
url
,
content
);
var
sutHomeWorkResult
=
response
.
Result
.
Content
.
ReadAsStringAsync
().
Result
;
List
<
RB_Stu_HomeWork
>
list
=
new
();
if
(!
string
.
IsNullOrWhiteSpace
(
sutHomeWorkResult
))
{
JObject
stuHomeRootObj
=
JObject
.
Parse
(
sutHomeWorkResult
);
...
...
@@ -252,7 +268,7 @@ namespace EduSpider.Spiders.ClassInRule
correct
=
lastObj
.
GetDecimal
(
"correctSum"
),
wrong
=
lastObj
.
GetInt
(
"mistakeSum"
),
course_id
=
courseId
,
is_cream
=
Convert
.
ToDecimal
(
tempCream
)>=
80
?
1
:
0
,
is_cream
=
Convert
.
ToDecimal
(
tempCream
)
>=
80
?
1
:
0
,
emend
=
0
,
homework_id
=
homework_id
,
homework_share_key
=
string
.
Empty
,
...
...
@@ -265,8 +281,8 @@ namespace EduSpider.Spiders.ClassInRule
comment
=
string
.
Empty
,
reform
=
string
.
Empty
,
school_uid
=
0
,
score
=
lastObj
.
GetDecimal
(
"examScore"
)/
100
,
score_p
=
Convert
.
ToDecimal
(
tempCream
)/
100
,
score
=
lastObj
.
GetDecimal
(
"examScore"
)
/
100
,
score_p
=
Convert
.
ToDecimal
(
tempCream
)
/
100
,
score_type
=
5
,
show_time
=
ConvertHelper
.
UnixToDateTime
(
lastObj
.
GetInt
(
"endTime"
)),
status
=
tempStatus
,
...
...
@@ -291,6 +307,11 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"QuestionManager_RunStuHomeWork"
,
ex
:
ex
);
}
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
stuHomeWorkRepository
.
BatchSetStuHomeWorkRepository
(
list
);
...
...
EduSpider/Spiders/ClassInRule/StudentManager.cs
View file @
94d5dbd2
...
...
@@ -18,10 +18,14 @@ namespace EduSpider.Spiders.ClassInRule
private
static
readonly
IStudentRepository
courseRepository
=
new
StudentRepository
();
/// <summary>
/// 获取学生数据
/// </summary>
/// <param name="cookie"></param>
public
static
async
void
RunAsync
(
string
cookie
)
{
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
int
pageIndex
=
1
,
pageCount
=
1
,
pageSize
=
500
;
int
pageIndex
=
1
,
pageCount
=
1
,
pageSize
=
500
;
#
region
获取最大学生
ID
//更新账户
...
...
@@ -37,27 +41,24 @@ namespace EduSpider.Spiders.ClassInRule
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"
);
try
{
var
response
=
await
request
.
PostAsync
(
"https://console.eeo.cn/saasajax/student.ajax.php?action=getSchoolStudentListByPage"
,
content
);
var
resultStr
=
response
.
Content
.
ReadAsStringAsync
().
Result
??
string
.
Empty
;
var
result
=
resultStr
.
TryToJObject
();
if
(
result
.
flag
)
{
var
data
=
(
result
.
val
.
ContainsKey
(
"data"
)
?
result
.
val
[
"data"
]
:
new
JObject
())
as
JObject
;
if
(
data
.
ContainsKey
(
"totalStudentNum"
))
{
if
(
data
.
ContainsKey
(
"totalStudentNum"
))
{
#
region
更新
PageCount
if
(
pageIndex
==
1
)
{
pageCount
=
(
int
)
Math
.
Ceiling
(
data
.
GetDecimal
(
"totalStudentNum"
)
/
pageSize
);
}
#
endregion
#
region
组装实体
var
stus
=
new
List
<
rb_student_hk
>();
var
stuArray
=
(
data
[
"studentList"
]
as
JArray
);
foreach
(
JObject
x
in
stuArray
)
...
...
@@ -65,8 +66,8 @@ namespace EduSpider.Spiders.ClassInRule
stus
.
Add
(
new
rb_student_hk
()
{
AddTime
=
ConvertHelper
.
UnixToDateTime
(
x
.
GetString
(
"addTime"
)),
StudentAccount
=
x
.
GetString
(
"studentAccount"
),
Isdel
=
x
.
GetInt
(
"isdel"
,
0
),
StudentAccount
=
x
.
GetString
(
"studentAccount"
),
Isdel
=
x
.
GetInt
(
"isdel"
,
0
),
IsGroup
=
x
.
GetInt
(
"isGroup"
,
0
),
StudId
=
x
.
GetInt
(
"studId"
,
0
),
Progress
=
x
.
GetString
(
"progress"
),
...
...
@@ -83,7 +84,8 @@ namespace EduSpider.Spiders.ClassInRule
#
endregion
#
region
写入账号
if
(
stus
.
Any
(
x
=>
x
.
StudId
>
MaxStuId
))
{
if
(
stus
.
Any
(
x
=>
x
.
StudId
>
MaxStuId
))
{
foreach
(
var
item
in
stus
.
Where
(
x
=>
x
.
StudId
>
MaxStuId
))
{
accountList
.
Add
(
new
rb_account_hk
()
...
...
@@ -103,6 +105,11 @@ namespace EduSpider.Spiders.ClassInRule
#
endregion
}
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"StudentManager_RunAsync"
,
ex
:
ex
);
}
pageIndex
++;
}
...
...
@@ -115,8 +122,6 @@ namespace EduSpider.Spiders.ClassInRule
InfoHelper
.
WriteLine
(
"学员同步完成"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"学员同步完成"
);
}
}
}
EduSpider/Spiders/ClassInRule/TeacherManager.cs
View file @
94d5dbd2
...
...
@@ -29,6 +29,8 @@ namespace EduSpider.Spiders.ClassInRule
{
string
paramStr
=
string
.
Format
(
"page={0}&perpage={1}"
,
pageIndex
,
perpage
);
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
try
{
var
response
=
await
request
.
PostAsync
(
"https://console.eeo.cn/saasajax/teacher.ajax.php?action=getSchoolTeacherFullList"
,
content
);
var
result
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
if
(!
string
.
IsNullOrWhiteSpace
(
result
))
...
...
@@ -54,7 +56,6 @@ namespace EduSpider.Spiders.ClassInRule
}
}
}
list
.
AddRange
(
ParseJson
(
rlist
));
}
}
...
...
@@ -63,6 +64,11 @@ namespace EduSpider.Spiders.ClassInRule
Console
.
WriteLine
(
"result"
,
result
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunTeacher"
,
$"result:
{
result
}
"
);
}
}
catch
(
Exception
ex
)
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteError
(
"RunTeacher"
,
ex
:
ex
);
}
if
(
pageIndex
==
pageCount
)
{
break
;
...
...
EduSpider/Spiders/ICookiesManager.cs
deleted
100644 → 0
View file @
47041ac9
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
TicketSpider.Spiders
{
public
interface
ICookiesManager
{
}
}
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