deason 1 년 전
부모
커밋
a8477ba23b
4개의 변경된 파일28개의 추가작업 그리고 16개의 파일을 삭제
  1. 1 1
      exportexamdetail/config.properties
  2. 9 9
      exportexamdetail/config.py
  3. 17 5
      exportexamdetail/examInf.py
  4. 1 1
      exportexamdetail/main.py

+ 1 - 1
exportexamdetail/config.properties

@@ -2,7 +2,7 @@
 username=
 password=654321
 examId=4527
-courseId=
+courseIds=
 studentCodes=
 outputpath=D:/output
 domain=hnsfdx.exam-cloud.cn

+ 9 - 9
exportexamdetail/config.py

@@ -1,12 +1,12 @@
 import configparser
 import os
-parseer=configparser.ConfigParser();
-parseer.read(os.getcwd()+os.sep+"config.properties",encoding="utf-8")
-username=parseer["config"]["username"]
-password=parseer["config"]["password"]
-examId=parseer["config"]["examId"]
-courseId=parseer["config"]["courseId"]
-studentCodes=parseer["config"]["studentCodes"]
-outputpath=parseer["config"]["outputpath"]
-domain=parseer["config"]["domain"]
 
+parseer = configparser.ConfigParser();
+parseer.read(os.getcwd() + os.sep + "config.properties", encoding="utf-8")
+username = parseer["config"]["username"]
+password = parseer["config"]["password"]
+examId = parseer["config"]["examId"]
+courseIds = parseer["config"]["courseIds"]
+studentCodes = parseer["config"]["studentCodes"]
+outputpath = parseer["config"]["outputpath"]
+domain = parseer["config"]["domain"]

+ 17 - 5
exportexamdetail/examInf.py

@@ -44,7 +44,7 @@ def login():
 
 
 @calctime
-def querydetail(curpage):
+def doExport():
     print('')
 
     if len(config.examId) == 0:
@@ -53,8 +53,20 @@ def querydetail(curpage):
 
     login()
 
+    if len(config.courseIds) > 0:
+        courseIds = config.courseIds.split(',')
+        for courseId in courseIds:
+            querydetail(1, courseId)
+    else:
+        querydetail(1, None)
+
+
+@calctime
+def querydetail(curpage, courseId):
+    print('')
+
     url = "https://" + config.domain + "/api/ecs_oe_admin/exam/record/detail/list"
-    params = {"rootOrgId": config.rootOrgId, "examRecordDataId": None, "hasStranger": None, "courseId": config.courseId,
+    params = {"rootOrgId": config.rootOrgId, "examRecordDataId": None, "hasStranger": None, "courseId": courseId,
               "courseLevel": None,
               "examId": config.examId, "faceSuccessPercentLower": None, "faceSuccessPercentUpper": None,
               "identityNumber": None,
@@ -68,14 +80,14 @@ def querydetail(curpage):
         contents = result.json()["content"]
         totalPages = result.json()["totalPages"]
         totalElements = result.json()["totalElements"]
-        print(
-            "---> totalElements=" + str(totalElements) + " totalPages=" + str(totalPages) + " curPage=" + str(curpage))
+        print("---> totalElements=" + str(totalElements) + " totalPages=" + str(totalPages)
+              + " curPage=" + str(curpage) + " courseId=" + str(courseId))
 
         for content in contents:
             solveexamRecord(content)
 
         if curpage < totalPages:
-            querydetail(curpage + 1)
+            querydetail(curpage + 1, courseId)
     else:
         raise Exception("获取数据失败,请检查配置参数或网络是否正常!")
 

+ 1 - 1
exportexamdetail/main.py

@@ -3,7 +3,7 @@ import examInf
 
 def main():
     try:
-        examInf.querydetail(1)
+        examInf.doExport()
     except Exception as e:
         print(e)
     finally: