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
b9207005
Commit
b9207005
authored
Jun 02, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
648e63e5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
22 deletions
+45
-22
StuCommentRepository.cs
EduSpider.Repository/StuCommentRepository.cs
+16
-1
TeacherController.cs
EduSpider.WebApi/Controllers/Student/TeacherController.cs
+4
-5
ClassInAccountManager.cs
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
+0
-4
ClassInFlow.cs
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
+14
-3
StudentManager.cs
EduSpider/Spiders/ClassInRule/StudentManager.cs
+1
-1
TeacherManager.cs
EduSpider/Spiders/ClassInRule/TeacherManager.cs
+10
-8
No files found.
EduSpider.Repository/StuCommentRepository.cs
View file @
b9207005
...
...
@@ -85,7 +85,22 @@ WHERE 1=1
/// <returns></returns>
public
bool
BatchSetStuCommentRepository
(
List
<
RB_Stu_Comment
>
list
)
{
bool
flag
=
base
.
BatchInsert
(
list
);
bool
flag
=
false
;
// 以前批量添加接口
// flag = base.BatchInsert(list);
foreach
(
var
item
in
list
)
{
var
defaultModel
=
GetStuCommentListRepository
(
new
CourseQuery
()
{
CourseId
=
item
.
CourseId
,
CommentTimes
=
item
.
Times
,
StuIds
=
item
.
StuUid
.
ToString
(),
HomeWorkId
=
item
.
HomeWorkId
,
}).
FirstOrDefault
();
item
.
CreateTime
=
defaultModel
.
CreateTime
.
AddSeconds
(
1
);
item
.
HomeWorkId
=
defaultModel
.
HomeWorkId
;
flag
=
base
.
Insert
(
item
)
>
0
;
}
return
flag
;
}
...
...
EduSpider.WebApi/Controllers/Student/TeacherController.cs
View file @
b9207005
...
...
@@ -34,7 +34,7 @@ namespace EduSpider.WebApi.Controllers
public
ApiResult
GetTeacherCourse
()
{
var
userInfo
=
base
.
UserInfo
;
var
query
=
new
Model
.
Query
.
CourseQuery
()
var
query
=
new
CourseQuery
()
{
TeacherIds
=
userInfo
.
AccountId
.
ToString
(),
KeyWords
=
base
.
ReqParameters
.
GetString
(
"KeyWords"
),
...
...
@@ -84,7 +84,7 @@ namespace EduSpider.WebApi.Controllers
[
HttpGet
]
public
ApiResult
GetCourseStu
()
{
var
query
=
new
Model
.
Query
.
CourseQuery
()
var
query
=
new
CourseQuery
()
{
CourseId
=
base
.
ReqParameters
.
GetInt
(
"courseId"
)
};
...
...
@@ -277,9 +277,8 @@ namespace EduSpider.WebApi.Controllers
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
),
Times
=
base
.
ReqParameters
.
GetInt
(
"Times"
),
Info
=
base
.
ReqParameters
.
GetString
(
"Info"
),
CreateType
=
base
.
ReqParameters
.
GetInt
(
"CreateType"
)
,
CreateType
=
2
,
};
model
.
ShowType
=
3
;
model
.
Status
=
0
;
model
.
CreateTime
=
System
.
DateTime
.
Now
;
...
...
@@ -289,7 +288,7 @@ namespace EduSpider.WebApi.Controllers
}
}
}
var
flag
=
CourseService
.
BatchSetStuComment
(
list
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
...
...
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
View file @
b9207005
...
...
@@ -132,10 +132,6 @@ namespace TicketSpider.Spiders.ClassInRule
_loginCookies
+=
item
.
Name
+
"="
+
item
.
Value
+
";"
;
}
_loginCookies
=
_loginCookies
.
Substring
(
0
,
_loginCookies
.
Length
-
1
);
//var jscript = (IJavaScriptExecutor)driver;
//var userInfo = JObject.Parse((string)jscript.ExecuteScript("return window.sessionStorage.getItem('user')"));
//_userId = userInfo["userId"].ToString();
flag
=
true
;
break
;
}
...
...
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
View file @
b9207005
...
...
@@ -18,17 +18,28 @@ namespace TicketSpider.Spiders.ClassInRule
public
void
StartAsync
()
{
Console
.
WriteLine
(
"开始模拟登录信息......."
);
string
loginCookies
=
""
;
string
loginCookies
;
//自定获取Cookie
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
);
Console
.
WriteLine
(
"开始获取老师信息"
);
new
TeacherManager
()
.
RunTeacher
(
loginCookies
);
TeacherManager
.
RunTeacher
(
loginCookies
);
Console
.
WriteLine
(
"老师信息更新结束"
);
new
StudentManager
().
RunAsync
(
loginCookies
);
Console
.
WriteLine
(
"开始获取学生信息"
);
StudentManager
.
RunAsync
(
loginCookies
);
Console
.
WriteLine
(
"学生信息更新结束"
);
Console
.
WriteLine
(
"开始获取课程信息"
);
CourseManager
.
RunCourse
(
loginCookies
);
Console
.
WriteLine
(
"课程信息更新结束"
);
Console
.
WriteLine
(
"开始获取作业信息"
);
HomeWorkManager
.
RunHomeWork
(
loginCookies
);
Console
.
WriteLine
(
"作业信息更新结束"
);
}
}
}
EduSpider/Spiders/ClassInRule/StudentManager.cs
View file @
b9207005
...
...
@@ -17,7 +17,7 @@ namespace EduSpider.Spiders.ClassInRule
private
static
readonly
IStudentRepository
courseRepository
=
new
StudentRepository
();
public
async
void
RunAsync
(
string
cookie
)
public
static
async
void
RunAsync
(
string
cookie
)
{
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
int
pageIndex
=
1
,
pageCount
=
1
,
pageSize
=
500
;
...
...
EduSpider/Spiders/ClassInRule/TeacherManager.cs
View file @
b9207005
...
...
@@ -20,12 +20,13 @@ namespace EduSpider.Spiders.ClassInRule
/// <summary>
/// 获取老师列表
/// </summary>
public
async
void
RunTeacher
(
string
cookie
)
public
static
async
void
RunTeacher
(
string
cookie
)
{
int
perpage
=
20
,
pageIndex
=
1
,
pageCount
=
1
;
var
request
=
Utility
.
HttpHelper
.
GenerateHttp
(
cookie
);
List
<
RB_Teacher
>
list
=
new
();
while
(
true
)
{
while
(
true
)
{
string
paramStr
=
string
.
Format
(
"page={0}&perpage={1}"
,
pageIndex
,
perpage
);
var
content
=
new
StringContent
(
paramStr
,
System
.
Text
.
Encoding
.
UTF8
,
"application/x-www-form-urlencoded"
);
var
response
=
await
request
.
PostAsync
(
"https://console.eeo.cn/saasajax/teacher.ajax.php?action=getSchoolTeacherFullList"
,
content
);
...
...
@@ -62,12 +63,13 @@ namespace EduSpider.Spiders.ClassInRule
{
Console
.
WriteLine
(
"result"
,
result
);
}
if
(
pageIndex
==
pageCount
)
{
if
(
pageIndex
==
pageCount
)
{
break
;
}
pageIndex
++;
}
ITeacherRepository
teacherRepository
=
new
TeacherRepository
();
bool
flag
=
teacherRepository
.
BatchSetTeache
(
list
.
OrderBy
(
x
=>
x
.
TeacherId
).
ToList
());
if
(
flag
)
...
...
@@ -87,7 +89,7 @@ namespace EduSpider.Spiders.ClassInRule
Id
=
item
.
TeacherId
,
Account
=
item
.
TeacherAccount
,
AccountId
=
item
.
TeacherUid
,
AccountType
=
AccountTypeEnum
.
Teacher
,
AccountType
=
AccountTypeEnum
.
Teacher
,
OpenId
=
""
,
Password
=
DESHepler
.
Encrypt
(
item
.
TeacherAccount
[^
6.
.]),
Status
=
0
,
...
...
@@ -107,14 +109,15 @@ namespace EduSpider.Spiders.ClassInRule
public
static
List
<
RB_Teacher
>
ParseJson
(
string
data
)
{
List
<
RB_Teacher
>
list
=
new
();
JArray
courseArray
=
JArray
.
Parse
(
data
);
JArray
courseArray
=
JArray
.
Parse
(
data
);
if
(
courseArray
!=
null
&&
courseArray
.
Count
>
0
)
{
foreach
(
var
jItem
in
courseArray
)
{
JObject
rObj
=
JObject
.
Parse
(
jItem
.
ToString
());
string
Logo
=
rObj
.
GetString
(
"logo"
);
if
(!
string
.
IsNullOrEmpty
(
Logo
))
{
if
(!
string
.
IsNullOrEmpty
(
Logo
))
{
Logo
=
"https://console.eeo.cn/upload/images/"
+
Logo
;
}
list
.
Add
(
new
RB_Teacher
()
...
...
@@ -138,7 +141,6 @@ namespace EduSpider.Spiders.ClassInRule
});
}
}
return
list
;
}
}
...
...
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