Documentation
¶
Index ¶
- func GetValidateCode(image string) (string, error)
- type CalTerm
- type CalTermEvent
- type CalTermEvents
- type Config
- type Course
- type CourseAdjustRule
- type CourseFullWeekScheduleRule
- type CourseScheduleRule
- type CreditStatistics
- type EmptyRoomReq
- type ExamRoomInfo
- type ExamRoomReq
- type GPABean
- type GPAData
- type Lecture
- type LocateDate
- type Mark
- type NoticeDetail
- type NoticeDetailReq
- type NoticeInfo
- type NoticeInfoReq
- type ProxyConfig
- type SchoolCalendar
- type Student
- func (s *Student) CheckSession() error
- func (s *Student) ClearLoginData()
- func (s *Student) GetCET() ([]*UnifiedExam, error)
- func (s *Student) GetCredit() (creditStatistics []*CreditStatistics, err error)
- func (s *Student) GetCreditV2() (majorCredits, minorCredits []*CreditStatistics, err error)
- func (s *Student) GetCultivatePlan() (string, error)
- func (s *Student) GetEmptyRoom(req EmptyRoomReq) ([]string, error)
- func (s *Student) GetExamRoom(req ExamRoomReq) ([]*ExamRoomInfo, error)
- func (s *Student) GetGPA() (gpa *GPABean, err error)
- func (s *Student) GetIdentifierAndCookies() (string, []*http.Cookie, error)
- func (s *Student) GetInfo() (resp *StudentDetail, err error)
- func (s *Student) GetJS() ([]*UnifiedExam, error)
- func (s *Student) GetLectures() ([]*Lecture, error)
- func (s *Student) GetLocateDate() (*LocateDate, error)
- func (s *Student) GetMarks() (resp []*Mark, err error)
- func (s *Student) GetNoticeDetail(req *NoticeDetailReq) (*NoticeDetail, error)
- func (s *Student) GetNoticeInfo(req *NoticeInfoReq) (list []*NoticeInfo, totalPages int, err error)
- func (s *Student) GetQiShanEmptyRoom(req EmptyRoomReq) ([]string, error)
- func (s *Student) GetSchoolCalendar() (*SchoolCalendar, error)
- func (s *Student) GetSemesterCourses(term, viewState, eventValidation string) ([]*Course, error)
- func (s *Student) GetTermEvents(termId string) (*CalTermEvents, error)
- func (s *Student) GetTerms() (*Term, error)
- func (s *Student) GetWithIdentifier(url string) (*html.Node, error)
- func (s *Student) Login() error
- func (s *Student) NewRequest() *resty.Request
- func (s *Student) PostWithIdentifier(url string, formData map[string]string) (*html.Node, error)
- func (s *Student) SetCookies(cookies []*http.Cookie)
- func (s *Student) SetIdentifier(identifier string)
- func (s *Student) WithLoginData(identifier string, cookies []*http.Cookie) *Student
- func (s *Student) WithUser(id, password string) *Student
- type StudentDetail
- type Term
- type TunnelData
- type TunnelResponse
- type UnifiedExam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CalTermEvent ¶
type CalTermEvents ¶
type CalTermEvents struct {
TermId string `json:"termId"` // 学期ID
Term string `json:"term"` // 学期
SchoolYear string `json:"schoolYear"` // 学年
Events []CalTermEvent `json:"events"` // 事件
}
type Config ¶ added in v0.2.24
type Config struct {
Proxy ProxyConfig `json:"proxy"` // 代理配置
}
Config 应用配置
func LoadConfigFromEnv ¶ added in v0.2.24
func LoadConfigFromEnv() *Config
LoadConfigFromEnv 从环境变量加载配置
func (*Config) GetProxyURL ¶ added in v0.2.24
GetProxyURL 根据青果网络文档生成代理URL
func (*Config) GetTunnelAddress ¶ added in v0.2.24
GetTunnelAddress 获取青果网络隧道地址
type Course ¶
type Course struct {
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"` // 上课时间地点规则
FullWeekScheduleRules []CourseFullWeekScheduleRule `json:"fullWeekScheduleRules"` // 整周课程上课时间地点规则
AdjustRules []CourseAdjustRule `json:"adjustRules"` // 调课规则
RawScheduleRules string `json:"rawScheduleRules"` // 上课时间地点(原始文本)
RawExamTime string `json:"rawExamTime"` // 考试时间地点(原始文本)
RawAdjust string `json:"rawAdjust"` // 调课信息(原始文本)
Remark string `json:"remark"` // 备注
}
课程信息
type CourseAdjustRule ¶
type CourseAdjustRule struct {
OldWeek int `json:"oldWeek"` // 原-周次
OldWeekday int `json:"oldWeekday"` // 原-星期几
OldStartClass int `json:"oldStartClass"` // 原-开始节数
OldEndClass int `json:"oldEndClass"` // 原-结束节数
Canceled bool `json:"canceled"` // 是否取消
NewWeek int `json:"newWeek"` // 新-周次
NewWeekday int `json:"newWeekday"` // 新-星期几
NewStartClass int `json:"newStartClass"` // 新-开始节数
NewEndClass int `json:"newEndClass"` // 新-结束节数
NewLocation string `json:"newLocation"` // 新-上课地点
}
调课规则
type CourseFullWeekScheduleRule ¶ added in v0.2.18
type CourseFullWeekScheduleRule struct {
StartWeek int `json:"startWeek"` // 开始周
StartWeekDay int `json:"startWeekDay"` // 开始周在星期几
EndWeek int `json:"endWeek"` // 结束周
EndWeekDay int `json:"endWeekDay"` // 结束周在星期几
}
整周课程的上课时间地点规则
type CourseScheduleRule ¶
type CourseScheduleRule struct {
Location string `json:"location"` // 上课地点
StartClass int `json:"startClass"` // 开始节数
EndClass int `json:"endClass"` // 结束节数
StartWeek int `json:"startWeek"` // 开始周
EndWeek int `json:"endWeek"` // 结束周
Weekday int `json:"weekday"` // 星期几
Single bool `json:"single"` // 单周 (PS: 为啥不用 odd)
Double bool `json:"double"` // 双周 (PS: 为啥不用 even)
Adjust bool `json:"adjust"` // 调课
FromFullWeek bool `json:"fromFullWeek"` // 是否来自整周课程
}
周内课程的上课时间地点规则
func ApplyAdjustRules ¶ added in v0.2.40
func ApplyAdjustRules(scheduleRules []CourseScheduleRule, adjustRules []CourseAdjustRule) []CourseScheduleRule
ApplyAdjustRules 将调课规则应用到原始课程安排上,返回调整后的 ScheduleRules。 该函数会将匹配到的调课周次从原有规则中移除,并添加调课后的新规则。
type CreditStatistics ¶
type EmptyRoomReq ¶
type EmptyRoomReq struct {
Campus string `form:"campus" binding:"required"` // 校区
Time string `form:"time" binding:"required"` // 日期 格式:2023-09-22
Start string `form:"start" binding:"required"`
End string `form:"end" binding:"required"` // 查询第Start节到第End节
Building string `form:"build" binding:"required"` // 教学楼名
}
空教室请求
type ExamRoomInfo ¶ added in v0.1.8
type ExamRoomReq ¶ added in v0.1.8
type ExamRoomReq struct {
Term string
}
type Lecture ¶ added in v0.2.38
type Lecture struct {
Category string `json:"category"` // 讲座类别
IssueNumber int `json:"issue_number"` // 期号
Title string `json:"title"` // 讲座题目
Speaker string `json:"speaker"` // 主讲人
Timestamp int64 `json:"timestamp"` // 时间戳
Location string `json:"location"` // 地点
AttendanceStatus string `json:"attendance_status"` // 听取讲座情况
}
Lecture 讲座信息
type LocateDate ¶ added in v0.2.12
LocateDate 当前时间
type Mark ¶
type Mark struct {
Type string `json:"type"` // 修读类别
Semester string `json:"semester"` // 开课学期
Name string `json:"name"` // 课程名称
Credits string `json:"credit"` // 计划学分
Score string `json:"score"` // 得分
GPA string `json:"GPA"` // 绩点
EarnedCredits string `json:"earned_credits"` // 得到学分
ElectiveType string `json:"electivetype"` // 选课类型
ExamType string `json:"examtype"` // 考试类别
Teacher string `json:"teacher"` // 任课教师
Classroom string `json:"classroom"` // 上课时间地点
ExamTime string `json:"examtime"` // 考试时间地点
}
type NoticeDetail ¶ added in v0.2.42
type NoticeDetail struct {
NoticeInfo
Content string // 通知内容
}
type NoticeDetailReq ¶ added in v0.2.42
type NoticeInfo ¶ added in v0.2.3
type NoticeInfoReq ¶ added in v0.2.3
type NoticeInfoReq struct {
PageNum int // 获取第几页的数据,从 1 开始
}
type ProxyConfig ¶ added in v0.2.24
type ProxyConfig struct {
AuthKey string `json:"auth_key"` // 青果网络认证密钥
AuthPwd string `json:"auth_pwd"` // 青果网络认证密码
ProxyServer string `json:"proxy_server"` // 代理服务器地址 (从隧道接口获取)
Enabled bool `json:"enabled"` // 是否启用代理
}
ProxyConfig 青果网络代理配置
type SchoolCalendar ¶
type SchoolCalendar struct {
CurrentTerm string `json:"currentTerm"` // 当前学期
Terms []CalTerm `json:"terms"` // 学期信息
}
校历
type Student ¶
type Student struct {
ID string `json:"id"` // 学号
Password string `json:"password"` // 密码
// 如果我们使用client进行登陆的话,此时该字段失效,因为client会在登录时自动保存登陆凭证(session)
// 所以该字段用于其他服务调用时传递登陆凭证
Identifier string // 位于url上id=....的一个标识符,主要用于组成url
// contains filtered or unexported fields
}
学生对象
func NewStudent ¶
func NewStudent() *Student
func (*Student) CheckSession ¶
CheckSession returns not nil if SessionExpired or AccountConflict
func (*Student) ClearLoginData ¶
func (s *Student) ClearLoginData()
func (*Student) GetCredit ¶
func (s *Student) GetCredit() (creditStatistics []*CreditStatistics, err error)
func (*Student) GetCreditV2 ¶ added in v0.2.34
func (s *Student) GetCreditV2() (majorCredits, minorCredits []*CreditStatistics, err error)
GetCreditV2 用于获取原始的学分统计
func (*Student) GetCultivatePlan ¶ added in v0.2.2
func (*Student) GetEmptyRoom ¶
func (s *Student) GetEmptyRoom(req EmptyRoomReq) ([]string, error)
func (*Student) GetExamRoom ¶ added in v0.1.8
func (s *Student) GetExamRoom(req ExamRoomReq) ([]*ExamRoomInfo, error)
考场查询
func (*Student) GetIdentifierAndCookies ¶
GetIdentifierAndCookies 方面服务端进行测试设置的接口
func (*Student) GetInfo ¶
func (s *Student) GetInfo() (resp *StudentDetail, err error)
GetInfo 获取学生个人信息
func (*Student) GetLectures ¶ added in v0.2.38
GetLectures 获取报名的讲座
func (*Student) GetLocateDate ¶ added in v0.2.12
func (s *Student) GetLocateDate() (*LocateDate, error)
func (*Student) GetNoticeDetail ¶ added in v0.2.42
func (s *Student) GetNoticeDetail(req *NoticeDetailReq) (*NoticeDetail, error)
GetNoticeDetail 获取通知正文内容
func (*Student) GetNoticeInfo ¶ added in v0.2.3
func (s *Student) GetNoticeInfo(req *NoticeInfoReq) (list []*NoticeInfo, totalPages int, err error)
func (*Student) GetQiShanEmptyRoom ¶
func (s *Student) GetQiShanEmptyRoom(req EmptyRoomReq) ([]string, error)
func (*Student) GetSchoolCalendar ¶
func (s *Student) GetSchoolCalendar() (*SchoolCalendar, error)
func (*Student) GetSemesterCourses ¶
获取我的选课
func (*Student) GetTermEvents ¶
func (s *Student) GetTermEvents(termId string) (*CalTermEvents, error)
func (*Student) GetWithIdentifier ¶
func (*Student) NewRequest ¶
func (*Student) PostWithIdentifier ¶
PostWithIdentifier returns parse tree for the resp of the request.
func (*Student) SetCookies ¶
func (*Student) SetIdentifier ¶
func (*Student) WithLoginData ¶
type StudentDetail ¶
type StudentDetail struct {
Name string `json:"name"` // 姓名
Sex string `json:"sex"` // 性别
Birthday string `json:"birthday"` // 出生日期
Phone string `json:"phont"` // 手机号
Email string `json:"email"` // 邮箱
College string `json:"college"` // 学院
Grade string `json:"grade"` // 年级
StatusChanges string `json:"status_change"` // 学籍异动与奖励
Major string `json:"major"` // 专业
Counselor string `json:"counselor"` // 辅导员
ExamineeCategory string `json:"examinee_category"` // 考生类别
Nationality string `json:"nationality"` // 民族
Country string `json:"country"` // 国别
PoliticalStatus string `json:"political_status"` // 政治面貌
Source string `json:"source"` // 生源地
}
学生信息详情
type Term ¶
type Term struct {
Terms []string `json:"terms"` // 学期数量
ViewState string `json:"viewstate"` // 课表必要信息
EventValidation string `json:"eventvalidation"` // 课表必要信息
}
学期信息
type TunnelData ¶ added in v0.2.24
type TunnelData struct {
Server string `json:"server"` // 代理服务器地址,格式: host:port
Area string `json:"area"` // 区域代码
Distinct bool `json:"distinct"` // 是否独享
}
TunnelData 隧道数据
type TunnelResponse ¶ added in v0.2.24
type TunnelResponse struct {
Code string `json:"code"` // 响应码,"SUCCESS"表示成功
Data []TunnelData `json:"data"` // 隧道数据数组
RequestId string `json:"request_id"` // 请求ID
}
TunnelResponse 隧道地址响应
type UnifiedExam ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.