Skip to content

Commit

Permalink
feat: add more fields (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
renbaoshuo authored Oct 24, 2024
1 parent 8d08977 commit ea69218
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions course.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,18 @@ func (s *Student) GetSemesterCourses(term, viewState, eventValidation string) ([

// TODO: performance optimization
res = append(res, &Course{
Name: htmlquery.OutputHTML(info[1], false),
Syllabus: constants.JwchPrefix + safeExtractRegex(`javascript:pop1\('(.*?)&`, safeExtractionValue(info[2], "a", "href", 0)),
LessonPlan: constants.JwchPrefix + safeExtractRegex(`javascript:pop1\('(.*?)&`, safeExtractionValue(info[2], "a", "href", 1)),
Type: htmlquery.OutputHTML(info[0], false),
Name: htmlquery.OutputHTML(info[1], false),
Syllabus: constants.JwchPrefix + safeExtractRegex(`javascript:pop1\('(.*?)&`, safeExtractionValue(info[2], "a", "href", 0)),
LessonPlan: constants.JwchPrefix + safeExtractRegex(`javascript:pop1\('(.*?)&`, safeExtractionValue(info[2], "a", "href", 1)),
// PaymentStatus: safeExtractionFirst(info[3], "font"),
Credits: safeExtractionFirst(info[4], "span"),
ElectiveType: utils.GetChineseCharacter(htmlquery.OutputHTML(info[5], false)),
ExamType: utils.GetChineseCharacter(htmlquery.OutputHTML(info[6], false)),
Teacher: htmlquery.OutputHTML(info[7], false),
ScheduleRules: scheduleRules,
RawScheduleRules: strings.Join(courseInfo8, "\n"),
RawExamTime: strings.TrimSpace(htmlquery.InnerText(info[9])),
RawAdjust: strings.Join(courseInfo11, "\n"),
Remark: htmlquery.OutputHTML(info[10], false),
})
Expand Down
12 changes: 9 additions & 3 deletions model.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ type Term struct {

// 课程信息
type Course struct {
Name string `json:"name"` // 课程名称
Syllabus string `json:"syllabus"` // 课程大纲
LessonPlan string `json:"lessonplan"` // 课程计划
Type string `json:"type"` // 修读类别
Name string `json:"name"` // 课程名称
Syllabus string `json:"syllabus"` // 课程大纲
LessonPlan string `json:"lessonplan"` // 课程计划
// PaymentStatus string `json:"paymentstatus"` // 缴费状态
Credits string `json:"credit"` // 学分
ElectiveType string `json:"electivetype"` // 选课类型
ExamType string `json:"examtype"` // 考试类别
Teacher string `json:"teacher"` // 任课教师
ScheduleRules []CourseScheduleRule `json:"scheduleRules"` // 上课时间地点规则
RawScheduleRules string `json:"rawScheduleRules"` // 上课时间地点(原始文本)
RawExamTime string `json:"rawExamTime"` // 考试时间地点(原始文本)
RawAdjust string `json:"rawAdjust"` // 调课信息(原始文本)
Remark string `json:"remark"` // 备注
}
Expand Down

0 comments on commit ea69218

Please sign in to comment.