Example #1
0
def main(stuId):
    url = 'https://zjyapp.icve.com.cn/newmobileapi/onlineExam/saveExamTimeInfo?data='
    allcourse = get_all_course(stuId)
    openClassId = allcourse['openClassId']
    courseOpenId = allcourse['courseOpenId']
    exams = exam_list(openClassId, courseOpenId, stuId)
    index = 1
    for i in exams:
        print(f'【{index}】{i["title"]}\t{i["startDate"]}')
        index += 1
    target = exams[int(input("请输入序号:")) - 1]
    examId = target['examId']
    examTermTimeId = target['examTermTimeId']
    starttime = input("请输入开始时间(2020-03-20 00:00:00):")
    endtime = input("请输入结束时间(2020-03-20 00:00:00):")
    teaid = getteaid(openClassId, courseOpenId)
    xdata = f'{{"Id":"{examTermTimeId}","CreatorId":"{teaid}","OpenClassId":"{openClassId}","ExamId":"{examId}","StuStartDate":"{starttime}","StuEndDate":"{endtime}"}}'
    result_url = url + xdata
    result = requests.post(url=result_url).json()
    print(result['msg'])
    sele = input("【1】返回首页\n【2】返回上级\n请选择:")
    if sele == 2:
        main(stuId)
    else:
        from Main import main as menu
        menu()
Example #2
0
def Main(stuId):
    allcourse = get_all_course(stuId)
    if allcourse == 0:
        print("获取失败")
    else:
        index = 1
        for i in allcourse:
            print(f"【{index}】{i['courseName']}\t{i['mainTeacherName']}")
            index += 1
        course_index = int(input("请输入数字序号:")) - 1
    openClassId = allcourse[course_index]['openClassId']
    courseOpenId = allcourse[course_index]['courseOpenId']
    homeworklist = get_homework_list(stuId, openClassId, courseOpenId)
    if homeworklist == 0:
        print("获取失败")
    else:
        index = 1
        for i in homeworklist:
            print(f'【{index}】{i["title"]}\t{i["stuHomeworkState"]}')
            index += 1
        homework_index = int(input("请输入数字序号:")) - 1
        homeworkId = homeworklist[homework_index]['homeworkId']
        homeworkTermTimeId = homeworklist[homework_index]['homeworkTermTimeId']
        grades = get_homework_grade(openClassId, homeworkId, stuId,
                                    homeworkTermTimeId)
        index = 1
        for i in grades:
            print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}")
            index += 1
        target = int(input("请输入要修改的序号:")) - 1
        homeworkStuId = grades[target]['homeworkStuId']
        getScore = int(input("请输入目标分数(整数):"))
        Teaid = input("请输入教师ID(获取方法见www.lanol.cn):")
        re_grade(Teaid, homeworkStuId, getScore)
Example #3
0
def main(stuId):
    time = input("请输入结束时间(格式2020-5-21):")
    teaid = input("请输入教师ID(获取方法:www.lanol.cn):")
    allcourse = get_all_course(stuId)
    if allcourse == 0:
        print("获取失败")
    else:
        index = 1
        for i in allcourse:
            print(f"【{index}】{i['courseName']}\t{i['mainTeacherName']}")
            index += 1
        course_index = int(input("请输入数字序号:")) - 1
    openClassId = allcourse[course_index]['openClassId']
    courseOpenId = allcourse[course_index]['courseOpenId']
    homeworklist = get_homework_list(stuId, openClassId, courseOpenId)
    if homeworklist == 0:
        print("获取失败")
    else:
        index = 1
        for i in homeworklist:
            print(f'【{index}】{i["title"]}\t{i["stuHomeworkState"]}')
            index += 1
        homework_index = int(input("请输入数字序号:")) - 1
        homeworkId = homeworklist[homework_index]['homeworkId']
        retime(time, teaid, homeworkId, courseOpenId, openClassId)
Example #4
0
def main(stuId):
    allcourse = get_all_course(stuId)
    openClassId = allcourse['openClassId']
    courseOpenId = allcourse['courseOpenId']
    homeworklist = get_homework_list(stuId, openClassId, courseOpenId)
    if homeworklist == 0:
        print("获取失败")
    else:
        homeworkTermTimeId = homeworklist['homeworkTermTimeId']
        homeworkId = homeworklist['homeworkId']
        grades = get_homework_grade(openClassId, homeworkId, stuId,
                                    homeworkTermTimeId)
        if grades != 0:
            index = 1
            for i in grades:
                print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}")
                index += 1
            target = int(input("请输入要修改的序号:")) - 1
            homeworkStuId = grades[target]['homeworkStuId']
        else:
            input("回车键后退出")
    teaId = input("请输入教师ID")
    url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/rejectHomework'
    data = {
        'homeworkStuId': homeworkStuId,
        'teaId': teaId,
    }
    result = requests.post(url=url, data=data).json()
    print(result['msg'])
    sele = input("【1】返回首页\n【2】返回上级\n请选择:")
    if sele == 2:
        main(stuId)
    else:
        from Main import main as menu
        menu()
Example #5
0
def examlist(stuid):
    courses = get_all_course(stuid)
    openClassId = courses['openClassId']
    courseOpenId = courses['courseOpenId']
    exam_list = exams(openClassId, courseOpenId, stuid)
    index = 1
    for i in exam_list:
        print(f"【{index}】{i['title']}")
    target = int(input("请选择需要退回的考试:")) - 1
    examId = exam_list[target]['examId']
    examTermTimeId = exam_list[target]['examTermTimeId']
    url = 'https://zjyapp.icve.com.cn/newmobileapi/onlineExam/getReadStuList'
    data = {
        'courseOpenId': courseOpenId,
        'openClassId': openClassId,
        'examId': examId,
        'examTermTimeId': examTermTimeId,
    }
    html = requests.post(url=url, data=data).json()
    print(html['msg'])
    num = 0
    for i in html['examStuList']:
        if i['stuId'] == stuid:
            examStuId = i['examStuId']
            num = 1
    if num == 0:
        print("未发现你的试卷,请先提交")
        from Main import main as menu
        menu()
    reurl = 'https://zjyapp.icve.com.cn/newmobileapi/onlineExam/rejectExam'
    data = {'examStuId': examStuId}
    html = requests.post(url=reurl, data=data).json()
    input(html['msg'])
    from Main import main as menu
    menu()
Example #6
0
def Main(stuId):
    allcourse = get_all_course(stuId)
    openClassId = allcourse['openClassId']
    courseOpenId = allcourse['courseOpenId']
    homeworklist = get_homework_list(stuId, openClassId, courseOpenId)
    if homeworklist == 0:
        print("获取失败")
    else:
        homeworkTermTimeId = homeworklist['homeworkTermTimeId']
        homeworkId = homeworklist['homeworkId']
        grades = get_homework_grade(openClassId, homeworkId, stuId,
                                    homeworkTermTimeId)
        if grades != 0:
            index = 1
            for i in grades:
                print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}")
                index += 1
            target = int(input("请输入要修改的序号:")) - 1
            homeworkStuId = grades[target]['homeworkStuId']
            getScore = int(input("请输入目标分数(整数):"))
            result = re_grade(homeworkStuId, getScore)
            print(result)
            input("回车键后退出")
        else:
            input("回车键后退出")
Example #7
0
def Main(stuId):
    print("注意:改分只可以改非题库作业,需要老师批阅的")
    allcourse = get_all_course(stuId)
    openClassId = allcourse['openClassId']
    courseOpenId = allcourse['courseOpenId']
    homeworklist = get_homework_list(stuId, openClassId, courseOpenId)
    if homeworklist == 0:
        print("获取失败")
    else:
        homeworkTermTimeId = homeworklist['homeworkTermTimeId']
        homeworkId = homeworklist['homeworkId']
        grades = get_homework_grade(openClassId, homeworkId, stuId,
                                    homeworkTermTimeId)
        if grades != 0:
            index = 1
            for i in grades:
                print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}")
                index += 1
            target = int(input("请输入要修改的序号:")) - 1
            if target > len(grades):
                print("请输入正确的序号")
                target = int(input("请输入要修改的序号:")) - 1
            homeworkStuId = grades[target]['homeworkStuId']
            getScore = int(input("请输入目标分数(整数):"))
            result = re_grade(homeworkStuId, getScore)
            print(result)
            input("回车后返回首页!")
            from Main import main as menu
            menu()
        else:
            Main(stuId)
            input("回车后返回首页!")
            from Main import main as menu
            menu()
def main(stuId):
    allcourse = get_all_course(stuId)
    openClassId = allcourse['openClassId']
    courseOpenId = allcourse['courseOpenId']
    time = input("请输入结束时间(格式2020-5-21):")
    teaid = getteaid(openClassId, courseOpenId)
    homeworklist = get_homework_list(stuId, openClassId, courseOpenId)
    homeworkId = homeworklist['homeworkId']
    retime(time, teaid, homeworkId, courseOpenId, openClassId)
Example #9
0
def main(stuid):
    info = get_all_course(stuid)
    url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/getHomeworkList_new'
    data = {
        'openClassId': info['openClassId'],
        'courseOpenId': info['courseOpenId'],
        'pageSize': '100',
        'page': '1',
        'stuId': stuid,
    }
    html = requests.post(url=url, data=data).json()
    for k in html['homeworkList']:
        url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/previewHomework'
        data = {'homeWorkId': k['homeworkId']}
        html = requests.post(url=url, data=data).json()['data']
        title = html['title']
        with open(f'{title}.txt', 'w', encoding='utf8') as f:
            for i in html['questions']:
                Qusetion_title = i["title"]
                Qusetion_title = Qusetion_title.replace('<p>', '').replace(
                    '</p>', '').replace('</span>',
                                        '').replace('<br/>',
                                                    '').replace('&nbsp;', '')
                Qusetion_title = re.sub('<.*?>', "", Qusetion_title)
                f.write(f'{int(i["sortOrder"]) + 1},{Qusetion_title}\n')
                try:
                    selects = json.loads(i['dataJson'])
                    for j in selects:
                        tihuan = {
                            '0': 'A',
                            '1': 'B',
                            '2': 'C',
                            '3': 'D',
                            '4': 'E',
                            '5': 'F',
                        }
                        select = tihuan[str(j['SortOrder'])]
                        content = j["Content"]
                        content = content.replace('&nbsp;', '')
                        f.write(f'{select},{content}\n')
                    answer = i["answer"].replace('0', 'A').replace(
                        '1', 'B').replace('2', 'C').replace('3', 'D').replace(
                            '4', 'E').replace('5',
                                              'F').replace('6', 'G').replace(
                                                  '7', 'H').replace('8', 'I')
                    f.write(f'Answer:{answer}\n')
                except:
                    answer = i["answer"].replace('0', 'A').replace(
                        '1', 'B').replace('2', 'C').replace('3', 'D').replace(
                            '4', 'E').replace('5',
                                              'F').replace('6', 'G').replace(
                                                  '7', 'H').replace('8', 'I')
                    f.write(f'Answer:{answer}\n')
            print(f'{title}已下载')
    input("作业答案已生成在软件目录下。请回车退出")
Example #10
0
def main(stuid):
    info = get_all_course(stuid)
    homrwork_list = get_homework_list(stuid, info['openClassId'], info['courseOpenId'])
    homeworkId = homrwork_list['homeworkId']
    url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/previewHomework'
    data = {
        'homeWorkId': homeworkId
    }
    #html = requests.post(url=url, data=data).json()['data']
    html = requests.post(url=url, data=data).text
    html = html.replace('&nbsp;', '')
    html = re.sub('<.*?>', "", html)
    Rinse(json.loads(html)['data'])
Example #11
0
def exam_list(stuId):
    allcourse = get_all_course(stuId)
    url = 'https://zjyapp.icve.com.cn/newmobileapi/onlineExam/getExamList_new'
    data = {
        'openClassId': allcourse['openClassId'],
        'courseOpenId': allcourse['courseOpenId'],
        'pageSize': '100',
        'stuId': stuId,
    }
    html = requests.post(url=url, data=data).json()
    if html['code'] == 1:
        return html['examList']
    else:
        print(html['msg'])
        input("回车退出!")
Example #12
0
def main(stuid):
    info = get_all_course(stuid)
    url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/getHomeworkList_new'
    data = {
        'openClassId': info['openClassId'],
        'courseOpenId': info['courseOpenId'],
        'pageSize': '100',
        'page': '1',
        'stuId': stuid,
    }
    html = requests.post(url=url, data=data).json()
    for k in html['homeworkList']:
        url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/previewHomework'
        data = {'homeWorkId': k['homeworkId']}
        html = requests.post(url=url, data=data).json()['data']
        Rinse(html)
def main(stuid):
    info = get_all_course(stuid)
    homrwork_list = get_homework_list(stuid, info['openClassId'],
                                      info['courseOpenId'])
    homeworkId = homrwork_list['homeworkId']
    url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/previewHomework'
    data = {'homeWorkId': homeworkId}
    html = requests.post(url=url, data=data).text
    html = html.replace('&nbsp;', '').replace('</span>', '').replace(
        '</p>', '').replace('</font>', '').replace('<strong>', '').replace(
            '</strong>', '').replace('<b>', '').replace('</b>', '').replace(
                '<div>', '').replace('</div>',
                                     '').replace('<br>',
                                                 '').replace('<br/>', '')
    html = re.sub('<p.*?>', "", html)
    html = re.sub('<span.*?>', "", html)
    html = re.sub('<font.*?>', "", html)
    Rinse(json.loads(html)['data'])
Example #14
0
def Main(stuId):
    allcourse = get_all_course(stuId)
    openClassId = allcourse['openClassId']
    courseOpenId = allcourse['courseOpenId']
    homeworklist = get_homework_list(stuId, openClassId, courseOpenId)
    if homeworklist == 0:
        print("获取失败")
    else:
        homeworkTermTimeId = homeworklist['homeworkTermTimeId']
        homeworkId = homeworklist['homeworkId']
        grades = get_homework_grade(openClassId, homeworkId, stuId,
                                    homeworkTermTimeId)
        if grades != 0:
            index = 1
            for i in grades:
                print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}")
                index += 1
            target = int(input("请输入要修改的序号:")) - 1
            homeworkStuId = grades[target]['homeworkStuId']
            getScore = int(input("请输入目标分数(整数):"))
            result = re_grade(homeworkStuId, getScore)
            print(result)
            sele = input("【1】返回首页\n【2】返回上级")
            if sele == 2:
                Main(stuId)
            else:
                from Main import main as menu
                menu()
        else:
            Main(stuId)
            sele = input("【1】返回首页\n【2】返回上级\n请选择:")
            if sele == 2:
                Main(stuId)
            else:
                from Main import main as menu
                menu()
def main(stuid, schoolid):
    allcourse = get_all_course(stuid)
    print(allcourse)
    courseOpenId = allcourse['courseOpenId']
    url = 'https://zjyapp.icve.com.cn/newmobileapi/coursequestion/getCourseQuestionList'
    data = {
        'schoolId': schoolid,
        'courseOpenId': courseOpenId,
        'limit': '1000',
    }
    tihuana = {
        '0': 'A',
        '1': 'B',
        '2': 'C',
        '3': 'D',
        '4': 'E',
        '5': 'F',
        '6': 'G',
        '7': 'H',
        '8': 'I',
    }
    # PreviewList = requests.post(url=url, data=data).json()
    # 先转为文本删除无效内容再转回去json处理
    PreviewListReq = requests.post(url=url, data=data).text
    PreviewListReq = PreviewListReq.replace('&nbsp;', '').replace(
        '</span>', '').replace('</p>', '').replace('</font>', '').replace(
            '<strong>',
            '').replace('</strong>',
                        '').replace('<b>', '').replace('</b>', '').replace(
                            '<div>',
                            '').replace('</div>',
                                        '').replace('<br>',
                                                    '').replace('<br/>', '')
    PreviewListReq = re.sub('<p.*?>', "", PreviewListReq)
    PreviewListReq = re.sub('<span.*?>', "", PreviewListReq)
    PreviewListReq = re.sub('<font.*?>', "", PreviewListReq)
    PreviewList = json.loads(PreviewListReq)
    if PreviewListReq.find('<img') > 0:
        hhf = '<br />'
        kzm = '.html'
    else:
        hhf = '\n'
        kzm = '.txt'

    if PreviewList['code'] == 1:
        questions = PreviewList['questionList']
        index = 1
        filename = time.strftime("%Y-%m-%d-%H-%M", time.localtime())
        for item in questions:
            Title = item['title']
            try:
                with open(f"{filename}" + kzm, "a", encoding="utf-8") as file:
                    if item['queTypeName'] == "单选题":
                        dataJsons = json.loads(item['dataJson'])
                        Contents = ''
                        for SortOrder_i in range(len(dataJsons)):
                            tihao = tihuana[str(
                                dataJsons[SortOrder_i]['SortOrder'])]
                            Content = dataJsons[SortOrder_i]['Content']
                            if dataJsons[SortOrder_i]['IsAnswer'] == True:
                                key = '单选题答案:' + tihao + '.' + Content
                            Contents = Contents + tihao + '.' + Content + hhf
                        Contents = Contents + key
                        file.write('题目' + str(index) + ':' + Title + hhf +
                                   Contents + hhf + hhf)
                    if item['queTypeName'] == "多选题":
                        dataJsons = json.loads(item['dataJson'])
                        Contents = ''
                        key = '多选题答案:'
                        for SortOrder_i in range(len(dataJsons)):
                            tihao = tihuana[str(
                                dataJsons[SortOrder_i]['SortOrder'])]
                            Content = dataJsons[SortOrder_i]['Content']
                            if dataJsons[SortOrder_i]['IsAnswer'] == True:
                                key = key + tihao + '.' + Content + ','
                            Contents = Contents + tihao + '.' + Content + hhf
                        if key[-1] == ',':
                            key = key[0:-1]
                        Contents = Contents + key
                        file.write('题目' + str(index) + ':' + Title + hhf +
                                   Contents + '\n\n')
                    if item['queTypeName'] == "判断题":
                        x = item['answer'].replace('0', '错').replace(
                            '1', '对').replace('2',
                                              '').replace('3',
                                                          '').replace('4', '')
                        file.write('题目' + str(index) + ':' + Title + hhf +
                                   hhf + "判断题答案:" + x + hhf + hhf)
                    if item['queTypeName'] == "问答题":
                        y = item['answer']
                        file.write('题目' + str(index) + ':' + Title + hhf +
                                   hhf + '问答题答案:' + y + hhf + hhf)
                    if item['queTypeName'] == "填空题(客观)":
                        y = item['answer']
                        file.write('题目' + str(index) + ':' + Title + hhf +
                                   hhf + '填空题(客观)答案:' + y + hhf + hhf)
                    if item['queTypeName'] == '填空题(主观)':
                        y = item['answer']
                        file.write('题目' + str(index) + ':' + Title + '\n\n' +
                                   '填空题(主观)答案:' + y + '\n\n')
                    index += 1
            except json.JSONDecodeError as e:
                print(PreviewList)
                pass
        print(f"{filename}已下载")
        print("答案已保存软件根目录下!")
        input("回车后返回首页!")
        from Main import main as menu
        menu()
Example #16
0
def main(stuid, schoolid):
    allcourse = get_all_course(stuid)
    courseOpenId = allcourse['courseOpenId']
    url = 'https://zjyapp.icve.com.cn/newmobileapi/coursequestion/getCourseQuestionList'
    data = {
        'schoolId': schoolid,
        'courseOpenId': courseOpenId,
        'limit': '1000',
    }
    tihuana = {
        '0': 'A',
        '1': 'B',
        '2': 'C',
        '3': 'D',
        '4': 'E',
        '5': 'F',
        '6': 'G',
        '7': 'H',
        '8': 'I',
    }
    # PreviewList = requests.post(url=url, data=data).json()
    # 先转为文本删除无效内容再转回去json处理
    PreviewListReq = requests.post(url=url, data=data).text
    PreviewListReq = PreviewListReq.replace('&nbsp;', '')
    PreviewListReq = re.sub('<.*?>', "", PreviewListReq)
    PreviewList = json.loads(PreviewListReq)

    if PreviewList['code'] == 1:
        questions = PreviewList['questionList']
        index = 1
        filename = time.strftime("%Y-%m-%d-%H-%M", time.localtime())
        for item in questions:
            # Title = item['title'].replace('&nbsp;', '').replace('<p>', '').replace('</p>', '').replace('<strong>',
            # '').replace(
            #   '</strong>', '').replace('<br/>', '')
            Title = item['title']
            # Title = re.sub('<.*?>', "", Title)
            # dataJson = item['dataJson'].replace('true', ':对').replace('false', '').replace('[', '').replace(']', '') \
            # .replace('"', '').replace('SortOrder', '').replace('0', '').replace('1', '').replace('2', '').replace(
            # '4', '').replace(
            # '3', '') \
            # .replace('Content', '').replace(':', '').replace('IsAnswer', '').replace(',', '  ').replace('&nbsp;',
            # '')
            # dataJson = re.sub('<.*?>', "", dataJson)
            dataJson = item['dataJson']
            try:
                with open(f"{filename}.txt", "a", encoding="utf-8") as file:
                    if item['queTypeName'] == "单选题":
                        dataJsons = json.loads(item['dataJson'])
                        Contents = ''
                        for SortOrder_i in range(len(dataJsons)):
                            tihao = tihuana[str(
                                dataJsons[SortOrder_i]['SortOrder'])]
                            Content = dataJsons[SortOrder_i]['Content']
                            if dataJsons[SortOrder_i]['IsAnswer'] == True:
                                key = '单选题答案:' + tihao + '.' + Content
                            Contents = Contents + tihao + '.' + Content + '\n'
                        Contents = Contents + key
                        # file.write('题目' + str(index) + ':' + Title + '\n' + '单选题答案:' + dataJson + '\n\n')
                        file.write('题目' + str(index) + ':' + Title + '\n' +
                                   Contents + '\n\n')
                    if item['queTypeName'] == "多选题":
                        dataJsons = json.loads(item['dataJson'])
                        Contents = ''
                        key = '多选题答案:'
                        for SortOrder_i in range(len(dataJsons)):
                            tihao = tihuana[str(
                                dataJsons[SortOrder_i]['SortOrder'])]
                            Content = dataJsons[SortOrder_i]['Content']
                            if dataJsons[SortOrder_i]['IsAnswer'] == True:
                                key = key + tihao + '.' + Content + ','
                            Contents = Contents + tihao + '.' + Content + '\n'
                        if key[-1] == ',':
                            key = key[0:-1]
                        Contents = Contents + key
                        file.write('题目' + str(index) + ':' + Title + '\n' +
                                   Contents + '\n\n')
                    if item['queTypeName'] == "判断题":
                        x = item['answer'].replace('0', '错').replace(
                            '1', '对').replace('2',
                                              '').replace('3',
                                                          '').replace('4', '')
                        file.write('题目' + str(index) + ':' + Title + '\n' +
                                   "判断题答案:" + x + '\n\n')
                    if item['queTypeName'] == "问答题":
                        y = item['answer']
                        file.write('题目' + str(index) + ':' + Title + '\n\n' +
                                   '问答题答案:' + y + '\n\n')
                    if item['queTypeName'] == "填空题(客观)":
                        y = item['answer']
                        file.write('题目' + str(index) + ':' + Title + '\n\n' +
                                   '填空题(客观)答案:' + y + '\n\n')
                    index += 1
            except json.JSONDecodeError as e:
                print(PreviewList)
                pass
        print(f"{filename}已下载")
        print("答案已保存软件根目录下!")
        sele = input("【1】返回首页\n【2】返回上级\n请选择:")
        if sele == 2:
            main(stuid, schoolid)
        else:
            from Main import main as menu
            menu()