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
6ebc1f63
Commit
6ebc1f63
authored
May 25, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
3976aca0
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
232 additions
and
16 deletions
+232
-16
ICourseRepository.cs
EduSpider.IRepository/ICourseRepository.cs
+0
-4
ICourseStudentRepository.cs
EduSpider.IRepository/ICourseStudentRepository.cs
+21
-0
ICourseTeacherRepository.cs
EduSpider.IRepository/ICourseTeacherRepository.cs
+21
-0
IStudentRepository.cs
EduSpider.IRepository/IStudentRepository.cs
+0
-4
RB_Course_Student.cs
EduSpider.Model/Entity/RB_Course_Student.cs
+43
-0
RB_Course_Teacher.cs
EduSpider.Model/Entity/RB_Course_Teacher.cs
+43
-0
CourseRepository.cs
EduSpider.Repository/CourseRepository.cs
+0
-2
CourseStudentRepository.cs
EduSpider.Repository/CourseStudentRepository.cs
+24
-0
CourseTeacherRepository.cs
EduSpider.Repository/CourseTeacherRepository.cs
+24
-0
StudentRepository.cs
EduSpider.Repository/StudentRepository.cs
+0
-4
ClassInFlow.cs
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
+2
-2
CourseManager.cs
EduSpider/Spiders/ClassInRule/CourseManager.cs
+54
-0
No files found.
EduSpider.IRepository/ICourseRepository.cs
View file @
6ebc1f63
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Query
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
...
...
EduSpider.IRepository/ICourseStudentRepository.cs
0 → 100644
View file @
6ebc1f63
using
EduSpider.Model.Entity
;
using
System.Collections.Generic
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
namespace
EduSpider.Repository
{
/// <summary>
/// 课程学员关联仓储接口
/// </summary>
public
interface
ICourseStudentRepository
:
IDBRepository
<
RB_Course_Student
>,
IDependency
{
/// <summary>
/// 批量新增课程学员
/// </summary>
/// <param name="courses"></param>
/// <returns></returns>
public
bool
BatchSetCourseStudentRepository
(
List
<
RB_Course_Student
>
courses
);
}
}
EduSpider.IRepository/ICourseTeacherRepository.cs
0 → 100644
View file @
6ebc1f63
using
EduSpider.Model.Entity
;
using
System.Collections.Generic
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
namespace
EduSpider.Repository
{
/// <summary>
/// 课程老师关联仓储接口
/// </summary>
public
interface
ICourseTeacherRepository
:
IDBRepository
<
RB_Course_Teacher
>,
IDependency
{
/// <summary>
/// 批量新增课程老师
/// </summary>
/// <param name="courses"></param>
/// <returns></returns>
public
bool
BatchSetCourseTeacherRepository
(
List
<
RB_Course_Teacher
>
courses
);
}
}
EduSpider.IRepository/IStudentRepository.cs
View file @
6ebc1f63
using
EduSpider.Model.Entity
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
...
...
EduSpider.Model/Entity/RB_Course_Student.cs
0 → 100644
View file @
6ebc1f63
using
System
;
using
VTX.FW.Attr
;
namespace
EduSpider.Model.Entity
{
/// <summary>
/// 课程学员关联表实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Course_Student
{
/// <summary>
/// 主键编号
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 学员编号
/// </summary>
public
int
uid
{
get
;
set
;
}
/// <summary>
/// 学员姓名
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
/// 学员账号
/// </summary>
public
string
account
{
get
;
set
;
}
/// <summary>
/// 学员头像
/// </summary>
public
string
logo
{
get
;
set
;
}
/// <summary>
/// 课程编号
/// </summary>
public
int
courseId
{
get
;
set
;
}
}
}
EduSpider.Model/Entity/RB_Course_Teacher.cs
0 → 100644
View file @
6ebc1f63
using
System
;
using
VTX.FW.Attr
;
namespace
EduSpider.Model.Entity
{
/// <summary>
/// 课程实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Course_Teacher
{
/// <summary>
/// 主键编号
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 教师编号
/// </summary>
public
int
uid
{
get
;
set
;
}
/// <summary>
/// 电话
/// </summary>
public
string
phone
{
get
;
set
;
}
/// <summary>
/// 头像
/// </summary>
public
string
logo
{
get
;
set
;
}
/// <summary>
/// 姓名
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
/// 课程编号
/// </summary>
public
int
courseId
{
get
;
set
;
}
}
}
EduSpider.Repository/CourseRepository.cs
View file @
6ebc1f63
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Query
;
using
EduSpider.Repository.Base
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VTX.FW.DB.Dapper
;
namespace
EduSpider.Repository
...
...
EduSpider.Repository/CourseStudentRepository.cs
0 → 100644
View file @
6ebc1f63
using
EduSpider.Model.Entity
;
using
EduSpider.Repository.Base
;
using
System.Collections.Generic
;
namespace
EduSpider.Repository
{
/// <summary>
/// 课程学员关联仓储层
/// </summary>
public
class
CourseStudentRepository
:
BaseRepository
<
RB_Course_Student
>,
ICourseStudentRepository
{
/// <summary>
/// 批量新增课程学员
/// </summary>
/// <param name="courses"></param>
/// <returns></returns>
public
bool
BatchSetCourseStudentRepository
(
List
<
RB_Course_Student
>
courses
)
{
bool
flag
;
flag
=
base
.
BatchInsert
(
courses
,
isReplace
:
true
);
return
flag
;
}
}
}
EduSpider.Repository/CourseTeacherRepository.cs
0 → 100644
View file @
6ebc1f63
using
EduSpider.Model.Entity
;
using
EduSpider.Repository.Base
;
using
System.Collections.Generic
;
namespace
EduSpider.Repository
{
/// <summary>
/// 课程老师关联仓储层
/// </summary>
public
class
CourseTeacherRepository
:
BaseRepository
<
RB_Course_Teacher
>,
ICourseTeacherRepository
{
/// <summary>
/// 批量新增课程老师
/// </summary>
/// <param name="courses"></param>
/// <returns></returns>
public
bool
BatchSetCourseTeacherRepository
(
List
<
RB_Course_Teacher
>
courses
)
{
bool
flag
;
flag
=
base
.
BatchInsert
(
courses
,
isReplace
:
true
);
return
flag
;
}
}
}
EduSpider.Repository/StudentRepository.cs
View file @
6ebc1f63
using
EduSpider.IRepository
;
using
EduSpider.Model.Entity
;
using
EduSpider.Repository.Base
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
EduSpider.Repository
{
...
...
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
View file @
6ebc1f63
...
...
@@ -24,8 +24,8 @@ namespace TicketSpider.Spiders.ClassInRule
Console
.
WriteLine
(
"开始获取学员信息"
);
new
StudentManager
().
RunAsync
(
loginCookies
);
//new Student
Manager().RunCourse(loginCookies);
//
new StudentManager().RunAsync(loginCookies);
new
Course
Manager
().
RunCourse
(
loginCookies
);
}
}
...
...
EduSpider/Spiders/ClassInRule/CourseManager.cs
View file @
6ebc1f63
...
...
@@ -46,6 +46,10 @@ namespace EduSpider.Spiders.ClassInRule
courseRepository
.
BatchSetCourseRepository
(
tempList
);
totalCount
+=
tempList
.
Count
();
Console
.
WriteLine
(
string
.
Format
(
"第{0}次,导入完成{1}条."
,
pageCount
,
totalCount
));
foreach
(
var
item
in
tempList
)
{
RunCourseStudent
(
cookie
,
item
.
courseId
);
}
}
if
(
totalNum
%
perpage
==
0
)
{
...
...
@@ -78,6 +82,10 @@ namespace EduSpider.Spiders.ClassInRule
courseRepository
.
BatchSetCourseRepository
(
subtempList
);
totalCount
+=
subtempList
.
Count
();
Console
.
WriteLine
(
string
.
Format
(
"第{0}次,导入完成{1}条."
,
i
,
totalCount
));
foreach
(
var
sItem
in
subtempList
)
{
RunCourseStudent
(
cookie
,
sItem
.
courseId
);
}
}
}
}
...
...
@@ -134,5 +142,51 @@ namespace EduSpider.Spiders.ClassInRule
}
return
list
;
}
/// <summary>
/// 获取课程学员列表
/// </summary>
public
async
void
RunCourseStudent
(
string
cookie
,
int
courseId
)
{
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"
);
ICourseStudentRepository
courseStudentRepository
=
new
CourseStudentRepository
();
Console
.
WriteLine
(
string
.
Format
(
"开始获取{0}课程学员数据"
,
courseId
));
var
response
=
await
request
.
PostAsync
(
"https://console.eeo.cn/saasajax/student.ajax.php?action=getCourseStudentList"
,
content
);
var
result
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
List
<
RB_Course_Student
>
list
=
new
List
<
RB_Course_Student
>();
if
(!
string
.
IsNullOrWhiteSpace
(
result
))
{
JObject
rootObj
=
JObject
.
Parse
(
result
);
if
(!
string
.
IsNullOrWhiteSpace
(
rootObj
.
GetString
(
"data"
)))
{
JArray
courseStudentArray
=
JArray
.
Parse
(
rootObj
.
GetString
(
"data"
));
if
(
courseStudentArray
!=
null
&&
courseStudentArray
.
Count
>
0
)
{
foreach
(
var
jItem
in
courseStudentArray
)
{
JObject
courseStuObj
=
JObject
.
Parse
(
jItem
.
ToString
());
list
.
Add
(
new
RB_Course_Student
()
{
id
=
courseStuObj
.
GetInt
(
"id"
),
uid
=
courseStuObj
.
GetInt
(
"uid"
),
name
=
courseStuObj
.
GetString
(
"name"
),
account
=
courseStuObj
.
GetString
(
"account"
),
logo
=
courseStuObj
.
GetString
(
"logo"
),
courseId
=
courseId
});
}
}
}
}
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
courseStudentRepository
.
BatchSetCourseStudentRepository
(
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