Skip to main content

· One min read
Hu Anwen

发布日期:2023年10月5日

添加的函数和类

# ---------------教师---------------
def get_teacher_roleText() as Teacher
def set_advanced_info() as Teacher
self.teaching_classes as Teacher
self.teaching_grade as Teacher
self.teaching_textbook as Teacher
self.province as Teacher
self.city as Teacher
self.subject as Teacher

# ---------------学生---------------
def get_homework_answer(self, homework: StuHomework) -> List[HwAnswer]



class AcademicInfo:
'''学业信息,用以get_exams查询'''
term_id: str
circles_year: str
teaching_cycle_id: str
begin_time: int
end_time: int
school_id: str
class TextBook:
'''教科书类'''
code: str = ""
"""教科书编号"""
name: str = ""
"""教科书名称"""
version: str = ""
"""教科书版本,如北师大、人教、部编等"""
versionCode: int = 0
"""教科书版本编号"""
bindSubject: BasicSubject = BasicSubject()
def __str__(self) -> str:
return f"{self.bindSubject.name} {self.name} ({self.version})"
class HwAnswer:
'''作业答案类'''
title: str = ""
content: str = ""


· 2 min read
Hu Anwen
警告

这是一个破坏性更新,在此版本内我们移除了一些函数,请谨慎更新!

移除的函数和类

def get_friends(self)
def invite_friend(self, friend: Union[StuPerson, str]) -> FriendMsg
def remove_friend(self, friend: Union[StuPerson, str]) -> bool
class Scores(ExtendedList[PersonScores])
class TopicTeacherMarkingProgress
def complete_precent(self) -> float
class SubjectMarkingProgress
class ExamMarkingProgress
class ExtraData
class ClassExtraData(ExtraData)
class SchoolExtraData(ExtraData)
class ExamSubjectExtraData
def get_scores(self, exam_id: str) -> Scores
def get_marking_progress(self, subject_id: str, school_id: str = "") -> List[TopicTeacherMarkingProgress]
async def _get_marking_progress_async(self, subject_id: str, school_id: str)
get_exam_extra_data
def get_exam_extra_data(self, scores: Scores) -> ExamExtraData
def get_exam_all_marking_progress(self, exam_id: str)

Scores类已被移除

已移除teacher/tools.py和tools/等。

get_authheader可以用teacher.get_headers()替换。

TopicTeacherMarkingProgress可用MarkingProgress替换。

技术更新

本更新对很多代码进行了优化(以及格式化)。主要有:

  1. Student.get_exams添加了缓存。
  2. 修改之前的报错信息,如xxx中网页内容发生改变,修改后添加了状态码
  3. 删除了Student.get_clazzstry
  4. 修改Student.get_classmates中内部逻辑到获取ExtendList(原来是StuPersonList)。
  5. 修改Student.get_homework_resources的参数为self, homework: StuHomework
  6. 删除Scores类。
  7. 修改Teacher.__get_school_exam_classes中的async方法到Url,同时使用params
  8. 删除了Teacher/tools.py,tools/等。

· 3 min read
Hu Anwen
MasterYuan
警告

这是一个破坏性更新,在此版本内我们移除了一些函数,请谨慎更新!

移除的函数

def get_score(self, user_num: str, clazz_id: str, subject_id: str):
pass

def get_topicSets(self, examId):
pass

def get_class_subject_score(self, class_id: str, subject_id: str) -> ClassSubjectScores:
pass

async def __get_class_scores(self, class_id: str, exam_id: str) -> ClassScores:
pass

def get_authheader():
pass

以上的源代码均可以在deleted.py内找到。

get_authheader可以用teacher.get_headers()替换。

教师模块添加的函数

函数名参数解释返回
get_school_exam_classesschool_id subject_id获得该学科考试的班级List[StuClass]
get_exam_subjectsexam_id获得本次考试所有学科ExtendedList[Subject]
get_exam_detailexam_id获得本次考试的信息(等同于学生的get_exams()[0])Exam
get_scoresexam_id获得本次考试全校的信息Scores
get_marking_progresssubject_id school_id获得本次考试某校的阅卷进度List[TopicMarkingProgress]
get_token获得当前登录账户的tokenstr
get_headers获得授权头{"token": ""}

学生模块添加的函数

函数名参数解释返回
get_page_exampage_index as int获得指定页数的考试列表Tuple[ExtendedList[Exam], bool],其中最后一个bool为成功标志
get_latest_exam获得最新的考试ExamInfo
get_exams获得所有考试ExtendedList[Exam]
get_self_markexam_data as Union[Exam, str] has_total_score as bool = True获得指定考试的成绩Mark(has_total_score为True表示最后会添加一个总分)
get_subjectsexam_data as Union[Exam, str] = ""获得指定考试的所有学科(无总分)ExtendedList[Subject]
get_subjectexam_data as Union[Exam, str] = ""获得指定考试的学科Subject
get_homeworkssize as int is_complete as bool subject_code as code获得指定数量的作业 (稍后解释)ExtendedList[StuHomework](不含作业资源)
get_homework_resourceshwid as str hw_typecode as int获取指定作业的作业资源(例如题目文档)(稍后解释)List[HwResource]

由于作业功能是首次出现,特此做介绍:

get_homeworks

该方法有四个参数:

size(int)表示返回的数量,默认为20

is_complete(bool)表示是否要取已完成的作业,True为取已完成的,False为取未完成的,默认为False

subject_code(code)表示学科代码,例如"01" 表示取语文作业, "02"表示取数学作业,默认为-1,你可以在Subject类里找到,定义叫做code

get_homework_resources

该方法有2个参数:

hwid(str):作业ID

hw_typecode(int):作业类型代码